[dpdk-dev] [PATCH v2] drivers/net:new PMD using tun/tap host interface

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed Sep 21 04:13:51 CEST 2016


On Wed, Sep 21, 2016 at 01:32:15AM +0000, Wiles, Keith wrote:
> The concern I am having is on my standard Ubuntu 16.04 system these errors do not appear.

Yes, that's really weird. To me, it's such a solid error that could be
triggered on all linux platforms.

Anyway, I saw you removed the <net/if.h> including in v3, which makes
my robot happy :)

> I would like to understand why they appeared on your system. The ifdef __linux__ must be enabled as the defines in the linux/if_tun.h file do not give an error. I did play with the headers already and removed the ifdef, but as I could not reproduce your build failure it did not trigger anything new.
> 
> I will look at it some more, but it does not make sense and I do want to make sure it works.
> 
> > 
> >> +#include <linux/if.h>
> >> +#include <linux/if_tun.h>
> >> +#include <linux/if_ether.h>
> >> +#else
> >> +#include <netinet/if_ether.h>
> >> +#endif
> >> +#include <fcntl.h>
> >> +
> >> +#include <poll.h>
> >> +
> >> +/* Linux based path to the TUN device */
> >> +#define TUN_TAP_DEV_PATH        "/dev/net/tun"
> > 
> > However, you hardcoded a linux only path here. While checking the code
> > from qemu, I saw that the path is actually different from different UNIX
> > variants, even for FreeBSD and NetBSD.
> 
> I only assumed this to work for Linux and not FreeBSD/NetBSD as the handling of the opens on the tun device are different then linux. I also only added it to the common_linux configuration file.

I didn't notice the common_linux file, but I have guessed so (that you
meant to enable linux only): the "ifdef __linux" stuff just confuses me
a bit.

	--yliu
> 
> > 
> >    [yliu at yliu-dev ~/qemu]$ grep -E "/dev/.*(tap|tun)" net/tap*.c
> >    net/tap-bsd.c:            snprintf(dname, sizeof dname, "/dev/tun%d", i);
> >    net/tap-bsd.c:            snprintf(dname, sizeof dname, "/dev/tap%d", i);
> >    net/tap-bsd.c:#define PATH_NET_TAP "/dev/tap"
> >    net/tap-linux.c:#define PATH_NET_TUN "/dev/net/tun"
> >    net/tap-solaris.c:    TFR(tap_fd = open("/dev/tap", O_RDWR, 0));
> >    ...
> > 
> > 	--yliu


More information about the dev mailing list