Prior to this commit, the 'dpdk' port type could only be used for
physical DPDK devices. Now, virtual devices (or 'vdevs') are supported.
'vdev' devices are those which use virtual DPDK Poll Mode Drivers eg.
null, pcap. To add a DPDK vdev, a valid 'dpdk-devargs' must be set for
the given dpdk port. The format expected is 'eth_<driver_name><x>' where
'x' is a number between 0 and RTE_MAX_ETHPORTS -1.

For example to add a port that uses the 'null' DPDK PMD driver:

ovs-vsctl set Interface null0 options:dpdk-devargs=eth_null0

Not all DPDK vdevs have been verified to work at this point in time.

Signed-off-by: Ciara Loftus <ciara.lof...@intel.com>
---
 Documentation/intro/install/dpdk-advanced.rst | 22 ++++++++++++++++++++++
 NEWS                                          |  1 +
 lib/netdev-dpdk.c                             | 21 +++++++++++++++++++++
 vswitchd/vswitch.xml                          |  9 +++++++--
 4 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/Documentation/intro/install/dpdk-advanced.rst 
b/Documentation/intro/install/dpdk-advanced.rst
index 858ff98..0384330 100644
--- a/Documentation/intro/install/dpdk-advanced.rst
+++ b/Documentation/intro/install/dpdk-advanced.rst
@@ -956,6 +956,28 @@ This feature is not supported with VFIO and could not work 
with some NICs.
 For more information please refer to the `DPDK Port Hotplug Framework
 <http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html#hotplug>`__.
 
+Vdev Support
+------------
+
+DPDK provides drivers for both physical and virtual devices. Physical DPDK
+devices are added to OVS by specifying a valid PCI address in 'dpdk-devargs'.
+Virtual DPDK devices which do not have PCI addresses can be added using a
+different format for 'dpdk-devargs'.
+
+Typically, the format expected is 'eth_<driver_name><x>' where 'x' is a
+number between 0 and RTE_MAX_ETHPORTS -1 (31).
+
+For example to add a dpdk port that uses the 'null' DPDK PMD driver:
+
+       $ ovs-vsctl add-port br0 null0 -- set Interface null0 type=dpdk \
+           options:dpdk-devargs=eth_null0
+
+More information on the different types of virtual DPDK PMDs can be found in
+the `DPDK documentation
+<http://dpdk.org/doc/guides/nics/overview.html>`__.
+
+Note: Not all DPDK virtual PMD drivers have been tested and verified to work.
+
 Bug Reporting
 -------------
 
diff --git a/NEWS b/NEWS
index a62a7a4..2215066 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,7 @@ Post-v2.6.0
      * Port Hotplug is now supported.
      * DPDK physical ports can now have arbitrary names. The PCI address of
        the device must be set using the 'dpdk-devargs' option.
+     * Virtual DPDK Poll Mode Driver (vdev PMD) support.
    - Fedora packaging:
      * A package upgrade does not automatically restart OVS service.
    - ovs-vswitchd/ovs-vsctl:
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 07a99c7..872ce63 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1124,6 +1124,24 @@ netdev_dpdk_process_pdevargs(struct netdev_dpdk *dev, 
const char *devargs,
     return 0;
 }
 
+static int
+netdev_dpdk_process_vdevargs(struct netdev_dpdk *dev, const char *devargs)
+{
+    uint8_t port_id;
+
+    if (!rte_eth_dev_attach(devargs, &port_id)) {
+        /* Attach successful */
+        VLOG_INFO("Port '%s' attached to DPDK as virtual device",
+                  dev->up.name);
+        dev->port_id = port_id;
+    } else {
+        /* Attach unsuccessful */
+        return -1;
+    }
+
+    return 0;
+}
+
 static void
 netdev_dpdk_process_devargs(struct netdev_dpdk *dev)
     OVS_REQUIRES(dev->mutex)
@@ -1134,6 +1152,9 @@ netdev_dpdk_process_devargs(struct netdev_dpdk *dev)
     if (!eal_parse_pci_DomBDF(dev->requested_devargs, &addr)) {
         /* Valid PCI address format detected - configure physical device */
         err = netdev_dpdk_process_pdevargs(dev, dev->requested_devargs, &addr);
+    } else {
+        /* Not a PCI device format - configure virtual device (vdev) */
+        err = netdev_dpdk_process_vdevargs(dev, dev->requested_devargs);
     }
 
     if (!err) {
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 23ab469..7c6f229 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2306,8 +2306,13 @@
       <column name="options" key="dpdk-devargs"
               type='{"type": "string"}'>
         <p>
-          Specifies the PCI address of a physical dpdk device.
-          Only supported by 'dpdk' devices.
+          Specifies the PCI address associated with the port for physical
+          devices, or the virtual driver to be used for the port when a virtual
+          PMD is intended to be used. For the latter, the argument string
+          typically takes the form of eth_&lt;driver_name&gt;&lt;x&gt; where
+          'driver_name' is a valid virtual DPDK PMD driver name and where 'x'
+          lies in the range of 0 to RTE_MAX_ETHPORTS-1.
+          Only supported by the dpdk port type.
         </p>
       </column>
 
-- 
2.4.3

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to