mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 08:15:25 +00:00
netdev-dpdk: Add support for virtual DPDK PMDs (vdevs)
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.loftus@intel.com> Acked-by: Stephen Finucane <stephen@that.guru> # docs only Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
committed by
Daniele Di Proietto
parent
55e075e65e
commit
69876ed786
@@ -324,6 +324,35 @@ This feature is not supported with VFIO and does 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:
|
||||
|
||||
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
|
||||
|
||||
Similarly, to add a dpdk port that uses the 'af_packet' DPDK PMD driver::
|
||||
|
||||
$ ovs-vsctl add-port br0 myeth0 -- set Interface myeth0 type=dpdk \
|
||||
options:dpdk-devargs=eth_af_packet0,iface=eth0
|
||||
|
||||
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.
|
||||
|
||||
.. _dpdk-ovs-in-guest:
|
||||
|
||||
OVS with DPDK Inside VMs
|
||||
|
1
NEWS
1
NEWS
@@ -61,6 +61,7 @@ Post-v2.6.0
|
||||
with the old dpdk<portid> naming scheme is broken, and as such a
|
||||
device will not be available for use until a valid dpdk-devargs is
|
||||
specified.
|
||||
* Virtual DPDK Poll Mode Driver (vdev PMD) support.
|
||||
- Fedora packaging:
|
||||
* A package upgrade does not automatically restart OVS service.
|
||||
- ovs-vswitchd/ovs-vsctl:
|
||||
|
@@ -1134,25 +1134,19 @@ netdev_dpdk_lookup_by_port_id(int port_id)
|
||||
static int
|
||||
netdev_dpdk_process_devargs(const char *devargs)
|
||||
{
|
||||
struct rte_pci_addr addr;
|
||||
uint8_t new_port_id = UINT8_MAX;
|
||||
|
||||
if (!eal_parse_pci_DomBDF(devargs, &addr)) {
|
||||
/* Valid PCI address format detected - configure physical device */
|
||||
if (!rte_eth_dev_count()
|
||||
|| rte_eth_dev_get_port_by_name(devargs, &new_port_id)
|
||||
|| !rte_eth_dev_is_valid_port(new_port_id)) {
|
||||
/* PCI device not found in DPDK, attempt to attach it */
|
||||
if (!rte_eth_dev_attach(devargs, &new_port_id)) {
|
||||
/* Attach successful */
|
||||
VLOG_INFO("Device "PCI_PRI_FMT" has been attached to DPDK",
|
||||
addr.domain, addr.bus, addr.devid, addr.function);
|
||||
} else {
|
||||
/* Attach unsuccessful */
|
||||
VLOG_INFO("Error attaching device "PCI_PRI_FMT" to DPDK",
|
||||
addr.domain, addr.bus, addr.devid, addr.function);
|
||||
return -1;
|
||||
}
|
||||
if (!rte_eth_dev_count()
|
||||
|| rte_eth_dev_get_port_by_name(devargs, &new_port_id)
|
||||
|| !rte_eth_dev_is_valid_port(new_port_id)) {
|
||||
/* Device not found in DPDK, attempt to attach it */
|
||||
if (!rte_eth_dev_attach(devargs, &new_port_id)) {
|
||||
/* Attach successful */
|
||||
VLOG_INFO("Device '%s' attached to DPDK", devargs);
|
||||
} else {
|
||||
/* Attach unsuccessful */
|
||||
VLOG_INFO("Error attaching device '%s' to DPDK", devargs);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2460,17 +2454,10 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc OVS_UNUSED,
|
||||
char *response;
|
||||
uint8_t port_id;
|
||||
char devname[RTE_ETH_NAME_MAX_LEN];
|
||||
struct rte_pci_addr addr;
|
||||
struct netdev_dpdk *dev;
|
||||
|
||||
ovs_mutex_lock(&dpdk_mutex);
|
||||
|
||||
if (eal_parse_pci_DomBDF(argv[1], &addr)) {
|
||||
response = xasprintf("Invalid PCI address '%s'. Cannot detach.",
|
||||
argv[1]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!rte_eth_dev_count() || rte_eth_dev_get_port_by_name(argv[1],
|
||||
&port_id)) {
|
||||
response = xasprintf("Device '%s' not found in DPDK", argv[1]);
|
||||
|
@@ -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_<driver_name><x> 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>
|
||||
|
||||
|
Reference in New Issue
Block a user