'dpdkvdev' ports are for use with virtual DPDK Poll Mode Drivers eg.
null, pcap.
To add a DPDK vdev, a valid 'dpdk-devargs' must be set. 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 'dpdkvdev' port that uses the 'null' DPDK PMD
driver:

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

All virtual DPDK PMDs haven't been tested so this port type can be
considered experimental.

Signed-off-by: Ciara Loftus <ciara.lof...@intel.com>
---
 INSTALL.DPDK-ADVANCED.md | 23 ++++++++++++++++++
 NEWS                     |  1 +
 lib/netdev-dpdk.c        | 62 ++++++++++++++++++++++++++++++++++++++++++++++--
 vswitchd/vswitch.xml     |  9 +++++--
 4 files changed, 91 insertions(+), 4 deletions(-)

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index 577e412..9ce507b 100644
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -16,6 +16,7 @@ OVS DPDK ADVANCED INSTALL GUIDE
 11. [Jumbo Frames](#jumbo)
 12. [Vsperf](#vsperf)
 13. [Port Hotplug](#hotplug)
+14. [Vdev Support](#vdev)
 
 ## <a name="overview"></a> 1. Overview
 
@@ -898,6 +899,28 @@ This feature is not supported with VFIO and could not work 
with some NICs,
 please refer to the [DPDK Port Hotplug Framework] in order to get more
 information.
 
+## <a name="vdev"></a> 14. Vdev Support (experimental)
+
+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 'dpdkvdev' 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 'dpdkvdev' port that uses the 'null' DPDK PMD driver:
+
+`ovs-vsctl add-port br0 null0 -- set Interface null0 type=dpdkvdev 
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
+
+Not all DPDK virtual PMD drivers have been tested and verified to work. As such
+support for these and the 'dpdkvdev' port type can be considered experimental.
+
 Bug Reporting:
 --------------
 
diff --git a/NEWS b/NEWS
index 4e3df06..fbd4a23 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,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.
+     * New 'dpdkvdev' port type for use with virtual DPDK Poll Mode Drivers.
    - Fedora packaging:
      * A package upgrade does not automatically restart OVS service.
 
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 816e0a6..d9cbc08 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1062,7 +1062,7 @@ netdev_dpdk_get_config(const struct netdev *netdev, 
struct smap *args)
 }
 
 static void
-netdev_dpdk_process_devargs(struct netdev_dpdk *dev, const char *devargs)
+netdev_dpdk_process_pdevargs(struct netdev_dpdk *dev, const char *devargs)
 {
     int i = 0;
     struct rte_eth_dev_info info;
@@ -1105,6 +1105,26 @@ netdev_dpdk_process_devargs(struct netdev_dpdk *dev, 
const char *devargs)
 }
 
 static void
+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;
+    }
+
+    rte_eth_dev_stop(dev->port_id);
+    dev->socket_id = rte_eth_dev_socket_id(dev->port_id);
+    dpdk_eth_dev_init(dev);
+}
+
+static void
 dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
     OVS_REQUIRES(dev->mutex)
 {
@@ -1171,7 +1191,28 @@ netdev_dpdk_set_config(struct netdev *netdev, const 
struct smap *args)
     if (!rte_eth_dev_is_valid_port(dev->port_id)) {
         new_devargs = smap_get(args, "dpdk-devargs");
         if (new_devargs && strlen(new_devargs)) {
-            netdev_dpdk_process_devargs(dev, new_devargs);
+            netdev_dpdk_process_pdevargs(dev, new_devargs);
+        }
+    }
+
+    ovs_mutex_unlock(&dev->mutex);
+
+    return 0;
+}
+
+static int
+netdev_dpdk_vdev_set_config(struct netdev *netdev, const struct smap *args)
+{
+    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    const char *new_devargs;
+
+    ovs_mutex_lock(&dev->mutex);
+    dpdk_set_rxq_config(dev, args);
+
+    if (!rte_eth_dev_is_valid_port(dev->port_id)) {
+        new_devargs = smap_get(args, "dpdk-devargs");
+        if (new_devargs && strlen(new_devargs)) {
+            netdev_dpdk_process_vdevargs(dev, new_devargs);
         }
     }
 
@@ -3222,6 +3263,22 @@ static const struct netdev_class dpdk_vhost_client_class 
=
         netdev_dpdk_vhost_client_reconfigure,
         netdev_dpdk_vhost_rxq_recv);
 
+static const struct netdev_class dpdk_vdev_class =
+    NETDEV_DPDK_CLASS(
+        "dpdkvdev",
+        NULL,
+        netdev_dpdk_construct,
+        netdev_dpdk_destruct,
+        netdev_dpdk_vdev_set_config,
+        netdev_dpdk_set_tx_multiq,
+        netdev_dpdk_eth_send,
+        netdev_dpdk_get_carrier,
+        netdev_dpdk_get_stats,
+        netdev_dpdk_get_features,
+        netdev_dpdk_get_status,
+        netdev_dpdk_reconfigure,
+        netdev_dpdk_rxq_recv);
+
 void
 netdev_dpdk_register(void)
 {
@@ -3229,4 +3286,5 @@ netdev_dpdk_register(void)
     netdev_register_provider(&dpdk_ring_class);
     netdev_register_provider(&dpdk_vhost_class);
     netdev_register_provider(&dpdk_vhost_client_class);
+    netdev_register_provider(&dpdk_vdev_class);
 }
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 16318c5..39c69a9 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2304,8 +2304,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.
+          For 'dpdk' ports specifies the PCI address associated with the port.
+          For 'dpdkvdev' ports specifies the the virtual driver to be used for
+          the particular port and 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.
+          Not supported by port types other than those mentioned above.
         </p>
       </column>
 
-- 
2.4.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to