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

Message ID CAMHMu0MzwExcOOqK51Z6kt=XJzWQ2J+jWZaJcCVb2_OZmtZhzw@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Aws Ismail Nov. 25, 2016, 7:38 p.m. UTC
  Keith,

This won't build when integrated with v16.11. The register macro
prefix has been renamed. a v10 is needed.


On Mon, Nov 21, 2016 at 7:56 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 10/13/2016 11:03 PM, Keith Wiles wrote:
>> The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
>> on the local host. The PMD allows for DPDK and the host to
>> communicate using a raw device interface on the host and in
>> the DPDK application. The device created is a Tap device with
>> a L2 packet header.
>>
>> v9 - Fix up the docs to use correct syntax
>> v8 - Fix issue with tap_tx_queue_setup() not return zero on success.
>> v7 - Reword the comment in common_base and fix the data->name issue
>> v6 - fixed the checkpatch issues
>> v5 - merge in changes from list review see related emails
>>      fixed many minor edits
>> v4 - merge with latest driver changes
>> v3 - fix includes by removing ifdef for other type besides Linux
>>      Fix the copyright notice in the Makefile
>> v2 - merge all of the patches into one patch
>>      Fix a typo on naming the tap device
>>      Update the maintainers list
>>
>> Signed-off-by: Keith Wiles <keith.wiles@intel.com>
>> ---
>
> Just a reminder, this is a new PMD and waiting for community review.
  

Comments

Aws Ismail Nov. 29, 2016, 9:36 p.m. UTC | #1
I have verified that adding just a single tap device works with testpmd.
But as soon as I try more than one tap device, I would get a coredump, e.g.:

root@
​localhost
:~# testpmd -c f -n 4 --socket-mem 512 --vdev=net_tap
​,iface=tap0​
--vdev=net_tap
​,iface=tap1​
-- -i
EAL: Detected 16 lcore(s)
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: cannot open /proc/self/numa_maps, consider that all memory is in
socket_id 0
PMD: Initializing pmd_tap for net_tap as dtap0
PMD: net_tap: Create TAP Ethernet device with 32 queues on numa 0
PMD: Initializing pmd_tap for net_tap as dtap1
PMD: net_tap: Create TAP Ethernet device with 32 queues on numa 0
EAL: failed to initialize net_tap device
PANIC in rte_eal_init():
Cannot init pmd devices
6: [testpmd() [0x409149]]
5: [/lib/libc.so.6(__libc_start_main+0xf0) [0x7f3e65fa8740]]
4: [testpmd() [0x408b21]]
3: [/usr/lib/librte_eal.so.3.1(rte_eal_init+0xe09) [0x7f3e68ceaea9]]
2: [/usr/lib/librte_eal.so.3.1(__rte_panic+0xc0) [0x7f3e68ce9b5a]]
1: [/usr/lib/librte_eal.so.3.1(rte_dump_stack+0x18) [0x7f3e68cf2078]]
Aborted (core dumped)

root@
​localhost​
:~#


On Fri, Nov 25, 2016 at 2:38 PM, Aws Ismail <aws.ismail@gmail.com> wrote:

> Keith,
>
> This won't build when integrated with v16.11. The register macro
> prefix has been renamed. a v10 is needed.
>
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 7f303db..297d4b6 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -752,5 +752,6 @@ static struct rte_vdev_driver pmd_tap_drv = {
>         .remove = rte_pmd_tap_remove,
>  };
>
> -DRIVER_REGISTER_VDEV(net_tap, pmd_tap_drv);
> -DRIVER_REGISTER_PARAM_STRING(net_tap, "iface=<string>,speed=N");
> +RTE_PMD_REGISTER_VDEV(net_tap, pmd_tap_drv);
> +RTE_PMD_REGISTER_ALIAS(net_tap, eth_tap);
> +RTE_PMD_REGISTER_PARAM_STRING(net_tap, "iface=<string>,speed=N");
>
> On Mon, Nov 21, 2016 at 7:56 AM, Ferruh Yigit <ferruh.yigit@intel.com>
> wrote:
> > On 10/13/2016 11:03 PM, Keith Wiles wrote:
> >> The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces
> >> on the local host. The PMD allows for DPDK and the host to
> >> communicate using a raw device interface on the host and in
> >> the DPDK application. The device created is a Tap device with
> >> a L2 packet header.
> >>
> >> v9 - Fix up the docs to use correct syntax
> >> v8 - Fix issue with tap_tx_queue_setup() not return zero on success.
> >> v7 - Reword the comment in common_base and fix the data->name issue
> >> v6 - fixed the checkpatch issues
> >> v5 - merge in changes from list review see related emails
> >>      fixed many minor edits
> >> v4 - merge with latest driver changes
> >> v3 - fix includes by removing ifdef for other type besides Linux
> >>      Fix the copyright notice in the Makefile
> >> v2 - merge all of the patches into one patch
> >>      Fix a typo on naming the tap device
> >>      Update the maintainers list
> >>
> >> Signed-off-by: Keith Wiles <keith.wiles@intel.com>
> >> ---
> >
> > Just a reminder, this is a new PMD and waiting for community review.
>
  
Wiles, Keith Nov. 29, 2016, 10:16 p.m. UTC | #2
> On Nov 29, 2016, at 3:36 PM, Aws Ismail <aws.ismail@gmail.com> wrote:

> 

> I have verified that adding just a single tap device works with testpmd. But as soon as I try more than one tap device, I would get a coredump, e.g.:

> 

> root@​localhost:~# testpmd -c f -n 4 --socket-mem 512 --vdev=net_tap​,iface=tap0​ --vdev=net_tap​,iface=tap1​ -- -i

> EAL: Detected 16 lcore(s)

> EAL: Probing VFIO support...

> EAL: VFIO support initialized

> EAL: cannot open /proc/self/numa_maps, consider that all memory is in socket_id 0

> PMD: Initializing pmd_tap for net_tap as dtap0

> PMD: net_tap: Create TAP Ethernet device with 32 queues on numa 0

> PMD: Initializing pmd_tap for net_tap as dtap1

> PMD: net_tap: Create TAP Ethernet device with 32 queues on numa 0

> EAL: failed to initialize net_tap device

> PANIC in rte_eal_init():

> Cannot init pmd devices

> 6: [testpmd() [0x409149]]

> 5: [/lib/libc.so.6(__libc_start_main+0xf0) [0x7f3e65fa8740]]

> 4: [testpmd() [0x408b21]]

> 3: [/usr/lib/librte_eal.so.3.1(rte_eal_init+0xe09) [0x7f3e68ceaea9]]

> 2: [/usr/lib/librte_eal.so.3.1(__rte_panic+0xc0) [0x7f3e68ce9b5a]]

> 1: [/usr/lib/librte_eal.so.3.1(rte_dump_stack+0x18) [0x7f3e68cf2078]]


It appears the call to rte_eth_dev_allocate() in the code is wrong. I did pass in  the variable called tap_name created in the function, but I was told I needed to pass in ‘name’ that was passed into the function. The rte_eth_dev_allocate() needs a unique name for each call and name is all was the same.

Need to change that line to use tap_name instead or tell me the real way to handle this problem.

If you want a new patch I can try to get it done, but I am working on something else at this time and it could be a few days before I can get the patch out.

> Aborted (core dumped)

> 

> root@​localhost​:~#

> 

> 

> On Fri, Nov 25, 2016 at 2:38 PM, Aws Ismail <aws.ismail@gmail.com> wrote:

> Keith,

> 

> This won't build when integrated with v16.11. The register macro

> prefix has been renamed. a v10 is needed.

> 

> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c

> index 7f303db..297d4b6 100644

> --- a/drivers/net/tap/rte_eth_tap.c

> +++ b/drivers/net/tap/rte_eth_tap.c

> @@ -752,5 +752,6 @@ static struct rte_vdev_driver pmd_tap_drv = {

>         .remove = rte_pmd_tap_remove,

>  };

> 

> -DRIVER_REGISTER_VDEV(net_tap, pmd_tap_drv);

> -DRIVER_REGISTER_PARAM_STRING(net_tap, "iface=<string>,speed=N");

> +RTE_PMD_REGISTER_VDEV(net_tap, pmd_tap_drv);

> +RTE_PMD_REGISTER_ALIAS(net_tap, eth_tap);

> +RTE_PMD_REGISTER_PARAM_STRING(net_tap, "iface=<string>,speed=N");

> 

> On Mon, Nov 21, 2016 at 7:56 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> > On 10/13/2016 11:03 PM, Keith Wiles wrote:

> >> The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces

> >> on the local host. The PMD allows for DPDK and the host to

> >> communicate using a raw device interface on the host and in

> >> the DPDK application. The device created is a Tap device with

> >> a L2 packet header.

> >>

> >> v9 - Fix up the docs to use correct syntax

> >> v8 - Fix issue with tap_tx_queue_setup() not return zero on success.

> >> v7 - Reword the comment in common_base and fix the data->name issue

> >> v6 - fixed the checkpatch issues

> >> v5 - merge in changes from list review see related emails

> >>      fixed many minor edits

> >> v4 - merge with latest driver changes

> >> v3 - fix includes by removing ifdef for other type besides Linux

> >>      Fix the copyright notice in the Makefile

> >> v2 - merge all of the patches into one patch

> >>      Fix a typo on naming the tap device

> >>      Update the maintainers list

> >>

> >> Signed-off-by: Keith Wiles <keith.wiles@intel.com>

> >> ---

> >

> > Just a reminder, this is a new PMD and waiting for community review.

> 


Regards,
Keith
  

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 7f303db..297d4b6 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -752,5 +752,6 @@  static struct rte_vdev_driver pmd_tap_drv = {
        .remove = rte_pmd_tap_remove,
 };

-DRIVER_REGISTER_VDEV(net_tap, pmd_tap_drv);
-DRIVER_REGISTER_PARAM_STRING(net_tap, "iface=<string>,speed=N");
+RTE_PMD_REGISTER_VDEV(net_tap, pmd_tap_drv);
+RTE_PMD_REGISTER_ALIAS(net_tap, eth_tap);
+RTE_PMD_REGISTER_PARAM_STRING(net_tap, "iface=<string>,speed=N");