[dpdk-dev,v8,4/4] ethdev: add control interface support

Message ID 20170621110651.75299-5-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Ferruh Yigit June 21, 2017, 11:06 a.m. UTC
  To have the support corresponding kernel module (UNCI) needs to be
inserted.  If kernel module is not there, application will run as
it is without kernel control path support.

When UNCI module inserted, running application creates a virtual Linux
network interface (dpdk$) per DPDK port. This interface can be used by
traditional Linux tools.

If Userspace Network Control Interface (UNCI) kernel module
(rte_unci.ko) inserted, virtual interfaces created for each DPDK port
for control purposes.

Created interfaces are named as dpdk#, like:

    $ ifconfig dpdk0; ifconfig dpdk1
    dpdk0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 90:e2:ba:0e:49:b9  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    dpdk1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 00:1b:21:76:fa:21  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Regular Linux commands can be issued on interfaces:

	$ ethtool -i dpdk0
	driver: net_ixgbe
	version: DPDK 17.08.0-rc0
	firmware-version: 0x61bf0001
	expansion-rom-version:
	bus-info: 0000:08:00.1
	supports-statistics: no
	supports-test: no
	supports-eeprom-access: yes
	supports-register-dump: yes
	supports-priv-flags: no

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_ether/rte_ethdev_pci.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
  

Comments

Stephen Hemminger June 21, 2017, 3:24 p.m. UTC | #1
On Wed, 21 Jun 2017 12:06:51 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> To have the support corresponding kernel module (UNCI) needs to be
> inserted.  If kernel module is not there, application will run as
> it is without kernel control path support.
> 
> When UNCI module inserted, running application creates a virtual Linux
> network interface (dpdk$) per DPDK port. This interface can be used by
> traditional Linux tools.
> 
> If Userspace Network Control Interface (UNCI) kernel module
> (rte_unci.ko) inserted, virtual interfaces created for each DPDK port
> for control purposes.
> 
> Created interfaces are named as dpdk#, like:
> 
>     $ ifconfig dpdk0; ifconfig dpdk1
>     dpdk0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
>             ether 90:e2:ba:0e:49:b9  txqueuelen 1000  (Ethernet)
>             RX packets 0  bytes 0 (0.0 B)
>             RX errors 0  dropped 0  overruns 0  frame 0
>             TX packets 0  bytes 0 (0.0 B)
>             TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> 
>     dpdk1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
>             ether 00:1b:21:76:fa:21  txqueuelen 1000  (Ethernet)
>             RX packets 0  bytes 0 (0.0 B)
>             RX errors 0  dropped 0  overruns 0  frame 0
>             TX packets 0  bytes 0 (0.0 B)
>             TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


If you get the sysfs network links correct, then udev should be able to
generate peristent network names.
  
Ferruh Yigit June 30, 2017, 5:06 p.m. UTC | #2
On 6/21/2017 4:24 PM, Stephen Hemminger wrote:
> On Wed, 21 Jun 2017 12:06:51 +0100
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
>> To have the support corresponding kernel module (UNCI) needs to be
>> inserted.  If kernel module is not there, application will run as
>> it is without kernel control path support.
>>
>> When UNCI module inserted, running application creates a virtual Linux
>> network interface (dpdk$) per DPDK port. This interface can be used by
>> traditional Linux tools.
>>
>> If Userspace Network Control Interface (UNCI) kernel module
>> (rte_unci.ko) inserted, virtual interfaces created for each DPDK port
>> for control purposes.
>>
>> Created interfaces are named as dpdk#, like:
>>
>>     $ ifconfig dpdk0; ifconfig dpdk1
>>     dpdk0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
>>             ether 90:e2:ba:0e:49:b9  txqueuelen 1000  (Ethernet)
>>             RX packets 0  bytes 0 (0.0 B)
>>             RX errors 0  dropped 0  overruns 0  frame 0
>>             TX packets 0  bytes 0 (0.0 B)
>>             TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
>>
>>     dpdk1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
>>             ether 00:1b:21:76:fa:21  txqueuelen 1000  (Ethernet)
>>             RX packets 0  bytes 0 (0.0 B)
>>             RX errors 0  dropped 0  overruns 0  frame 0
>>             TX packets 0  bytes 0 (0.0 B)
>>             TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> 
> 
> If you get the sysfs network links correct, then udev should be able to
> generate peristent network names.

I didn't get this one, currently interface names are requested from
userspace via IFLA_IFNAME, as dpdk# .
  

Patch

diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
index 69aab03fb..a32a617d7 100644
--- a/lib/librte_ether/rte_ethdev_pci.h
+++ b/lib/librte_ether/rte_ethdev_pci.h
@@ -38,6 +38,13 @@ 
 #include <rte_pci.h>
 #include <rte_ethdev.h>
 
+#ifdef RTE_LIBRTE_CTRL_IF
+#include <rte_ctrl_if.h>
+#else
+#define rte_eth_control_interface_create_one(port_id) do { } while(0)
+#define rte_eth_control_interface_destroy_one(port_id) do { } while(0)
+#endif
+
 /**
  * Copy pci device info to the Ethernet device data.
  *
@@ -157,8 +164,12 @@  rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
 	ret = dev_init(eth_dev);
-	if (ret)
+	if (ret) {
 		rte_eth_dev_pci_release(eth_dev);
+		return ret;
+	}
+
+	rte_eth_control_interface_create_one(eth_dev->data->port_id);
 
 	return ret;
 }
@@ -179,6 +190,8 @@  rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
 	if (!eth_dev)
 		return -ENODEV;
 
+	rte_eth_control_interface_destroy_one(eth_dev->data->port_id);
+
 	if (dev_uninit) {
 		ret = dev_uninit(eth_dev);
 		if (ret)