[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-16 10:07, John W. Linville: > On Tue, Jul 15, 2014 at 11:27:45PM +0200, Thomas Monjalon wrote: > > 2014-07-14 09:46, John W. Linville: > > > On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > > > > 2014-07-11 13:40, John W. Linville: > > > > > Is there an example of code in DPDK that requires specific kernel > > > > > versions? What is the preferred method for coding such > > > > > dependencies? > > > > > > > > No there is no userspace code checking kernel version in DPDK. > > > > Feel free to use what you think the best method. > > > > Please keep in mind that checking version number is a maintenance > > > > nightmare > > > > because of backports (like RedHat do ;). > > > > > > I suppose that it could be a configuration option? > > > > If there is no other way to configure kernel-dependent features, we can > > add > > options. But I feel that relying on a macro (#ifdef) would be better if > > such macro exist. > > I can add #ifdef or #if defined() for the newer definitions. Is there > a minimum kernel version supported today? 2.6.32 is the minimum version. But it's known to be easily usable since Linux 2.6.34. -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2.6.32 is minimum, but I believe still needs patches to fix hugetlbfs issues. I think the first kernel which had all the features we need, and doesn't require patches, is 2.6.33.6. Jeff -Original Message- From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Thomas Monjalon Sent: Wednesday, July 16, 2014 7:27 AM To: John W. Linville Cc: dev at dpdk.org Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices 2014-07-16 10:07, John W. Linville: > On Tue, Jul 15, 2014 at 11:27:45PM +0200, Thomas Monjalon wrote: > > 2014-07-14 09:46, John W. Linville: > > > On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > > > > 2014-07-11 13:40, John W. Linville: > > > > > Is there an example of code in DPDK that requires specific > > > > > kernel versions? What is the preferred method for coding such > > > > > dependencies? > > > > > > > > No there is no userspace code checking kernel version in DPDK. > > > > Feel free to use what you think the best method. > > > > Please keep in mind that checking version number is a > > > > maintenance nightmare because of backports (like RedHat do ;). > > > > > > I suppose that it could be a configuration option? > > > > If there is no other way to configure kernel-dependent features, we > > can add options. But I feel that relying on a macro (#ifdef) would > > be better if such macro exist. > > I can add #ifdef or #if defined() for the newer definitions. Is there > a minimum kernel version supported today? 2.6.32 is the minimum version. But it's known to be easily usable since Linux 2.6.34. -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-16 08:35, Neil Horman: > On Tue, Jul 15, 2014 at 11:27:45PM +0200, Thomas Monjalon wrote: > > 2014-07-14 09:46, John W. Linville: > > > On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > > > > 2014-07-11 13:40, John W. Linville: > > > > > Is there an example of code in DPDK that requires specific kernel > > > > > versions? What is the preferred method for coding such > > > > > dependencies? > > > > > > > > No there is no userspace code checking kernel version in DPDK. > > > > Feel free to use what you think the best method. > > > > Please keep in mind that checking version number is a maintenance > > > > nightmare > > > > because of backports (like RedHat do ;). > > Actually, I feel the need to correct this (I know you're being humorous, but > just the same). You don't have a maintenence nightmare on your hands > because RedHat backports kernel features, you have a nightmare maintenece > situation on your hands because the DPDK uses kernel features that were > never meant to be directly accessed outside of kernel space. > Neil You're right. Removing kernel modules from DPDK is a nice goal. But here we were speaking about an userland library (AF_PACKET PMD) which rely on kernel features. -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Tue, Jul 15, 2014 at 11:27:45PM +0200, Thomas Monjalon wrote: > 2014-07-14 09:46, John W. Linville: > > On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > > > 2014-07-11 13:40, John W. Linville: > > > > Is there an example of code in DPDK that requires specific kernel > > > > versions? What is the preferred method for coding such dependencies? > > > > > > No there is no userspace code checking kernel version in DPDK. > > > Feel free to use what you think the best method. > > > Please keep in mind that checking version number is a maintenance > > > nightmare > > > because of backports (like RedHat do ;). > > > > I suppose that it could be a configuration option? > > If there is no other way to configure kernel-dependent features, we can add > options. But I feel that relying on a macro (#ifdef) would be better if such > macro exist. I can add #ifdef or #if defined() for the newer definitions. Is there a minimum kernel version supported today? John -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Tue, Jul 15, 2014 at 11:27:45PM +0200, Thomas Monjalon wrote: > 2014-07-14 09:46, John W. Linville: > > On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > > > 2014-07-11 13:40, John W. Linville: > > > > Is there an example of code in DPDK that requires specific kernel > > > > versions? What is the preferred method for coding such dependencies? > > > > > > No there is no userspace code checking kernel version in DPDK. > > > Feel free to use what you think the best method. > > > Please keep in mind that checking version number is a maintenance > > > nightmare > > > because of backports (like RedHat do ;). > > Actually, I feel the need to correct this (I know you're being humorous, but just the same). You don't have a maintenence nightmare on your hands because RedHat backports kernel features, you have a nightmare maintenece situation on your hands because the DPDK uses kernel features that were never meant to be directly accessed outside of kernel space. Neil > > I suppose that it could be a configuration option? > > If there is no other way to configure kernel-dependent features, we can add > options. But I feel that relying on a macro (#ifdef) would be better if such > macro exist. > > -- > Thomas >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-14 09:46, John W. Linville: > On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > > 2014-07-11 13:40, John W. Linville: > > > Is there an example of code in DPDK that requires specific kernel > > > versions? What is the preferred method for coding such dependencies? > > > > No there is no userspace code checking kernel version in DPDK. > > Feel free to use what you think the best method. > > Please keep in mind that checking version number is a maintenance > > nightmare > > because of backports (like RedHat do ;). > > I suppose that it could be a configuration option? If there is no other way to configure kernel-dependent features, we can add options. But I feel that relying on a macro (#ifdef) would be better if such macro exist. -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Sat, Jul 12, 2014 at 12:30:34AM +0200, Thomas Monjalon wrote: > About the form of the patch, I have 2 comments: > > 1) A doc explaining the design, the dependencies and how it can be used would > be a great help. Could you write it in rst format? What is rst format? Are there other examples in the repository? > 2) checkpatch.pl returns these errors: > > ERROR:SPACING: space required before the open parenthesis '(' > #468: FILE: lib/librte_pmd_packet/rte_eth_packet.c:250: > + if(sockfd != -1) > > ERROR:SPACING: space required before the open parenthesis '(' > #471: FILE: lib/librte_pmd_packet/rte_eth_packet.c:253: > + if(sockfd != -1) > > ERROR:SPACING: spaces required around that '=' (ctx:VxV) > #712: FILE: lib/librte_pmd_packet/rte_eth_packet.c:494: > + ifr.ifr_name[ifnamelen]='\0'; OK. FWIW, at least the first two are slightly changed from what was copied from the PCAP driver. The other probably was a cut-n-paste error from another source. I'll post a V2 shortly... John -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Mon, Jul 14, 2014 at 09:48:33AM -0400, John W. Linville wrote: > On Fri, Jul 11, 2014 at 11:51:08PM +0100, Bruce Richardson wrote: > > On Thu, Jul 10, 2014 at 04:32:49PM -0400, John W. Linville wrote: > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > I'm just trying this out now on a Fedora 20 machine, using kernel > > 3.14.9-200.fc20.x86_64. However, while the first packet PMD port > > initializes correctly, the subsequent ones do not. Please see output > > from my test run below. All four ports are of the same type. > > Thanks I'll check into it. I'm not sure why you would only be able > to set the fanout on the first port... It looks like I lost a patch in the prep for posting. As a result, I was using the same fanout group ID between different interfaces... :-( I'll post a V2 in a bit...thanks! John -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 11:51:08PM +0100, Bruce Richardson wrote: > On Thu, Jul 10, 2014 at 04:32:49PM -0400, John W. Linville wrote: > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > socket. This implementation uses mmap'ed ring buffers to limit copying > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > AF_PACKET is used for frame reception. In the current implementation, > > Tx and Rx queues are always paired, and therefore are always equal > > in number -- changing this would be a Simple Matter Of Programming. > > > > Interfaces of this type are created with a command line option like > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > as arguments: > > > > - Interface is chosen by "iface" (required) > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > Signed-off-by: John W. Linville > > --- > > This PMD is intended to provide a means for using DPDK on a broad > > range of hardware without hardware-specific PMDs and (hopefully) > > with better performance than what PCAP offers in Linux. This might > > be useful as a development platform for DPDK applications when > > DPDK-supported hardware is expensive or unavailable. > > > Hi John, > > I'm just trying this out now on a Fedora 20 machine, using kernel > 3.14.9-200.fc20.x86_64. However, while the first packet PMD port initializes > correctly, the subsequent ones do not. Please see output from my test run > below. All four ports are of the same type. Thanks I'll check into it. I'm not sure why you would only be able to set the fanout on the first port... > > Regards, > /Bruce > > bruce at silpixa00372841:dpdk.org$ sudo > ./x86_64-native-linuxapp-gcc/app/testpmd -c 600 -n 4 > --vdev=eth_packet0,iface=eth0,qpairs=1 --vdev=eth_packet1,iface=eth1,qpairs=1 > --vdev=eth_packet2,iface=p802p1,qpairs=1 > --vdev=eth_packet3,iface=p9p3,qpairs=1 -- --mbcache=250 --burst=32 > --total-num-mbufs=65536EAL: Detected lcore 0 as core 0 on socket 0 > EAL: Detected lcore 1 as core 1 on socket 0 > EAL: Detected lcore 2 as core 2 on socket 0 > EAL: Detected lcore 3 as core 3 on socket 0 > EAL: Detected lcore 4 as core 4 on socket 0 > EAL: Detected lcore 5 as core 5 on socket 0 > EAL: Detected lcore 6 as core 6 on socket 0 > EAL: Detected lcore 7 as core 7 on socket 0 > EAL: Detected lcore 8 as core 0 on socket 1 > EAL: Detected lcore 9 as core 1 on socket 1 > EAL: Detected lcore 10 as core 2 on socket 1 > EAL: Detected lcore 11 as core 3 on socket 1 > EAL: Detected lcore 12 as core 4 on socket 1 > EAL: Detected lcore 13 as core 5 on socket 1 > EAL: Detected lcore 14 as core 6 on socket 1 > EAL: Detected lcore 15 as core 7 on socket 1 > EAL: Detected lcore 16 as core 0 on socket 0 > EAL: Detected lcore 17 as core 1 on socket 0 > EAL: Detected lcore 18 as core 2 on socket 0 > EAL: Detected lcore 19 as core 3 on socket 0 > EAL: Detected lcore 20 as core 4 on socket 0 > EAL: Detected lcore 21 as core 5 on socket 0 > EAL: Detected lcore 22 as core 6 on socket 0 > EAL: Detected lcore 23 as core 7 on socket 0 > EAL: Detected lcore 24 as core 0 on socket 1 > EAL: Detected lcore 25 as core 1 on socket 1 > EAL: Detected lcore 26 as core 2 on socket 1 > EAL: Detected lcore 27 as core 3 on socket 1 > EAL: Detected lcore 28 as core 4 on socket 1 > EAL: Detected lcore 29 as core 5 on socket 1 > EAL: Detected lcore 30 as core 6 on socket 1 > EAL: Detected lcore 31 as core 7 on socket 1 > EAL: Support maximum 64 logical core(s) by configuration. > EAL: Detected 32 lcore(s) > EAL: No free hugepages reported in hugepages-2048kB > EAL: unsupported IOMMU type! > EAL: VFIO support could not be initialized > EAL: Setting up memory... > EAL: Ask a virtual area of 0x8000 bytes > EAL: Virtual area found at 0x7f9fc000 (size = 0x8000) > EAL: Ask a virtual area of 0x8000 bytes > EAL: Virtual area found at 0x7f9f (size = 0x8000) > EAL: Requesting 2 pages of size 1024MB from socket 0 > EAL: Requesting 2 pages of size 1024MB from socket 1 > EAL: TSC frequency is ~2693512 KHz > EAL: Master core 9 is ready (tid=f4511880) > init (0) eth_packet0 > PMD: Initializing pmd_packet for eth_packet0 > PMD: eth_packet0: AF_PACKET MMAP parameters: > PMD: eth_packet0: block size 4096 > PMD: eth_packet0: block count 256 > PMD: eth_packet0: frame size 2048 > PMD: eth_packet0: frame count 512 > PMD: eth_packet0: creating AF_PACKET-backed ethdev on numa socket 1 > init (0) eth_packet1 > PMD: Initializing pmd_packet for eth_packet1 > PMD: eth_packet1: AF_PACKET MMAP parameters: > PMD: eth_packet1: block size 4096 > PMD: eth_packet1: block count 256 > PMD: eth_packet1: frame size 2048 > PMD: eth_packet1: frame count 512 >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Sat, Jul 12, 2014 at 12:34:46AM +0200, Thomas Monjalon wrote: > 2014-07-11 13:40, John W. Linville: > > Is there an example of code in DPDK that requires specific kernel > > versions? What is the preferred method for coding such dependencies? > > No there is no userspace code checking kernel version in DPDK. > Feel free to use what you think the best method. > Please keep in mind that checking version number is a maintenance nightmare > because of backports (like RedHat do ;). I suppose that it could be a configuration option? -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Sat, Jul 12, 2014 at 12:42:04AM +, Zhou, Danny wrote: > I just upgraded my kernel to 3.15.5 and hardcoded below captured from > include/uapi/linux/if_packet.h to librte_pmd_packet.c to workaround it, now I > can receive/transmit packet now. Commenting out PACKET_FANOUT_FLAG_ROLLOVER > would cause no packet can be received. > > #define PACKET_QDISC_BYPASS 20 > #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 You shouldn't need PACKET_FANOUT_FLAG_ROLLOVER if all the queues are being used. Does the application you are running make use of all the queues? If not, you probably should use the qpairs option to limit the number of queues created by the eth_packet PMD. John > > > -Original Message- > > From: John W. Linville [mailto:linville at tuxdriver.com] > > Sent: Saturday, July 12, 2014 2:47 AM > > To: Zhou, Danny > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > Not sure what the issue might be, PACKET_FANOUT_FLAG_ROLLOVER is defined > > in include/uapi/linux/if_packet.h in the v3.12 tree. > > > > On Fri, Jul 11, 2014 at 06:01:27PM +, Zhou, Danny wrote: > > > Tried on 3.12, both of them are undefined. Anyway, will comment them out > > > and see > > what performance it could achieve. > > > > > > > -Original Message- > > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > > Sent: Saturday, July 12, 2014 1:41 AM > > > > To: Zhou, Danny > > > > Cc: dev at dpdk.org > > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > AF_PACKET-based virtual devices > > > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > > Looks like you used a pretty new kernel version with new socket > > > > > options that old > > > > kernel like my 3.12 does not support. When I tried this patch, it > > > > just cannot build, and compiler complains like below. Which Linux > > > > distribution > > does this patch work for? > > > > How to ensure it works for old kernels? > > > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: > > > > > In function > > > > rte_pmd_init_internals: > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:5 > > > > > 24:1 > > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in > > > > > this > > > > > function) > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:5 > > > > > 24:1 > > > > > 7: note: each undeclared identifier is reported only once for each > > > > > function it appears in > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:5 > > > > > 57:3 > > > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > > > function) > > > > > > > > Both of them are isolated, so for playing with it you could just > > > > comment those > > out. > > > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, > > > > while PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > > include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER > > > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > > > 64)#define > > > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > > 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec > > > > Author: Willem de Bruijn > > > > > > > > packet: packet fanout rollover during socket overload > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git describe --contains > > > > 77f65ebdca506 > > > > v3.10-rc1~66^2~423 > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > > include/uapi/linux/if_packet.h | grep PACKET_QDISC_BYPASS > > > > d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 06:47:47PM +0200, Thomas Monjalon wrote: > 2014-07-11 11:30, John W. Linville: > > On Fri, Jul 11, 2014 at 05:04:04PM +0200, Thomas Monjalon wrote: > > > 2014-07-11 10:51, John W. Linville: > > > > On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > > > > > Thank you for this nice work. > > > > > > > > > > I think it would be well suited to host this PMD as an external one in > > > > > order to make it work also with DPDK 1.7.0. > > > > > > > > I'm not sure I understand the suggestion -- you don't want to merge > > > > the driver for 1.8? Or you just want to host this patch somewhere, > > > > so people can still use it w/ 1.7? > > > > > > I suggest to have a separated repository here: > > > http://dpdk.org/browse/ > > > > I really don't see any reason not to merge it. It was already delayed > > by me waiting for all the PMD init changes to settle out in the 1.6 > > release, and I still had to do a few touch-ups for it to compile on > > 1.7. I definitely do not want to have to do that over and over again. > > It's a pity that we didn't synchronize our efforts to make it integrated > during 1.7.0 cycle. > > > Why wouldn't you just merge it? If someone wants to use it on 1.7, > > they can just apply the patch. > > I'm OK to merge it. I was only suggesting to host your PMD externally like we > did for virtio-net-pmd, vmxnet3-usermap and memnic. > It was the same discussion for the vmxnet3 PMD that Stephen submitted. > > I start thinking that nobody wants PMD to be external. So we may merge this > one in dpdk.git and start talking what to do for the other ones: > - move memnic in dpdk.git? > - move virtio-net-pmd and vmxnet3-usermap where sits their uio > counterparts? > - merge Brocade's vmxnet3 as new one or as a replacement for > vmxnet3-uio? > Yes! Please. this is what I suggested a few months ago. Managing PMDs in separate trees just leads to more difficult driver updates when core changes are made that affect all pmds. Please merge them all into the dpdk tree Neil > -- > Thomas >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
I just upgraded my kernel to 3.15.5 and hardcoded below captured from include/uapi/linux/if_packet.h to librte_pmd_packet.c to workaround it, now I can receive/transmit packet now. Commenting out PACKET_FANOUT_FLAG_ROLLOVER would cause no packet can be received. #define PACKET_QDISC_BYPASS 20 #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > -Original Message- > From: John W. Linville [mailto:linville at tuxdriver.com] > Sent: Saturday, July 12, 2014 2:47 AM > To: Zhou, Danny > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > Not sure what the issue might be, PACKET_FANOUT_FLAG_ROLLOVER is defined > in include/uapi/linux/if_packet.h in the v3.12 tree. > > On Fri, Jul 11, 2014 at 06:01:27PM +, Zhou, Danny wrote: > > Tried on 3.12, both of them are undefined. Anyway, will comment them out > > and see > what performance it could achieve. > > > > > -Original Message- > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > Sent: Saturday, July 12, 2014 1:41 AM > > > To: Zhou, Danny > > > Cc: dev at dpdk.org > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > AF_PACKET-based virtual devices > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > Looks like you used a pretty new kernel version with new socket > > > > options that old > > > kernel like my 3.12 does not support. When I tried this patch, it > > > just cannot build, and compiler complains like below. Which Linux > > > distribution > does this patch work for? > > > How to ensure it works for old kernels? > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: > > > > In function > > > rte_pmd_init_internals: > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:5 > > > > 24:1 > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in > > > > this > > > > function) > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:5 > > > > 24:1 > > > > 7: note: each undeclared identifier is reported only once for each > > > > function it appears in > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:5 > > > > 57:3 > > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > > function) > > > > > > Both of them are isolated, so for playing with it you could just comment > > > those > out. > > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, > > > while PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER > > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > > 64)#define > > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec > > > Author: Willem de Bruijn > > > > > > packet: packet fanout rollover during socket overload > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git describe --contains > > > 77f65ebdca506 > > > v3.10-rc1~66^2~423 > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > include/uapi/linux/if_packet.h | grep PACKET_QDISC_BYPASS > > > d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 > > > 56)#define > > > PACKET_QDISC_BYPASS 20 > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > d346a3fae3ff1 commit > > > d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 > > > Author: Daniel Borkmann > > > > > > packet: introduce PACKET_QDISC_BYPASS socket option > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git describe --contains > > > d346a3fae3ff1 > > > v3.14-rc1~94^2~564 > > > > > > Is there an example of code in DPDK that requires specific kernel > > > versions? What is the preferred method for coding such dependencies? > > > > > > John > > > -- > > > John W. Linville Someday the world will need a hero, and you > > > linville at tuxdriver.com might be all we have. Be ready. > > > > -- > John W. Linville Someday the world will need a hero, and you > linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-11 13:40, John W. Linville: > Is there an example of code in DPDK that requires specific kernel > versions? What is the preferred method for coding such dependencies? No there is no userspace code checking kernel version in DPDK. Feel free to use what you think the best method. Please keep in mind that checking version number is a maintenance nightmare because of backports (like RedHat do ;). -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
About the form of the patch, I have 2 comments: 1) A doc explaining the design, the dependencies and how it can be used would be a great help. Could you write it in rst format? 2) checkpatch.pl returns these errors: ERROR:SPACING: space required before the open parenthesis '(' #468: FILE: lib/librte_pmd_packet/rte_eth_packet.c:250: + if(sockfd != -1) ERROR:SPACING: space required before the open parenthesis '(' #471: FILE: lib/librte_pmd_packet/rte_eth_packet.c:253: + if(sockfd != -1) ERROR:SPACING: spaces required around that '=' (ctx:VxV) #712: FILE: lib/librte_pmd_packet/rte_eth_packet.c:494: + ifr.ifr_name[ifnamelen]='\0'; Thanks -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Thu, Jul 10, 2014 at 04:32:49PM -0400, John W. Linville wrote: > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > socket. This implementation uses mmap'ed ring buffers to limit copying > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > AF_PACKET is used for frame reception. In the current implementation, > Tx and Rx queues are always paired, and therefore are always equal > in number -- changing this would be a Simple Matter Of Programming. > > Interfaces of this type are created with a command line option like > "--vdev=eth_packet0,iface=...". There are a number of options availabe > as arguments: > > - Interface is chosen by "iface" (required) > - Number of queue pairs set by "qpairs" (optional, default: 16) > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > Signed-off-by: John W. Linville > --- > This PMD is intended to provide a means for using DPDK on a broad > range of hardware without hardware-specific PMDs and (hopefully) > with better performance than what PCAP offers in Linux. This might > be useful as a development platform for DPDK applications when > DPDK-supported hardware is expensive or unavailable. > Hi John, I'm just trying this out now on a Fedora 20 machine, using kernel 3.14.9-200.fc20.x86_64. However, while the first packet PMD port initializes correctly, the subsequent ones do not. Please see output from my test run below. All four ports are of the same type. Regards, /Bruce bruce at silpixa00372841:dpdk.org$ sudo ./x86_64-native-linuxapp-gcc/app/testpmd -c 600 -n 4 --vdev=eth_packet0,iface=eth0,qpairs=1 --vdev=eth_packet1,iface=eth1,qpairs=1 --vdev=eth_packet2,iface=p802p1,qpairs=1 --vdev=eth_packet3,iface=p9p3,qpairs=1 -- --mbcache=250 --burst=32 --total-num-mbufs=65536EAL: Detected lcore 0 as core 0 on socket 0 EAL: Detected lcore 1 as core 1 on socket 0 EAL: Detected lcore 2 as core 2 on socket 0 EAL: Detected lcore 3 as core 3 on socket 0 EAL: Detected lcore 4 as core 4 on socket 0 EAL: Detected lcore 5 as core 5 on socket 0 EAL: Detected lcore 6 as core 6 on socket 0 EAL: Detected lcore 7 as core 7 on socket 0 EAL: Detected lcore 8 as core 0 on socket 1 EAL: Detected lcore 9 as core 1 on socket 1 EAL: Detected lcore 10 as core 2 on socket 1 EAL: Detected lcore 11 as core 3 on socket 1 EAL: Detected lcore 12 as core 4 on socket 1 EAL: Detected lcore 13 as core 5 on socket 1 EAL: Detected lcore 14 as core 6 on socket 1 EAL: Detected lcore 15 as core 7 on socket 1 EAL: Detected lcore 16 as core 0 on socket 0 EAL: Detected lcore 17 as core 1 on socket 0 EAL: Detected lcore 18 as core 2 on socket 0 EAL: Detected lcore 19 as core 3 on socket 0 EAL: Detected lcore 20 as core 4 on socket 0 EAL: Detected lcore 21 as core 5 on socket 0 EAL: Detected lcore 22 as core 6 on socket 0 EAL: Detected lcore 23 as core 7 on socket 0 EAL: Detected lcore 24 as core 0 on socket 1 EAL: Detected lcore 25 as core 1 on socket 1 EAL: Detected lcore 26 as core 2 on socket 1 EAL: Detected lcore 27 as core 3 on socket 1 EAL: Detected lcore 28 as core 4 on socket 1 EAL: Detected lcore 29 as core 5 on socket 1 EAL: Detected lcore 30 as core 6 on socket 1 EAL: Detected lcore 31 as core 7 on socket 1 EAL: Support maximum 64 logical core(s) by configuration. EAL: Detected 32 lcore(s) EAL: No free hugepages reported in hugepages-2048kB EAL: unsupported IOMMU type! EAL: VFIO support could not be initialized EAL: Setting up memory... EAL: Ask a virtual area of 0x8000 bytes EAL: Virtual area found at 0x7f9fc000 (size = 0x8000) EAL: Ask a virtual area of 0x8000 bytes EAL: Virtual area found at 0x7f9f (size = 0x8000) EAL: Requesting 2 pages of size 1024MB from socket 0 EAL: Requesting 2 pages of size 1024MB from socket 1 EAL: TSC frequency is ~2693512 KHz EAL: Master core 9 is ready (tid=f4511880) init (0) eth_packet0 PMD: Initializing pmd_packet for eth_packet0 PMD: eth_packet0: AF_PACKET MMAP parameters: PMD: eth_packet0: block size 4096 PMD: eth_packet0: block count 256 PMD: eth_packet0: frame size 2048 PMD: eth_packet0: frame count 512 PMD: eth_packet0: creating AF_PACKET-backed ethdev on numa socket 1 init (0) eth_packet1 PMD: Initializing pmd_packet for eth_packet1 PMD: eth_packet1: AF_PACKET MMAP parameters: PMD: eth_packet1: block size 4096 PMD: eth_packet1: block count 256 PMD: eth_packet1: frame size 2048 PMD: eth_packet1: frame count 512 PMD: eth_packet1: creating AF_PACKET-backed ethdev on numa socket 1 PMD: eth_packet1: could not set PACKET_FANOUT on AF_PACKET socket for eth1 init (0) eth_packet2 PMD: Initializing pmd_packet for eth_packet2 PMD: eth_packet2: AF_PACKET MMAP parameters: PMD: eth_packet2: block size 4096 PMD: eth_packet2: block count 256 PMD: eth_packet2: frame s
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Thanks Jeff, it works as expected, like below command line: ./l2fwd/build/l2fwd -c 0x3 -n 4 --vdev=eth_packet0,iface=p786p1 --vdev=eth_packet1,iface=p786p2 -- -p 0x3 > -Original Message- > From: Shaw, Jeffrey B > Sent: Saturday, July 12, 2014 4:32 AM > To: Zhou, Danny; John W. Linville > Cc: dev at dpdk.org > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > Danny, can you specify multiple --vdev parameters? > "--vdev=eth_packet0,iface=eth0 --vdev=eth_packet1,iface=eth1" > > > -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zhou, Danny > Sent: Friday, July 11, 2014 1:27 PM > To: John W. Linville > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > I want to run a common DPDK L2 or L3 forward benchmark for bi-direction > traffics, > so at least two ports are required. Just like how to measure Linux bridge or > OVS > performance, you need add at least two ports into a bridge. > > > -Original Message- > > From: John W. Linville [mailto:linville at tuxdriver.com] > > Sent: Saturday, July 12, 2014 3:32 AM > > To: Zhou, Danny > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > I'm not sure that would make any sense -- the AF_PACKET sockets are > > mapped to specific interfaces. > > > > What are you trying to do with a syntax like that? > > > > John > > > > On Fri, Jul 11, 2014 at 07:04:19PM +, Zhou, Danny wrote: > > > Does it support specifying multiple NIC interfaces using command > > > line option like > > "--vdev=eth_packet0,iface=..."? Say "iface=eth0,eth1,eth2...", tried > > but it doesn't work. > > > > > > > -----Original Message- > > > > From: Zhou, Danny > > > > Sent: Saturday, July 12, 2014 2:01 AM > > > > To: 'John W. Linville' > > > > Cc: dev at dpdk.org > > > > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > AF_PACKET-based virtual devices > > > > > > > > Tried on 3.12, both of them are undefined. Anyway, will comment > > > > them out and see what performance it could achieve. > > > > > > > > > -Original Message- > > > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > > > Sent: Saturday, July 12, 2014 1:41 AM > > > > > To: Zhou, Danny > > > > > Cc: dev at dpdk.org > > > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > > AF_PACKET-based virtual devices > > > > > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > > > Looks like you used a pretty new kernel version with new > > > > > > socket options that old > > > > > kernel like my 3.12 does not support. When I tried this patch, > > > > > it just cannot build, and compiler complains like below. Which > > > > > Linux distribution does this > > > > patch work for? > > > > > How to ensure it works for old kernels? > > > > > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > > .c > > > > > > : In function > > > > > rte_pmd_init_internals: > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > > .c > > > > > > :524 > > > > > > :1 > > > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in > > > > > > this > > > > > > function) > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > > .c > > > > > > :524 > > > > > > :1 > > > > > > 7: note: each undeclared identifier is reported only once for > > > > > > each function it appears in > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > > .c > > > > > > :557 > > > > > > :3 > > > > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > > > > function) > > > > > > > > > > Both of them are isolated,
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Danny, can you specify multiple --vdev parameters? "--vdev=eth_packet0,iface=eth0 --vdev=eth_packet1,iface=eth1" -Original Message- From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Zhou, Danny Sent: Friday, July 11, 2014 1:27 PM To: John W. Linville Cc: dev at dpdk.org Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices I want to run a common DPDK L2 or L3 forward benchmark for bi-direction traffics, so at least two ports are required. Just like how to measure Linux bridge or OVS performance, you need add at least two ports into a bridge. > -Original Message- > From: John W. Linville [mailto:linville at tuxdriver.com] > Sent: Saturday, July 12, 2014 3:32 AM > To: Zhou, Danny > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > I'm not sure that would make any sense -- the AF_PACKET sockets are > mapped to specific interfaces. > > What are you trying to do with a syntax like that? > > John > > On Fri, Jul 11, 2014 at 07:04:19PM +, Zhou, Danny wrote: > > Does it support specifying multiple NIC interfaces using command > > line option like > "--vdev=eth_packet0,iface=..."? Say "iface=eth0,eth1,eth2...", tried > but it doesn't work. > > > > > -Original Message- > > > From: Zhou, Danny > > > Sent: Saturday, July 12, 2014 2:01 AM > > > To: 'John W. Linville' > > > Cc: dev at dpdk.org > > > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > AF_PACKET-based virtual devices > > > > > > Tried on 3.12, both of them are undefined. Anyway, will comment > > > them out and see what performance it could achieve. > > > > > > > -Original Message----- > > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > > Sent: Saturday, July 12, 2014 1:41 AM > > > > To: Zhou, Danny > > > > Cc: dev at dpdk.org > > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > AF_PACKET-based virtual devices > > > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > > Looks like you used a pretty new kernel version with new > > > > > socket options that old > > > > kernel like my 3.12 does not support. When I tried this patch, > > > > it just cannot build, and compiler complains like below. Which > > > > Linux distribution does this > > > patch work for? > > > > How to ensure it works for old kernels? > > > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > .c > > > > > : In function > > > > rte_pmd_init_internals: > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > .c > > > > > :524 > > > > > :1 > > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in > > > > > this > > > > > function) > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > .c > > > > > :524 > > > > > :1 > > > > > 7: note: each undeclared identifier is reported only once for > > > > > each function it appears in > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > .c > > > > > :557 > > > > > :3 > > > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > > > function) > > > > > > > > Both of them are isolated, so for playing with it you could just > > > > comment those > out. > > > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in > > > > 3.10, while PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > > include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER > > > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > > > 64)#define > > > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > > 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec > >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
I want to run a common DPDK L2 or L3 forward benchmark for bi-direction traffics, so at least two ports are required. Just like how to measure Linux bridge or OVS performance, you need add at least two ports into a bridge. > -Original Message- > From: John W. Linville [mailto:linville at tuxdriver.com] > Sent: Saturday, July 12, 2014 3:32 AM > To: Zhou, Danny > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > I'm not sure that would make any sense -- the AF_PACKET sockets are mapped to > specific interfaces. > > What are you trying to do with a syntax like that? > > John > > On Fri, Jul 11, 2014 at 07:04:19PM +, Zhou, Danny wrote: > > Does it support specifying multiple NIC interfaces using command line > > option like > "--vdev=eth_packet0,iface=..."? Say "iface=eth0,eth1,eth2...", tried but it > doesn't > work. > > > > > -Original Message- > > > From: Zhou, Danny > > > Sent: Saturday, July 12, 2014 2:01 AM > > > To: 'John W. Linville' > > > Cc: dev at dpdk.org > > > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > AF_PACKET-based virtual devices > > > > > > Tried on 3.12, both of them are undefined. Anyway, will comment them > > > out and see what performance it could achieve. > > > > > > > -----Original Message----- > > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > > Sent: Saturday, July 12, 2014 1:41 AM > > > > To: Zhou, Danny > > > > Cc: dev at dpdk.org > > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > AF_PACKET-based virtual devices > > > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > > Looks like you used a pretty new kernel version with new socket > > > > > options that old > > > > kernel like my 3.12 does not support. When I tried this patch, it > > > > just cannot build, and compiler complains like below. Which Linux > > > > distribution does this > > > patch work for? > > > > How to ensure it works for old kernels? > > > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c > > > > > : In function > > > > rte_pmd_init_internals: > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c > > > > > :524 > > > > > :1 > > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in > > > > > this > > > > > function) > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c > > > > > :524 > > > > > :1 > > > > > 7: note: each undeclared identifier is reported only once for > > > > > each function it appears in > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c > > > > > :557 > > > > > :3 > > > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > > > function) > > > > > > > > Both of them are isolated, so for playing with it you could just > > > > comment those > out. > > > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in > > > > 3.10, while PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > > include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER > > > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > > > 64)#define > > > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > > 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec > > > > Author: Willem de Bruijn > > > > > > > > packet: packet fanout rollover during socket overload > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git describe --contains > > > > 77f65ebdca506 > > > > v3.10-rc1~66^2~423 > > > > > > > > /home/linville/git/linux > > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Does it support specifying multiple NIC interfaces using command line option like "--vdev=eth_packet0,iface=..."? Say "iface=eth0,eth1,eth2...", tried but it doesn't work. > -Original Message- > From: Zhou, Danny > Sent: Saturday, July 12, 2014 2:01 AM > To: 'John W. Linville' > Cc: dev at dpdk.org > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > Tried on 3.12, both of them are undefined. Anyway, will comment them out and > see > what performance it could achieve. > > > -Original Message- > > From: John W. Linville [mailto:linville at tuxdriver.com] > > Sent: Saturday, July 12, 2014 1:41 AM > > To: Zhou, Danny > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > Looks like you used a pretty new kernel version with new socket > > > options that old > > kernel like my 3.12 does not support. When I tried this patch, it just > > cannot build, and compiler complains like below. Which Linux distribution > > does this > patch work for? > > How to ensure it works for old kernels? > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: In > > > function > > rte_pmd_init_internals: > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524 > > > :1 > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in this > > > function) > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524 > > > :1 > > > 7: note: each undeclared identifier is reported only once for each > > > function it appears in > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:557 > > > :3 > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > function) > > > > Both of them are isolated, so for playing with it you could just comment > > those out. > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, > > while PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git annotate > > include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > 64)#define > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec > > Author: Willem de Bruijn > > > > packet: packet fanout rollover during socket overload > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git describe --contains 77f65ebdca506 > > v3.10-rc1~66^2~423 > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git annotate > > include/uapi/linux/if_packet.h | grep PACKET_QDISC_BYPASS > > d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 > > 56)#define > > PACKET_QDISC_BYPASS 20 > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > d346a3fae3ff1 commit > > d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 > > Author: Daniel Borkmann > > > > packet: introduce PACKET_QDISC_BYPASS socket option > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git describe --contains d346a3fae3ff1 > > v3.14-rc1~94^2~564 > > > > Is there an example of code in DPDK that requires specific kernel > > versions? What is the preferred method for coding such dependencies? > > > > John > > -- > > John W. LinvilleSomeday the world will need a hero, and you > > linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-11 11:30, John W. Linville: > On Fri, Jul 11, 2014 at 05:04:04PM +0200, Thomas Monjalon wrote: > > 2014-07-11 10:51, John W. Linville: > > > On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > > > > Thank you for this nice work. > > > > > > > > I think it would be well suited to host this PMD as an external one in > > > > order to make it work also with DPDK 1.7.0. > > > > > > I'm not sure I understand the suggestion -- you don't want to merge > > > the driver for 1.8? Or you just want to host this patch somewhere, > > > so people can still use it w/ 1.7? > > > > I suggest to have a separated repository here: > > http://dpdk.org/browse/ > > I really don't see any reason not to merge it. It was already delayed > by me waiting for all the PMD init changes to settle out in the 1.6 > release, and I still had to do a few touch-ups for it to compile on > 1.7. I definitely do not want to have to do that over and over again. It's a pity that we didn't synchronize our efforts to make it integrated during 1.7.0 cycle. > Why wouldn't you just merge it? If someone wants to use it on 1.7, > they can just apply the patch. I'm OK to merge it. I was only suggesting to host your PMD externally like we did for virtio-net-pmd, vmxnet3-usermap and memnic. It was the same discussion for the vmxnet3 PMD that Stephen submitted. I start thinking that nobody wants PMD to be external. So we may merge this one in dpdk.git and start talking what to do for the other ones: - move memnic in dpdk.git? - move virtio-net-pmd and vmxnet3-usermap where sits their uio counterparts? - merge Brocade's vmxnet3 as new one or as a replacement for vmxnet3-uio? -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Tried on 3.12, both of them are undefined. Anyway, will comment them out and see what performance it could achieve. > -Original Message- > From: John W. Linville [mailto:linville at tuxdriver.com] > Sent: Saturday, July 12, 2014 1:41 AM > To: Zhou, Danny > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET-based virtual devices > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > Looks like you used a pretty new kernel version with new socket options > > that old > kernel like my 3.12 does not support. When I tried this patch, it just cannot > build, and > compiler complains like below. Which Linux distribution does this patch work > for? > How to ensure it works for old kernels? > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: In > > function > rte_pmd_init_internals: > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:1 > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in this > > function) > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:1 > > 7: note: each undeclared identifier is reported only once for each > > function it appears in > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:557:3 > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this function) > > Both of them are isolated, so for playing with it you could just comment > those out. > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, while > PACKET_QDISC_BYPASS didn't show-up until 3.14... > > /home/linville/git/linux > [linville-x1.hq.tuxdriver.com]:> git annotate include/uapi/linux/if_packet.h > | grep > PACKET_FANOUT_FLAG_ROLLOVER > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > 64)#define > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > /home/linville/git/linux > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short 77f65ebdca506 > commit > 77f65ebdca506870d99bfabe52bde222511022ec > Author: Willem de Bruijn > > packet: packet fanout rollover during socket overload > > /home/linville/git/linux > [linville-x1.hq.tuxdriver.com]:> git describe --contains 77f65ebdca506 > v3.10-rc1~66^2~423 > > /home/linville/git/linux > [linville-x1.hq.tuxdriver.com]:> git annotate include/uapi/linux/if_packet.h > | grep > PACKET_QDISC_BYPASS > d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 > 56)#define > PACKET_QDISC_BYPASS 20 > > /home/linville/git/linux > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short d346a3fae3ff1 > commit > d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 > Author: Daniel Borkmann > > packet: introduce PACKET_QDISC_BYPASS socket option > > /home/linville/git/linux > [linville-x1.hq.tuxdriver.com]:> git describe --contains d346a3fae3ff1 > v3.14-rc1~94^2~564 > > Is there an example of code in DPDK that requires specific kernel versions? > What is > the preferred method for coding such dependencies? > > John > -- > John W. Linville Someday the world will need a hero, and you > linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon > Sent: Friday, July 11, 2014 9:48 AM > To: John W. Linville > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET- > based virtual devices > > 2014-07-11 11:30, John W. Linville: > > On Fri, Jul 11, 2014 at 05:04:04PM +0200, Thomas Monjalon wrote: > > > 2014-07-11 10:51, John W. Linville: > > > > On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > > > > > Thank you for this nice work. > > > > > > > > > > I think it would be well suited to host this PMD as an external one in > > > > > order to make it work also with DPDK 1.7.0. > > > > > > > > I'm not sure I understand the suggestion -- you don't want to merge > > > > the driver for 1.8? Or you just want to host this patch somewhere, > > > > so people can still use it w/ 1.7? > > > > > > I suggest to have a separated repository here: > > > http://dpdk.org/browse/ > > > > I really don't see any reason not to merge it. It was already delayed > > by me waiting for all the PMD init changes to settle out in the 1.6 > > release, and I still had to do a few touch-ups for it to compile on > > 1.7. I definitely do not want to have to do that over and over again. > > It's a pity that we didn't synchronize our efforts to make it integrated > during 1.7.0 cycle. > > > Why wouldn't you just merge it? If someone wants to use it on 1.7, > > they can just apply the patch. > > I'm OK to merge it. I was only suggesting to host your PMD externally like we > did for virtio-net-pmd, vmxnet3-usermap and memnic. > It was the same discussion for the vmxnet3 PMD that Stephen submitted. > > I start thinking that nobody wants PMD to be external. So we may merge this > one in dpdk.git and start talking what to do for the other ones: > - move memnic in dpdk.git? Yes, I would agree with this. Having drivers in external git repos makes it hard for us to take them into account when planning on making changes to the core libs. > - move virtio-net-pmd and vmxnet3-usermap where sits their uio > counterparts? > - merge Brocade's vmxnet3 as new one or as a replacement for > vmxnet3-uio? For these we really should try and converge on a single solution. Having multiple vmxnet3 and virtio drivers duplicates effort and is just plain messy! Of course, that's easier to say than to agree on... /Bruce
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Looks like you used a pretty new kernel version with new socket options that old kernel like my 3.12 does not support. When I tried this patch, it just cannot build, and compiler complains like below. Which Linux distribution does this patch work for? How to ensure it works for old kernels? /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: In function rte_pmd_init_internals: /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:17: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in this function) /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:17: note: each undeclared identifier is reported only once for each function it appears in /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:557:33: error: PACKET_QDISC_BYPASS undeclared (first use in this function) > > > -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. Linville > Sent: Thursday, July 10, 2014 1:33 PM > To: dev at dpdk.org > Subject: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based > virtual devices > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET socket. > This > implementation uses mmap'ed ring buffers to limit copying and user/kernel > transitions. The PACKET_FANOUT_HASH behavior of AF_PACKET is used for > frame reception. In the current implementation, Tx and Rx queues are always > paired, > and therefore are always equal in number -- changing this would be a Simple > Matter > Of Programming. > > Interfaces of this type are created with a command line option like > "--vdev=eth_packet0,iface=...". There are a number of options availabe as > arguments: > > - Interface is chosen by "iface" (required) > - Number of queue pairs set by "qpairs" (optional, default: 16) > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > Signed-off-by: John W. Linville > --- > This PMD is intended to provide a means for using DPDK on a broad range of > hardware without hardware-specific PMDs and (hopefully) with better > performance > than what PCAP offers in Linux. This might be useful as a development > platform for > DPDK applications when DPDK-supported hardware is expensive or unavailable. > > config/common_bsdapp | 5 + > config/common_linuxapp | 5 + > lib/Makefile | 1 + > lib/librte_eal/linuxapp/eal/Makefile | 1 + > lib/librte_pmd_packet/Makefile | 60 +++ > lib/librte_pmd_packet/rte_eth_packet.c | 826 > + > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > mk/rte.app.mk | 4 + > 8 files changed, 957 insertions(+) > create mode 100644 lib/librte_pmd_packet/Makefile create mode 100644 > lib/librte_pmd_packet/rte_eth_packet.c > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > diff --git a/config/common_bsdapp b/config/common_bsdapp index > 943dce8f1ede..c317f031278e 100644 > --- a/config/common_bsdapp > +++ b/config/common_bsdapp > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > CONFIG_RTE_LIBRTE_PMD_BOND=y > > # > +# Compile software PMD backed by AF_PACKET sockets (Linux only) # > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > + > +# > # Do prefetch of packet data within PMD driver receive function # > CONFIG_RTE_PMD_PACKET_PREFETCH=y diff --git a/config/common_linuxapp > b/config/common_linuxapp index 7bf5d80d4e26..f9e7bc3015ec 100644 > --- a/config/common_linuxapp > +++ b/config/common_linuxapp > @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n > CONFIG_RTE_LIBRTE_PMD_BOND=y > > # > +# Compile software PMD backed by AF_PACKET sockets (Linux only) # > +CONFIG_RTE_LIBRTE_PMD_PACKET=y > + > +# > # Compile Xen PMD > # > CONFIG_RTE_LIBRTE_PMD_XENVIRT=n > diff --git a/lib/Makefile b/lib/Makefile index 10c5bb3045bc..930fadf29898 > 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += > librte_pmd_i40e > DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond > DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring > DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PACKET) += librte_pmd_packet > DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio > DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 > DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt diff --git > a/lib/librte_eal/linuxapp/eal/Makef
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-11 10:51, John W. Linville: > On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > > 2014-07-10 16:32, John W. Linville: > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > socket. This implementation uses mmap'ed ring buffers to limit copying > > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > > AF_PACKET is used for frame reception. In the current implementation, > > > Tx and Rx queues are always paired, and therefore are always equal > > > in number -- changing this would be a Simple Matter Of Programming. > > > > > > Interfaces of this type are created with a command line option like > > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > > > > > as arguments: > > > - Interface is chosen by "iface" (required) > > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > > > Signed-off-by: John W. Linville > > > --- > > > This PMD is intended to provide a means for using DPDK on a broad > > > range of hardware without hardware-specific PMDs and (hopefully) > > > with better performance than what PCAP offers in Linux. This might > > > be useful as a development platform for DPDK applications when > > > DPDK-supported hardware is expensive or unavailable. > > > > Thank you for this nice work. > > > > I think it would be well suited to host this PMD as an external one in > > order to make it work also with DPDK 1.7.0. > > I'm not sure I understand the suggestion -- you don't want to merge > the driver for 1.8? Or you just want to host this patch somewhere, > so people can still use it w/ 1.7? I suggest to have a separated repository here: http://dpdk.org/browse/ -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Ah, yes...sorry, I misunderstood what you wanted to do. The syntax below is what I would expect to use. John On Fri, Jul 11, 2014 at 08:35:01PM +, Zhou, Danny wrote: > Thanks Jeff, it works as expected, like below command line: > > ./l2fwd/build/l2fwd -c 0x3 -n 4 --vdev=eth_packet0,iface=p786p1 > --vdev=eth_packet1,iface=p786p2 -- -p 0x3 > > > -Original Message- > > From: Shaw, Jeffrey B > > Sent: Saturday, July 12, 2014 4:32 AM > > To: Zhou, Danny; John W. Linville > > Cc: dev at dpdk.org > > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > Danny, can you specify multiple --vdev parameters? > > "--vdev=eth_packet0,iface=eth0 --vdev=eth_packet1,iface=eth1" > > > > > > -Original Message- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zhou, Danny > > Sent: Friday, July 11, 2014 1:27 PM > > To: John W. Linville > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > I want to run a common DPDK L2 or L3 forward benchmark for bi-direction > > traffics, > > so at least two ports are required. Just like how to measure Linux bridge > > or OVS > > performance, you need add at least two ports into a bridge. > > > > > -Original Message----- > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > Sent: Saturday, July 12, 2014 3:32 AM > > > To: Zhou, Danny > > > Cc: dev at dpdk.org > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > AF_PACKET-based virtual devices > > > > > > I'm not sure that would make any sense -- the AF_PACKET sockets are > > > mapped to specific interfaces. > > > > > > What are you trying to do with a syntax like that? > > > > > > John > > > > > > On Fri, Jul 11, 2014 at 07:04:19PM +, Zhou, Danny wrote: > > > > Does it support specifying multiple NIC interfaces using command > > > > line option like > > > "--vdev=eth_packet0,iface=..."? Say "iface=eth0,eth1,eth2...", tried > > > but it doesn't work. > > > > > > > > > -Original Message- > > > > > From: Zhou, Danny > > > > > Sent: Saturday, July 12, 2014 2:01 AM > > > > > To: 'John W. Linville' > > > > > Cc: dev at dpdk.org > > > > > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > > AF_PACKET-based virtual devices > > > > > > > > > > Tried on 3.12, both of them are undefined. Anyway, will comment > > > > > them out and see what performance it could achieve. > > > > > > > > > > > -Original Message- > > > > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > > > > Sent: Saturday, July 12, 2014 1:41 AM > > > > > > To: Zhou, Danny > > > > > > Cc: dev at dpdk.org > > > > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > > > > AF_PACKET-based virtual devices > > > > > > > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > > > > Looks like you used a pretty new kernel version with new > > > > > > > socket options that old > > > > > > kernel like my 3.12 does not support. When I tried this patch, > > > > > > it just cannot build, and compiler complains like below. Which > > > > > > Linux distribution does this > > > > > patch work for? > > > > > > How to ensure it works for old kernels? > > > > > > > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > > > .c > > > > > > > : In function > > > > > > rte_pmd_init_internals: > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > > > .c > > > > > > > :524 > > > > > > > :1 > > > > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in > > > > > > > this > > > > > > > function) > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet > > > > > &
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 03:29:17PM +, Venkatesan, Venky wrote: > > -Original Message- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. > > Linville > > Sent: Friday, July 11, 2014 7:49 AM > > To: Stephen Hemminger > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET- based virtual devices > > > > On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > > > On Thu, 10 Jul 2014 16:32:49 -0400 "John W. Linville" > > > wrote: > > > > > > > This is a Linux-specific virtual PMD driver backed by an > > > > AF_PACKET > > > > +struct pkt_rx_queue { > > > > + int sockfd; > > > > + > > > > + struct iovec *rd; > > > > + uint8_t *map; > > > > + unsigned int framecount; > > > > + unsigned int framenum; > > > > + > > > > + struct rte_mempool *mb_pool; > > > > + > > > > + volatile unsigned long rx_pkts; > > > > + volatile unsigned long err_pkts; > > > > > > Use of volatile will generate slow code, don't think it is > > > necessary, especially when only one CPU can use a queue at a time. > > > > That is a good point, worth checking out. FWIW, those lines are > > boilerplate originally copied from the pcap PMD. :-) > > > > > Yes, I agree it's worth checking out if there is a performance > > impact, but if we assume that the stats for RX/TX are possibly going > > to be read by another core, they really should be volatile for > > correctness > > Accessing the rx_queue structure directly for stats is unlikely to happen > from a second core; we should probably change the PCAP PMD as well (thanks > for pointing that out John). > "Unlikely" doesn't sound completely safe... :-) LOL. :-). This is an internal data structure and the DPDK docs specifically mention that they are not multi-process safe/accessible. The unlikely was for people that don't read the docs ... ;)
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
> -Original Message- > From: Stephen Hemminger [mailto:stephen at networkplumber.org] > Sent: Friday, July 11, 2014 8:16 AM > To: Richardson, Bruce > Cc: John W. Linville; dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET- > based virtual devices > > On Fri, 11 Jul 2014 15:06:25 + > "Richardson, Bruce" wrote: > > > > -Original Message- > > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. Linville > > > Sent: Friday, July 11, 2014 7:49 AM > > > To: Stephen Hemminger > > > Cc: dev at dpdk.org > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET- > > > based virtual devices > > > > > > On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > > > > On Thu, 10 Jul 2014 16:32:49 -0400 > > > > "John W. Linville" wrote: > > > > > > > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > > > socket. This implementation uses mmap'ed ring buffers to limit > > > > > copying > > > > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > > > > AF_PACKET is used for frame reception. In the current implementation, > > > > > Tx and Rx queues are always paired, and therefore are always equal > > > > > in number -- changing this would be a Simple Matter Of Programming. > > > > > > > > > > Interfaces of this type are created with a command line option like > > > > > "--vdev=eth_packet0,iface=...". There are a number of options > > > > > availabe > > > > > as arguments: > > > > > > > > > > - Interface is chosen by "iface" (required) > > > > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > > > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: > > > > > 4096) > > > > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: > > > > > 2048) > > > > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: > 512) > > > > > > > > > > Signed-off-by: John W. Linville > > > > > --- > > > > > This PMD is intended to provide a means for using DPDK on a broad > > > > > range of hardware without hardware-specific PMDs and (hopefully) > > > > > with better performance than what PCAP offers in Linux. This might > > > > > be useful as a development platform for DPDK applications when > > > > > DPDK-supported hardware is expensive or unavailable. > > > > > > > > > > config/common_bsdapp | 5 + > > > > > config/common_linuxapp | 5 + > > > > > lib/Makefile | 1 + > > > > > lib/librte_eal/linuxapp/eal/Makefile | 1 + > > > > > lib/librte_pmd_packet/Makefile | 60 +++ > > > > > lib/librte_pmd_packet/rte_eth_packet.c | 826 > > > + > > > > > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > > > > > mk/rte.app.mk | 4 + > > > > > 8 files changed, 957 insertions(+) > > > > > create mode 100644 lib/librte_pmd_packet/Makefile > > > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.c > > > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > > > > > > > > > diff --git a/config/common_bsdapp b/config/common_bsdapp > > > > > index 943dce8f1ede..c317f031278e 100644 > > > > > --- a/config/common_bsdapp > > > > > +++ b/config/common_bsdapp > > > > > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > > > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > > > > > # > > > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > > > > +# > > > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > > > > > + > > > > > +# > > > > > # Do prefetch of packet data within PMD driver receive function > > > > > # > > > > > CONFIG_RTE_PMD_PACKET_PREFETCH=y > > > > > diff --git a/config/common_linuxapp b/config/common_linuxapp > > > > &g
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
I'm not sure that would make any sense -- the AF_PACKET sockets are mapped to specific interfaces. What are you trying to do with a syntax like that? John On Fri, Jul 11, 2014 at 07:04:19PM +, Zhou, Danny wrote: > Does it support specifying multiple NIC interfaces using command line option > like "--vdev=eth_packet0,iface=..."? Say "iface=eth0,eth1,eth2...", tried but > it doesn't work. > > > -Original Message- > > From: Zhou, Danny > > Sent: Saturday, July 12, 2014 2:01 AM > > To: 'John W. Linville' > > Cc: dev at dpdk.org > > Subject: RE: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > Tried on 3.12, both of them are undefined. Anyway, will comment them out > > and see > > what performance it could achieve. > > > > > -Original Message- > > > From: John W. Linville [mailto:linville at tuxdriver.com] > > > Sent: Saturday, July 12, 2014 1:41 AM > > > To: Zhou, Danny > > > Cc: dev at dpdk.org > > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > > AF_PACKET-based virtual devices > > > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > > Looks like you used a pretty new kernel version with new socket > > > > options that old > > > kernel like my 3.12 does not support. When I tried this patch, it just > > > cannot build, and compiler complains like below. Which Linux distribution > > > does this > > patch work for? > > > How to ensure it works for old kernels? > > > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: In > > > > function > > > rte_pmd_init_internals: > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524 > > > > :1 > > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in this > > > > function) > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524 > > > > :1 > > > > 7: note: each undeclared identifier is reported only once for each > > > > function it appears in > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:557 > > > > :3 > > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this > > > > function) > > > > > > Both of them are isolated, so for playing with it you could just comment > > > those out. > > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, > > > while PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER > > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > > 64)#define > > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec > > > Author: Willem de Bruijn > > > > > > packet: packet fanout rollover during socket overload > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git describe --contains 77f65ebdca506 > > > v3.10-rc1~66^2~423 > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git annotate > > > include/uapi/linux/if_packet.h | grep PACKET_QDISC_BYPASS > > > d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 > > > 56)#define > > > PACKET_QDISC_BYPASS 20 > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short > > > d346a3fae3ff1 commit > > > d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 > > > Author: Daniel Borkmann > > > > > > packet: introduce PACKET_QDISC_BYPASS socket option > > > > > > /home/linville/git/linux > > > [linville-x1.hq.tuxdriver.com]:> git describe --contains d346a3fae3ff1 > > > v3.14-rc1~94^2~564 > > > > > > Is there an example of code in DPDK that requires specific kernel > > > versions? What is the preferred method for coding such dependencies? > > > > > > John > > > -- > > > John W. Linville Someday the world will need a hero, and you > > > linville at tuxdriver.com might be all we have. Be ready. > -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. Linville > Sent: Friday, July 11, 2014 7:49 AM > To: Stephen Hemminger > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > AF_PACKET- based virtual devices > > On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > > On Thu, 10 Jul 2014 16:32:49 -0400 > > "John W. Linville" wrote: > > > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > socket. This implementation uses mmap'ed ring buffers to limit > > > copying and user/kernel transitions. The PACKET_FANOUT_HASH > > > behavior of AF_PACKET is used for frame reception. In the current > > > implementation, Tx and Rx queues are always paired, and therefore > > > are always equal in number -- changing this would be a Simple Matter Of > > > Programming. > > > > > > Interfaces of this type are created with a command line option > > > like "--vdev=eth_packet0,iface=...". There are a number of > > > options availabe as arguments: > > > > > > - Interface is chosen by "iface" (required) > > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: > > > 4096) > > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: > > > 2048) > > > - AF_PACKET MMAP frame count set by "framecnt" (optional, > > > default: 512) > > > > > > Signed-off-by: John W. Linville > > > --- > > > This PMD is intended to provide a means for using DPDK on a broad > > > range of hardware without hardware-specific PMDs and (hopefully) > > > with better performance than what PCAP offers in Linux. This > > > might be useful as a development platform for DPDK applications > > > when DPDK-supported hardware is expensive or unavailable. > > > > > > config/common_bsdapp | 5 + > > > config/common_linuxapp | 5 + > > > lib/Makefile | 1 + > > > lib/librte_eal/linuxapp/eal/Makefile | 1 + > > > lib/librte_pmd_packet/Makefile | 60 +++ > > > lib/librte_pmd_packet/rte_eth_packet.c | 826 > + > > > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > > > mk/rte.app.mk | 4 + > > > 8 files changed, 957 insertions(+) create mode 100644 > > > lib/librte_pmd_packet/Makefile create mode 100644 > > > lib/librte_pmd_packet/rte_eth_packet.c > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > > > > > diff --git a/config/common_bsdapp b/config/common_bsdapp index > > > 943dce8f1ede..c317f031278e 100644 > > > --- a/config/common_bsdapp > > > +++ b/config/common_bsdapp > > > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > # > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) # > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > > > + > > > +# > > > # Do prefetch of packet data within PMD driver receive function > > > # CONFIG_RTE_PMD_PACKET_PREFETCH=y diff --git > > > a/config/common_linuxapp b/config/common_linuxapp index > > > 7bf5d80d4e26..f9e7bc3015ec 100644 > > > --- a/config/common_linuxapp > > > +++ b/config/common_linuxapp > > > @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > # > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) # > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=y > > > + > > > +# > > > # Compile Xen PMD > > > # > > > CONFIG_RTE_LIBRTE_PMD_XENVIRT=n > > > diff --git a/lib/Makefile b/lib/Makefile index > > > 10c5bb3045bc..930fadf29898 100644 > > > --- a/lib/Makefile > > > +++ b/lib/Makefile > > > @@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += > librte_pmd_i40e > > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond > > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring > > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap > > > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PACKET) += librte_pmd_packet > > > DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio > >
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
2014-07-10 16:32, John W. Linville: > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > socket. This implementation uses mmap'ed ring buffers to limit copying > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > AF_PACKET is used for frame reception. In the current implementation, > Tx and Rx queues are always paired, and therefore are always equal > in number -- changing this would be a Simple Matter Of Programming. > > Interfaces of this type are created with a command line option like > "--vdev=eth_packet0,iface=...". There are a number of options availabe > as arguments: > > - Interface is chosen by "iface" (required) > - Number of queue pairs set by "qpairs" (optional, default: 16) > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > Signed-off-by: John W. Linville > --- > This PMD is intended to provide a means for using DPDK on a broad > range of hardware without hardware-specific PMDs and (hopefully) > with better performance than what PCAP offers in Linux. This might > be useful as a development platform for DPDK applications when > DPDK-supported hardware is expensive or unavailable. Thank you for this nice work. I think it would be well suited to host this PMD as an external one in order to make it work also with DPDK 1.7.0. -- Thomas
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. Linville > Sent: Friday, July 11, 2014 7:49 AM > To: Stephen Hemminger > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET- > based virtual devices > > On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > > On Thu, 10 Jul 2014 16:32:49 -0400 > > "John W. Linville" wrote: > > > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > socket. This implementation uses mmap'ed ring buffers to limit copying > > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > > AF_PACKET is used for frame reception. In the current implementation, > > > Tx and Rx queues are always paired, and therefore are always equal > > > in number -- changing this would be a Simple Matter Of Programming. > > > > > > Interfaces of this type are created with a command line option like > > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > > as arguments: > > > > > > - Interface is chosen by "iface" (required) > > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > > > Signed-off-by: John W. Linville > > > --- > > > This PMD is intended to provide a means for using DPDK on a broad > > > range of hardware without hardware-specific PMDs and (hopefully) > > > with better performance than what PCAP offers in Linux. This might > > > be useful as a development platform for DPDK applications when > > > DPDK-supported hardware is expensive or unavailable. > > > > > > config/common_bsdapp | 5 + > > > config/common_linuxapp | 5 + > > > lib/Makefile | 1 + > > > lib/librte_eal/linuxapp/eal/Makefile | 1 + > > > lib/librte_pmd_packet/Makefile | 60 +++ > > > lib/librte_pmd_packet/rte_eth_packet.c | 826 > + > > > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > > > mk/rte.app.mk | 4 + > > > 8 files changed, 957 insertions(+) > > > create mode 100644 lib/librte_pmd_packet/Makefile > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.c > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > > > > > diff --git a/config/common_bsdapp b/config/common_bsdapp > > > index 943dce8f1ede..c317f031278e 100644 > > > --- a/config/common_bsdapp > > > +++ b/config/common_bsdapp > > > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > # > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > > +# > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > > > + > > > +# > > > # Do prefetch of packet data within PMD driver receive function > > > # > > > CONFIG_RTE_PMD_PACKET_PREFETCH=y > > > diff --git a/config/common_linuxapp b/config/common_linuxapp > > > index 7bf5d80d4e26..f9e7bc3015ec 100644 > > > --- a/config/common_linuxapp > > > +++ b/config/common_linuxapp > > > @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > # > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > > +# > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=y > > > + > > > +# > > > # Compile Xen PMD > > > # > > > CONFIG_RTE_LIBRTE_PMD_XENVIRT=n > > > diff --git a/lib/Makefile b/lib/Makefile > > > index 10c5bb3045bc..930fadf29898 100644 > > > --- a/lib/Makefile > > > +++ b/lib/Makefile > > > @@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += > librte_pmd_i40e > > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond > > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring > > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap > > > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PACKET) += librte_pmd_packet > > > DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio > > > DIRS-$(CONFIG_RTE_LIBRTE
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
Not sure what the issue might be, PACKET_FANOUT_FLAG_ROLLOVER is defined in include/uapi/linux/if_packet.h in the v3.12 tree. On Fri, Jul 11, 2014 at 06:01:27PM +, Zhou, Danny wrote: > Tried on 3.12, both of them are undefined. Anyway, will comment them out and > see what performance it could achieve. > > > -Original Message- > > From: John W. Linville [mailto:linville at tuxdriver.com] > > Sent: Saturday, July 12, 2014 1:41 AM > > To: Zhou, Danny > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET-based virtual devices > > > > On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > > > Looks like you used a pretty new kernel version with new socket options > > > that old > > kernel like my 3.12 does not support. When I tried this patch, it just > > cannot build, and > > compiler complains like below. Which Linux distribution does this patch > > work for? > > How to ensure it works for old kernels? > > > > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: In > > > function > > rte_pmd_init_internals: > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:1 > > > 7: error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in this > > > function) > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:1 > > > 7: note: each undeclared identifier is reported only once for each > > > function it appears in > > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:557:3 > > > 3: error: PACKET_QDISC_BYPASS undeclared (first use in this function) > > > > Both of them are isolated, so for playing with it you could just comment > > those out. > > It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, while > > PACKET_QDISC_BYPASS didn't show-up until 3.14... > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git annotate > > include/uapi/linux/if_packet.h | grep > > PACKET_FANOUT_FLAG_ROLLOVER > > 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + > > 64)#define > > PACKET_FANOUT_FLAG_ROLLOVER 0x1000 > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short 77f65ebdca506 > > commit > > 77f65ebdca506870d99bfabe52bde222511022ec > > Author: Willem de Bruijn > > > > packet: packet fanout rollover during socket overload > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git describe --contains 77f65ebdca506 > > v3.10-rc1~66^2~423 > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git annotate > > include/uapi/linux/if_packet.h | grep > > PACKET_QDISC_BYPASS > > d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 > > 56)#define > > PACKET_QDISC_BYPASS 20 > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git show -s --format=short d346a3fae3ff1 > > commit > > d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 > > Author: Daniel Borkmann > > > > packet: introduce PACKET_QDISC_BYPASS socket option > > > > /home/linville/git/linux > > [linville-x1.hq.tuxdriver.com]:> git describe --contains d346a3fae3ff1 > > v3.14-rc1~94^2~564 > > > > Is there an example of code in DPDK that requires specific kernel versions? > > What is > > the preferred method for coding such dependencies? > > > > John > > -- > > John W. LinvilleSomeday the world will need a hero, and you > > linville at tuxdriver.com might be all we have. Be ready. > -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 05:38:17PM +, Richardson, Bruce wrote: > > -Original Message- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon > > Sent: Friday, July 11, 2014 9:48 AM > > To: John W. Linville > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET- > > based virtual devices > > > > 2014-07-11 11:30, John W. Linville: > > > On Fri, Jul 11, 2014 at 05:04:04PM +0200, Thomas Monjalon wrote: > > > > 2014-07-11 10:51, John W. Linville: > > > > > On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > > > > > > Thank you for this nice work. > > > > > > > > > > > > I think it would be well suited to host this PMD as an external one > > > > > > in > > > > > > order to make it work also with DPDK 1.7.0. > > > > > > > > > > I'm not sure I understand the suggestion -- you don't want to merge > > > > > the driver for 1.8? Or you just want to host this patch somewhere, > > > > > so people can still use it w/ 1.7? > > > > > > > > I suggest to have a separated repository here: > > > > http://dpdk.org/browse/ > > > > > > I really don't see any reason not to merge it. It was already delayed > > > by me waiting for all the PMD init changes to settle out in the 1.6 > > > release, and I still had to do a few touch-ups for it to compile on > > > 1.7. I definitely do not want to have to do that over and over again. > > > > It's a pity that we didn't synchronize our efforts to make it integrated > > during 1.7.0 cycle. > > > > > Why wouldn't you just merge it? If someone wants to use it on 1.7, > > > they can just apply the patch. > > > > I'm OK to merge it. I was only suggesting to host your PMD externally like > > we > > did for virtio-net-pmd, vmxnet3-usermap and memnic. > > It was the same discussion for the vmxnet3 PMD that Stephen submitted. > > > > I start thinking that nobody wants PMD to be external. So we may merge this > > one in dpdk.git and start talking what to do for the other ones: > > - move memnic in dpdk.git? > > Yes, I would agree with this. Having drivers in external git repos makes it > hard for us to take them into account when planning on making changes to the > core libs. > > > - move virtio-net-pmd and vmxnet3-usermap where sits their uio > > counterparts? > > - merge Brocade's vmxnet3 as new one or as a replacement for > > vmxnet3-uio? > > For these we really should try and converge on a single solution. Having > multiple vmxnet3 and virtio drivers duplicates effort and is just plain > messy! Of course, that's easier to say than to agree on... +1 -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 05:20:42PM +, Zhou, Danny wrote: > Looks like you used a pretty new kernel version with new socket options that > old kernel like my 3.12 does not support. When I tried this patch, it just > cannot build, and compiler complains like below. Which Linux distribution > does this patch work for? How to ensure it works for old kernels? > > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c: In function > rte_pmd_init_internals: > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:17: > error: PACKET_FANOUT_FLAG_ROLLOVER undeclared (first use in this function) > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:524:17: > note: each undeclared identifier is reported only once for each function it > appears in > /home/danny/dpdk.org/dpdk/lib/librte_pmd_packet/rte_eth_packet.c:557:33: > error: PACKET_QDISC_BYPASS undeclared (first use in this function) Both of them are isolated, so for playing with it you could just comment those out. It looks like PACKET_FANOUT_FLAG_ROLLOVER should have been in 3.10, while PACKET_QDISC_BYPASS didn't show-up until 3.14... /home/linville/git/linux [linville-x1.hq.tuxdriver.com]:> git annotate include/uapi/linux/if_packet.h | grep PACKET_FANOUT_FLAG_ROLLOVER 77f65ebdca506 (Willem de Bruijn 2013-03-19 10:18:11 + 64)#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 /home/linville/git/linux [linville-x1.hq.tuxdriver.com]:> git show -s --format=short 77f65ebdca506 commit 77f65ebdca506870d99bfabe52bde222511022ec Author: Willem de Bruijn packet: packet fanout rollover during socket overload /home/linville/git/linux [linville-x1.hq.tuxdriver.com]:> git describe --contains 77f65ebdca506 v3.10-rc1~66^2~423 /home/linville/git/linux [linville-x1.hq.tuxdriver.com]:> git annotate include/uapi/linux/if_packet.h | grep PACKET_QDISC_BYPASS d346a3fae3ff1 (Daniel Borkmann2013-12-06 11:36:17 +0100 56)#define PACKET_QDISC_BYPASS 20 /home/linville/git/linux [linville-x1.hq.tuxdriver.com]:> git show -s --format=short d346a3fae3ff1 commit d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 Author: Daniel Borkmann packet: introduce PACKET_QDISC_BYPASS socket option /home/linville/git/linux [linville-x1.hq.tuxdriver.com]:> git describe --contains d346a3fae3ff1 v3.14-rc1~94^2~564 Is there an example of code in DPDK that requires specific kernel versions? What is the preferred method for coding such dependencies? John -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 03:29:17PM +, Venkatesan, Venky wrote: > > -Original Message- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. Linville > > Sent: Friday, July 11, 2014 7:49 AM > > To: Stephen Hemminger > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for > > AF_PACKET- based virtual devices > > > > On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > > > On Thu, 10 Jul 2014 16:32:49 -0400 > > > "John W. Linville" wrote: > > > > > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > > +struct pkt_rx_queue { > > > > + int sockfd; > > > > + > > > > + struct iovec *rd; > > > > + uint8_t *map; > > > > + unsigned int framecount; > > > > + unsigned int framenum; > > > > + > > > > + struct rte_mempool *mb_pool; > > > > + > > > > + volatile unsigned long rx_pkts; > > > > + volatile unsigned long err_pkts; > > > > > > Use of volatile will generate slow code, don't think it is > > > necessary, especially when only one CPU can use a queue at a time. > > > > That is a good point, worth checking out. FWIW, those lines are > > boilerplate originally copied from the pcap PMD. :-) > > > > > Yes, I agree it's worth checking out if there is a performance impact, but > > if we assume that the stats for RX/TX are possibly going to be read by > > another core, they really should be volatile for correctness > > Accessing the rx_queue structure directly for stats is unlikely to happen > from a second core; we should probably change the PCAP PMD as well (thanks > for pointing that out John). "Unlikely" doesn't sound completely safe... :-) -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 05:04:04PM +0200, Thomas Monjalon wrote: > 2014-07-11 10:51, John W. Linville: > > On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > > > 2014-07-10 16:32, John W. Linville: > > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > > socket. This implementation uses mmap'ed ring buffers to limit copying > > > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > > > AF_PACKET is used for frame reception. In the current implementation, > > > > Tx and Rx queues are always paired, and therefore are always equal > > > > in number -- changing this would be a Simple Matter Of Programming. > > > > > > > > Interfaces of this type are created with a command line option like > > > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > > > > > > > as arguments: > > > > - Interface is chosen by "iface" (required) > > > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > > > > > Signed-off-by: John W. Linville > > > > --- > > > > This PMD is intended to provide a means for using DPDK on a broad > > > > range of hardware without hardware-specific PMDs and (hopefully) > > > > with better performance than what PCAP offers in Linux. This might > > > > be useful as a development platform for DPDK applications when > > > > DPDK-supported hardware is expensive or unavailable. > > > > > > Thank you for this nice work. > > > > > > I think it would be well suited to host this PMD as an external one in > > > order to make it work also with DPDK 1.7.0. > > > > I'm not sure I understand the suggestion -- you don't want to merge > > the driver for 1.8? Or you just want to host this patch somewhere, > > so people can still use it w/ 1.7? > > I suggest to have a separated repository here: > http://dpdk.org/browse/ I really don't see any reason not to merge it. It was already delayed by me waiting for all the PMD init changes to settle out in the 1.6 release, and I still had to do a few touch-ups for it to compile on 1.7. I definitely do not want to have to do that over and over again. Why wouldn't you just merge it? If someone wants to use it on 1.7, they can just apply the patch. John -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 03:26:39PM +0200, Thomas Monjalon wrote: > 2014-07-10 16:32, John W. Linville: > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > socket. This implementation uses mmap'ed ring buffers to limit copying > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > AF_PACKET is used for frame reception. In the current implementation, > > Tx and Rx queues are always paired, and therefore are always equal > > in number -- changing this would be a Simple Matter Of Programming. > > > > Interfaces of this type are created with a command line option like > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > as arguments: > > > > - Interface is chosen by "iface" (required) > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > Signed-off-by: John W. Linville > > --- > > This PMD is intended to provide a means for using DPDK on a broad > > range of hardware without hardware-specific PMDs and (hopefully) > > with better performance than what PCAP offers in Linux. This might > > be useful as a development platform for DPDK applications when > > DPDK-supported hardware is expensive or unavailable. > > Thank you for this nice work. > > I think it would be well suited to host this PMD as an external one in order > to make it work also with DPDK 1.7.0. I'm not sure I understand the suggestion -- you don't want to merge the driver for 1.8? Or you just want to host this patch somewhere, so people can still use it w/ 1.7? John -- John W. LinvilleSomeday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > On Thu, 10 Jul 2014 16:32:49 -0400 > "John W. Linville" wrote: > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > socket. This implementation uses mmap'ed ring buffers to limit copying > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > AF_PACKET is used for frame reception. In the current implementation, > > Tx and Rx queues are always paired, and therefore are always equal > > in number -- changing this would be a Simple Matter Of Programming. > > > > Interfaces of this type are created with a command line option like > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > as arguments: > > > > - Interface is chosen by "iface" (required) > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > Signed-off-by: John W. Linville > > --- > > This PMD is intended to provide a means for using DPDK on a broad > > range of hardware without hardware-specific PMDs and (hopefully) > > with better performance than what PCAP offers in Linux. This might > > be useful as a development platform for DPDK applications when > > DPDK-supported hardware is expensive or unavailable. > > > > config/common_bsdapp | 5 + > > config/common_linuxapp | 5 + > > lib/Makefile | 1 + > > lib/librte_eal/linuxapp/eal/Makefile | 1 + > > lib/librte_pmd_packet/Makefile | 60 +++ > > lib/librte_pmd_packet/rte_eth_packet.c | 826 > > + > > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > > mk/rte.app.mk | 4 + > > 8 files changed, 957 insertions(+) > > create mode 100644 lib/librte_pmd_packet/Makefile > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.c > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > > > diff --git a/config/common_bsdapp b/config/common_bsdapp > > index 943dce8f1ede..c317f031278e 100644 > > --- a/config/common_bsdapp > > +++ b/config/common_bsdapp > > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > # > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > +# > > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > > + > > +# > > # Do prefetch of packet data within PMD driver receive function > > # > > CONFIG_RTE_PMD_PACKET_PREFETCH=y > > diff --git a/config/common_linuxapp b/config/common_linuxapp > > index 7bf5d80d4e26..f9e7bc3015ec 100644 > > --- a/config/common_linuxapp > > +++ b/config/common_linuxapp > > @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > # > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > +# > > +CONFIG_RTE_LIBRTE_PMD_PACKET=y > > + > > +# > > # Compile Xen PMD > > # > > CONFIG_RTE_LIBRTE_PMD_XENVIRT=n > > diff --git a/lib/Makefile b/lib/Makefile > > index 10c5bb3045bc..930fadf29898 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap > > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PACKET) += librte_pmd_packet > > DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio > > DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt > > diff --git a/lib/librte_eal/linuxapp/eal/Makefile > > b/lib/librte_eal/linuxapp/eal/Makefile > > index 756d6b0c9301..feed24a63272 100644 > > --- a/lib/librte_eal/linuxapp/eal/Makefile > > +++ b/lib/librte_eal/linuxapp/eal/Makefile > > @@ -44,6 +44,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ether > > CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem > > CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring > > CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap > > +CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_packet > > CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt > > CFLAGS += $(WERROR_FLAGS) -O3 > > > > diff --git a/lib/librte_pmd_packet/Makefile b/lib/librte_pmd_packet/Makefile > > new file mode 100644 > > index ..e1266fb992cd > > --- /dev/null > > +++ b/lib/librte_pmd_packet/Makefile > > @@ -0,0 +1,60 @@ > > +# BSD LICENSE > > +# > > +# Copyright(c) 2014 John W. Linville > > +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. > > +# Copyright(c) 2014 6WIND S.A. > > +# All rights reserved. > > +# > > +# Redistribution and use in source and binary forms, with or without > > +# modification, are permitted provided that the following conditions > > +# are met: > > +# > > +#
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Fri, 11 Jul 2014 15:06:25 + "Richardson, Bruce" wrote: > > -Original Message- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John W. Linville > > Sent: Friday, July 11, 2014 7:49 AM > > To: Stephen Hemminger > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET- > > based virtual devices > > > > On Fri, Jul 11, 2014 at 06:11:47AM -0700, Stephen Hemminger wrote: > > > On Thu, 10 Jul 2014 16:32:49 -0400 > > > "John W. Linville" wrote: > > > > > > > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > > > > socket. This implementation uses mmap'ed ring buffers to limit copying > > > > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > > > > AF_PACKET is used for frame reception. In the current implementation, > > > > Tx and Rx queues are always paired, and therefore are always equal > > > > in number -- changing this would be a Simple Matter Of Programming. > > > > > > > > Interfaces of this type are created with a command line option like > > > > "--vdev=eth_packet0,iface=...". There are a number of options availabe > > > > as arguments: > > > > > > > > - Interface is chosen by "iface" (required) > > > > - Number of queue pairs set by "qpairs" (optional, default: 16) > > > > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > > > > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > > > > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > > > > > > > Signed-off-by: John W. Linville > > > > --- > > > > This PMD is intended to provide a means for using DPDK on a broad > > > > range of hardware without hardware-specific PMDs and (hopefully) > > > > with better performance than what PCAP offers in Linux. This might > > > > be useful as a development platform for DPDK applications when > > > > DPDK-supported hardware is expensive or unavailable. > > > > > > > > config/common_bsdapp | 5 + > > > > config/common_linuxapp | 5 + > > > > lib/Makefile | 1 + > > > > lib/librte_eal/linuxapp/eal/Makefile | 1 + > > > > lib/librte_pmd_packet/Makefile | 60 +++ > > > > lib/librte_pmd_packet/rte_eth_packet.c | 826 > > + > > > > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > > > > mk/rte.app.mk | 4 + > > > > 8 files changed, 957 insertions(+) > > > > create mode 100644 lib/librte_pmd_packet/Makefile > > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.c > > > > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > > > > > > > diff --git a/config/common_bsdapp b/config/common_bsdapp > > > > index 943dce8f1ede..c317f031278e 100644 > > > > --- a/config/common_bsdapp > > > > +++ b/config/common_bsdapp > > > > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > > > # > > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > > > +# > > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > > > > + > > > > +# > > > > # Do prefetch of packet data within PMD driver receive function > > > > # > > > > CONFIG_RTE_PMD_PACKET_PREFETCH=y > > > > diff --git a/config/common_linuxapp b/config/common_linuxapp > > > > index 7bf5d80d4e26..f9e7bc3015ec 100644 > > > > --- a/config/common_linuxapp > > > > +++ b/config/common_linuxapp > > > > @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n > > > > CONFIG_RTE_LIBRTE_PMD_BOND=y > > > > > > > > # > > > > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > > > > +# > > > > +CONFIG_RTE_LIBRTE_PMD_PACKET=y > > > > + > > > > +# > > > > # Compile Xen PMD > > > > # > > > > CONFIG_RTE_LIBRTE_PMD_XENVIRT=n > > > > diff --git a/lib/Makefile b/lib/Makefile > > > > index 10c5bb3045bc..930fadf29898 100644 > > > > --- a/lib/Makefile > > > > +++ b/
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
On Thu, 10 Jul 2014 16:32:49 -0400 "John W. Linville" wrote: > This is a Linux-specific virtual PMD driver backed by an AF_PACKET > socket. This implementation uses mmap'ed ring buffers to limit copying > and user/kernel transitions. The PACKET_FANOUT_HASH behavior of > AF_PACKET is used for frame reception. In the current implementation, > Tx and Rx queues are always paired, and therefore are always equal > in number -- changing this would be a Simple Matter Of Programming. > > Interfaces of this type are created with a command line option like > "--vdev=eth_packet0,iface=...". There are a number of options availabe > as arguments: > > - Interface is chosen by "iface" (required) > - Number of queue pairs set by "qpairs" (optional, default: 16) > - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) > - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) > - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) > > Signed-off-by: John W. Linville > --- > This PMD is intended to provide a means for using DPDK on a broad > range of hardware without hardware-specific PMDs and (hopefully) > with better performance than what PCAP offers in Linux. This might > be useful as a development platform for DPDK applications when > DPDK-supported hardware is expensive or unavailable. > > config/common_bsdapp | 5 + > config/common_linuxapp | 5 + > lib/Makefile | 1 + > lib/librte_eal/linuxapp/eal/Makefile | 1 + > lib/librte_pmd_packet/Makefile | 60 +++ > lib/librte_pmd_packet/rte_eth_packet.c | 826 > + > lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ > mk/rte.app.mk | 4 + > 8 files changed, 957 insertions(+) > create mode 100644 lib/librte_pmd_packet/Makefile > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.c > create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h > > diff --git a/config/common_bsdapp b/config/common_bsdapp > index 943dce8f1ede..c317f031278e 100644 > --- a/config/common_bsdapp > +++ b/config/common_bsdapp > @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y > CONFIG_RTE_LIBRTE_PMD_BOND=y > > # > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > +# > +CONFIG_RTE_LIBRTE_PMD_PACKET=n > + > +# > # Do prefetch of packet data within PMD driver receive function > # > CONFIG_RTE_PMD_PACKET_PREFETCH=y > diff --git a/config/common_linuxapp b/config/common_linuxapp > index 7bf5d80d4e26..f9e7bc3015ec 100644 > --- a/config/common_linuxapp > +++ b/config/common_linuxapp > @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n > CONFIG_RTE_LIBRTE_PMD_BOND=y > > # > +# Compile software PMD backed by AF_PACKET sockets (Linux only) > +# > +CONFIG_RTE_LIBRTE_PMD_PACKET=y > + > +# > # Compile Xen PMD > # > CONFIG_RTE_LIBRTE_PMD_XENVIRT=n > diff --git a/lib/Makefile b/lib/Makefile > index 10c5bb3045bc..930fadf29898 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e > DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond > DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring > DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PACKET) += librte_pmd_packet > DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio > DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 > DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt > diff --git a/lib/librte_eal/linuxapp/eal/Makefile > b/lib/librte_eal/linuxapp/eal/Makefile > index 756d6b0c9301..feed24a63272 100644 > --- a/lib/librte_eal/linuxapp/eal/Makefile > +++ b/lib/librte_eal/linuxapp/eal/Makefile > @@ -44,6 +44,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ether > CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem > CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring > CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap > +CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_packet > CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt > CFLAGS += $(WERROR_FLAGS) -O3 > > diff --git a/lib/librte_pmd_packet/Makefile b/lib/librte_pmd_packet/Makefile > new file mode 100644 > index ..e1266fb992cd > --- /dev/null > +++ b/lib/librte_pmd_packet/Makefile > @@ -0,0 +1,60 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2014 John W. Linville > +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. > +# Copyright(c) 2014 6WIND S.A. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions > +# are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +#
[dpdk-dev] [PATCH] librte_pmd_packet: add PMD for AF_PACKET-based virtual devices
This is a Linux-specific virtual PMD driver backed by an AF_PACKET socket. This implementation uses mmap'ed ring buffers to limit copying and user/kernel transitions. The PACKET_FANOUT_HASH behavior of AF_PACKET is used for frame reception. In the current implementation, Tx and Rx queues are always paired, and therefore are always equal in number -- changing this would be a Simple Matter Of Programming. Interfaces of this type are created with a command line option like "--vdev=eth_packet0,iface=...". There are a number of options availabe as arguments: - Interface is chosen by "iface" (required) - Number of queue pairs set by "qpairs" (optional, default: 16) - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096) - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048) - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512) Signed-off-by: John W. Linville --- This PMD is intended to provide a means for using DPDK on a broad range of hardware without hardware-specific PMDs and (hopefully) with better performance than what PCAP offers in Linux. This might be useful as a development platform for DPDK applications when DPDK-supported hardware is expensive or unavailable. config/common_bsdapp | 5 + config/common_linuxapp | 5 + lib/Makefile | 1 + lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_pmd_packet/Makefile | 60 +++ lib/librte_pmd_packet/rte_eth_packet.c | 826 + lib/librte_pmd_packet/rte_eth_packet.h | 55 +++ mk/rte.app.mk | 4 + 8 files changed, 957 insertions(+) create mode 100644 lib/librte_pmd_packet/Makefile create mode 100644 lib/librte_pmd_packet/rte_eth_packet.c create mode 100644 lib/librte_pmd_packet/rte_eth_packet.h diff --git a/config/common_bsdapp b/config/common_bsdapp index 943dce8f1ede..c317f031278e 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -226,6 +226,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y CONFIG_RTE_LIBRTE_PMD_BOND=y # +# Compile software PMD backed by AF_PACKET sockets (Linux only) +# +CONFIG_RTE_LIBRTE_PMD_PACKET=n + +# # Do prefetch of packet data within PMD driver receive function # CONFIG_RTE_PMD_PACKET_PREFETCH=y diff --git a/config/common_linuxapp b/config/common_linuxapp index 7bf5d80d4e26..f9e7bc3015ec 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -249,6 +249,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n CONFIG_RTE_LIBRTE_PMD_BOND=y # +# Compile software PMD backed by AF_PACKET sockets (Linux only) +# +CONFIG_RTE_LIBRTE_PMD_PACKET=y + +# # Compile Xen PMD # CONFIG_RTE_LIBRTE_PMD_XENVIRT=n diff --git a/lib/Makefile b/lib/Makefile index 10c5bb3045bc..930fadf29898 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap +DIRS-$(CONFIG_RTE_LIBRTE_PMD_PACKET) += librte_pmd_packet DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 756d6b0c9301..feed24a63272 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -44,6 +44,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ether CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap +CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_packet CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt CFLAGS += $(WERROR_FLAGS) -O3 diff --git a/lib/librte_pmd_packet/Makefile b/lib/librte_pmd_packet/Makefile new file mode 100644 index ..e1266fb992cd --- /dev/null +++ b/lib/librte_pmd_packet/Makefile @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2014 John W. Linville +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2014 6WIND S.A. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# T