Re: [ovs-dev] [PATCH] netdev-dpdk: Use rte_eth_is_valid_port instead of manual check
On 08/12/2016 05:57 PM, Ciara Loftus wrote: Signed-off-by: Ciara Loftus It is a necessary fix, specially if hotplug will be introduced. Acked-by: Mauricio Vásquez B --- lib/netdev-dpdk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 9a1f7cd..329b4ea 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -648,7 +648,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -2122,8 +2122,9 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_eth_dev_info dev_info; -if (dev->port_id < 0) +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; +} ovs_mutex_lock(&dev->mutex); rte_eth_dev_info_get(dev->port_id, &dev_info); ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] Question about other_config : pmd-cpu-mask options
Hi Junguk, On 09/08/2016 05:07 PM, Junguk Cho wrote: Hi, I used OVS with dpdk. When I started ovs, I used this option to pin some cores for ovs. sudo ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0xf000 In my setup, it has two sockets, but with this option, two cores in first socket shows 100% cpu utilization. Are you using physical ports? If yes, are they physically connected to socket1? In addition, when I created dpdk ring devices, they are created in only first socket. Does current version of OVS with dpdk support multiple sockets? Yes and not, it is supported for dpdk physical ports. Unfortunately dpdkr ports are only created in the first socket, the code should be modified to create them in other socket. Some time ago I was thinking on a solution for it, but due to DPDK limitations it is not possible to implemented it in a clean way right now. If you only need to have rings in the second socket, you just have to change the socket parameter in the call to rte_eth_from_rings(), on the other hand, if you need to have rings on both sockets it could be possible to implement a logic based on the port number, something like rings from 0 to 99 are processed in socket0 and from 100 to 199 in socket1. Of course these are just workarounds that could not be integrated in ovs. If so, are there other options to use both? Thanks, Junguk ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev Mauricio V, ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] Setting pmd-cpu-mask in cluster-on-die mode
Hello Jeremias, On 09/18/2016 05:46 PM, Jeremias Blendin wrote: Hi, I set pmd-cpu-mask on a server running its processors in cluster-on-die mode. This means, that the actual cpu topology is shown to the os as shown below. The problem I have is that although OVS is allowed to use all available CPUs: $ ovs-vsctl --no-wait get Open_vSwitch . other_config:pmd-cpu-mask "0x1787586c4fa8a01c71bc" (=python hex(int(''))) The cpu mask is calculated from a binary, so in your case if you want ovs to have access to all cores it should be 0xF... -> python hex(int('1...'), 2) OVS only uses the CPUs that are located in the first NUMA Node where the OS is running: $ ovs-appctl dpif-netdev/pmd-stats-show | grep ^pmd pmd thread numa_id 0 core_id 2: pmd thread numa_id 0 core_id 12: pmd thread numa_id 0 core_id 13: pmd thread numa_id 0 core_id 14: I restarted OVS multiple times, I tried to pin queues to specific cores: ovs-vsctl set interface dpdk0 other_config:pmd-rxq-affinity="0:2,1:12" ovs-vsctl set interface dpdk1 other_config:pmd-rxq-affinity="0:13,1:14" ovs-vsctl set interface vif3 other_config:pmd-rxq-affinity="0:3,1:3" ovs-vsctl set interface vif4 other_config:pmd-rxq-affinity="0:4,1:4" but with the same result, cores in other numa nodes are not used: /usr/local/var/log/openvswitch/ovs-vswitchd.log 2016-09-18T15:25:04.327Z|00080|dpif_netdev|INFO|Created 4 pmd threads on numa node 0 2016-09-18T15:25:04.327Z|00081|dpif_netdev|WARN|There is no PMD thread on core 3. Queue 0 on port 'vif3' will not be polled. 2016-09-18T15:25:04.327Z|00082|dpif_netdev|WARN|There is no PMD thread on core 4. Queue 0 on port 'vif4' will not be polled. 2016-09-18T15:25:04.327Z|00083|dpif_netdev|WARN|There's no available pmd thread on numa node 0 2016-09-18T15:25:04.327Z|00084|dpif_netdev|WARN|There's no available pmd thread on numa node 0 The log output seems to indicate that only numa node 0 is used for some reason? Can anyone confirm this? OVS only creates pmd threads in sockets where there are ports, in the case of physical ports the numa node is defined by where the ports are connected on the server, in the case of dpdkvhostuser ports, it is defined by where memory of the virtio device is allocated. Probably in your case physical ports and the memory of the virtio devices are on socket0. Regards, Mauricio Vasquez Best regards, Jeremias ovs-vsctl show Bridge "br0" Controller "tcp::6633" is_connected: true Port "vif0" Interface "vif0" type: dpdkvhostuser options: {n_rxq="2"} Port "dpdk1" Interface "dpdk1" type: dpdk options: {n_rxq="2"} Port "vif3" Interface "vif3" type: dpdkvhostuser options: {n_rxq="2"} Port "dpdk0" Interface "dpdk0" type: dpdk options: {n_rxq="2"} Port "vif1" Interface "vif1" type: dpdkvhostuser options: {n_rxq="2"} Port "br0" Interface "br0" type: internal Port "vif4" Interface "vif4" type: dpdkvhostuser options: {n_rxq="2"} ovs_version: "2.6.90" OVS (last commit): commit 75e2077e0c43224bcca92746b28b01a4936fc101 Author: Thadeu Lima de Souza Cascardo Date: Fri Sep 16 15:52:48 2016 -0300 CPU topology: lstopo -p Machine (252GB total) Package P#0 NUMANode P#0 (63GB) + L3 (15MB) L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#0 + PU P#0 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#2 + PU P#1 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#4 + PU P#2 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#1 + PU P#12 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#3 + PU P#13 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#5 + PU P#14 NUMANode P#1 (63GB) + L3 (15MB) L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#8 + PU P#3 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#10 + PU P#4 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#12 + PU P#5 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#9 + PU P#15 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#11 + PU P#16 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#13 + PU P#17 Package P#1 NUMANode P#2 (63GB) + L3 (15MB) L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#0 + PU P#6 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#2 + PU P#7 L2 (256KB) + L1d (32KB) + L1i (32KB) + Core P#4 +
Re: [ovs-dev] Setting pmd-cpu-mask in cluster-on-die mode
On 09/19/2016 10:28 AM, Jeremias Blendin wrote: Hello Mauricio, thank you for the pointer to the bin-to-hex conversion, I knew it looked strange but I could not see why m) In any case, it was just an example, the actual configuration for testing is correct. 2016-09-18 18:25 GMT+02:00 Mauricio Vasquez : Hello Jeremias, On 09/18/2016 05:46 PM, Jeremias Blendin wrote: Hi, I set pmd-cpu-mask on a server running its processors in cluster-on-die mode. This means, that the actual cpu topology is shown to the os as shown below. The problem I have is that although OVS is allowed to use all available CPUs: $ ovs-vsctl --no-wait get Open_vSwitch . other_config:pmd-cpu-mask "0x1787586c4fa8a01c71bc" (=python hex(int(''))) The cpu mask is calculated from a binary, so in your case if you want ovs to have access to all cores it should be 0xF... -> python hex(int('1...'), 2) OVS only uses the CPUs that are located in the first NUMA Node where the OS is running: $ ovs-appctl dpif-netdev/pmd-stats-show | grep ^pmd pmd thread numa_id 0 core_id 2: pmd thread numa_id 0 core_id 12: pmd thread numa_id 0 core_id 13: pmd thread numa_id 0 core_id 14: I restarted OVS multiple times, I tried to pin queues to specific cores: ovs-vsctl set interface dpdk0 other_config:pmd-rxq-affinity="0:2,1:12" ovs-vsctl set interface dpdk1 other_config:pmd-rxq-affinity="0:13,1:14" ovs-vsctl set interface vif3 other_config:pmd-rxq-affinity="0:3,1:3" ovs-vsctl set interface vif4 other_config:pmd-rxq-affinity="0:4,1:4" but with the same result, cores in other numa nodes are not used: /usr/local/var/log/openvswitch/ovs-vswitchd.log 2016-09-18T15:25:04.327Z|00080|dpif_netdev|INFO|Created 4 pmd threads on numa node 0 2016-09-18T15:25:04.327Z|00081|dpif_netdev|WARN|There is no PMD thread on core 3. Queue 0 on port 'vif3' will not be polled. 2016-09-18T15:25:04.327Z|00082|dpif_netdev|WARN|There is no PMD thread on core 4. Queue 0 on port 'vif4' will not be polled. 2016-09-18T15:25:04.327Z|00083|dpif_netdev|WARN|There's no available pmd thread on numa node 0 2016-09-18T15:25:04.327Z|00084|dpif_netdev|WARN|There's no available pmd thread on numa node 0 The log output seems to indicate that only numa node 0 is used for some reason? Can anyone confirm this? OVS only creates pmd threads in sockets where there are ports, in the case of physical ports the numa node is defined by where the ports are connected on the server, in the case of dpdkvhostuser ports, it is defined by where memory of the virtio device is allocated. That is an interesting point, I create the dpdkvhostuser ports with Open vSwitch: ovs-vsctl add-port br0 vif0 -- set Interface vif0 type=dpdkvhostuser How can I define which memory it should use? I don't know how can it be defined, but I found in the documentation [1] that CONFIG_RTE_LIBRTE_VHOST_NUMA=y should be set in order to automatically detect the numa node of vhostuser ports. Probably in your case physical ports and the memory of the virtio devices are on socket0. As COD is active, I have two numa nodes per socket. So yes, the VM and OVS are located on socket 0 but in different numa nodes. OVS has memory on all nodes (4G), the VM has only memory on numa node 1. However, this numa node (1) is never used by OVS, although the VM is located there. I guess I could fix this issue by deactivating COD, but this has other drawbacks. Is there any way to directly tell OVS to run pmds on a specific numa node? Not, PMDs in a numa node are only created if there are interfaces in that numa node. I understand that runnings pmds on a different socket might be an issue, but it seems weird to me that pmds cannot run on a different numa node on the same socket. Thanks! Jeremias Regards, Mauricio Vasquez Best regards, Jeremias ovs-vsctl show Bridge "br0" Controller "tcp::6633" is_connected: true Port "vif0" Interface "vif0" type: dpdkvhostuser options: {n_rxq="2"} Port "dpdk1" Interface "dpdk1" type: dpdk options: {n_rxq="2"} Port "vif3" Interface "vif3" type: dpdkvhostuser options: {n_rxq="2"} Port "dpdk0" Interface "dpdk0" type: dpdk options: {n_rxq="2"} Port "vif1" Interface "vif1" type: dpdkvhostuser options: {n_rxq="2"} Port "br0" Interface "br0" type: internal Port "vif4" Interfac
Re: [ovs-dev] Documentation for DPDK-ivshmem library
Hello abhishekb, I am not sure if you refer to ivshmem with OvS or just ivshmem, if the case is the latter it would have been more appropriated to write on the DPDK mailing list. First of all it is worthy to mention that the ivshmem library has been removed in versions > 16.07 (16.07 is the last DPDK version with ivshmem support), so you will have to use that version. I'll put some pointer to ivshmem documentation. In [1] you have a general overview of the library. [2] contains the documentation of the library that allows you to expose to the guest different DPDK data structures. [3] is the guest side implementation, this code recognizes a ivshmem device and maps all the structures exposed in it to the guest application [4] is a use case, basically this application exposes the OvS mempool and the dpdkr ports to a guest as described in [5] [1] http://dpdk.org/doc/guides/prog_guide/ivshmem_lib.html [2] http://dpdk.org/doc/api/rte__ivshmem_8h.html [3] dpdk/lib/librte_eal/linuxapp/eal/eal_ivshmem.c [4] https://github.com/netgroup-polito/un-orchestrator/blob/master/orchestrator/compute_controller/plugins/kvm-libvirt/cmdline_generator/cmdline_generator.c [5]https://github.com/openvswitch/ovs/blob/master/INSTALL.DPDK-ADVANCED.md#52-phy-vm-phy-ivshmem If you have any other questions don't hesitate in writing them here, Mauricio Vasquez. On 10/18/2016 02:43 PM, abhishekb wrote: Hello, I'm a student at IIT Bombay pursuing my Masters, I have a project related to developing an API wrapper around the ivshmem mechanism. I have searched the internet but I'm yet to find a comprehensive guide or rather any pointers towards working with DPDK-ivshmem library. It would be really helpful if you could give me some pointers on how to get started. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v4] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds an appctl command: netdev-dpdk/port-clt After the user attaches a new device, it has to be added to a bridge using the add-port command, similarly, before detaching a device it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- v4: - fix typo in commit message - remove unnecessary whitespace change in INSTALL.DPDK.md v3: - create dpdk_port_attach and dpdk_port_detach functions - modify mutex locking order v2: - use rte_eth_dev_is_valid_port() to check if a port is valid INSTALL.DPDK.md | 24 + NEWS | 1 + lib/netdev-dpdk.c | 102 ++ 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 9ec8bf6..026373d 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -227,6 +227,29 @@ Using the DPDK with ovs-vswitchd: For more details regarding egress-policer parameters please refer to the vswitch.xml. +9. Port Hotplug + + ovs supports port hotplugging, it allows to use ports that were not bound + to DPDK when vswitchd was started. + In order to attach a port, it has to be bound to DPDK using the + dpdk_nic_bind.py script: + + `$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + + Then it can be attached to OVS: + + `ovs-appctl netdev-dpdk/port-ctl attach :01:00.0` + + At this point, the user can create a ovs port using the add-port command. + + It is also possible to detach a port from ovs, the user has to remove the + port using the del-port command, then it can be detached using: + + `ovs-appctl netdev-dpdk/port-ctl detach dpdk0` + + This feature is not supported by all the NICs, please refer to the + [DPDK Port Hotplug Framework] in order to get more information. + Performance Tuning: --- @@ -959,3 +982,4 @@ Please report problems to b...@openvswitch.org. [INSTALL.md]:INSTALL.md [DPDK Linux GSG]: http://www.dpdk.org/doc/guides/linux_gsg/build_dpdk.html#binding-and-unbinding-network-ports-to-from-the-igb-uioor-vfio-modules [DPDK Docs]: http://dpdk.org/doc +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html diff --git a/NEWS b/NEWS index ea7f3a1..2ba8659 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Post-v2.5.0 assignment. * Type of log messages from PMD threads changed from INFO to DBG. * QoS functionality with sample egress-policer implementation. + * Port Hotplug is now supported. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. - ovs-appctl: diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index e09b471..cd98a2b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -599,7 +599,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -1985,6 +1985,89 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static int +dpdk_port_attach(const char * port, char * response, size_t size) +OVS_REQUIRES(dpdk_mutex) +{ +int ret; +uint8_t port_id; + +ret = rte_eth_dev_attach(port, &port_id); +if (ret < 0) { +snprintf(response, size, "Error attaching device '%s'", port); +return -1; +} + +snprintf(response, size, + "Device '%s' has been attached as 'dpdk%d'", port, port_id); +return 0; +} + +static int +dpdk_port_detach(const char * port, char * response, size_t size) +OVS_REQUIRES(dpdk_mutex) +{ +int ret; +unsigned int parsed_port; +uint8_t port_id; +char devname[RTE_ETH_NAME_MAX_LEN]; + +ret = dpdk_dev_parse_name(port, "dpdk", &parsed_port); +if (ret) { +snprintf(response, size, "'%s' is not a valid dpdk device", port); +return -1; +} + +port_id = parsed_port; + +struct netdev *netdev = netdev_from_name(port); +if (netdev) { +netdev_close(netdev); +snprintf(response, size, + "Port '%s' is being used. Remove it before detaching", port); +return -1; +} + +rte_eth_dev_close(port_id); + +ret = rte_eth_dev_detach(port_id, devname); +if (ret < 0) { +snprintf(response, size, "Port '%s' can not be detached", port); +return -1; +} + +snprintf(response, size, "Port '%s' has been detached", port); +
[ovs-dev] [PATCH v5] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds two appctl commands: netdev-dpdk/port-attach and netdev-dpdk/port-detach After the user attaches a new device, it has to be added to a bridge using the add-port command, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- v5: - use two appctl commands instead of a single one - rebase to master v4: - fix typo in commit message - remove unnecessary whitespace change in INSTALL.DPDK.md v3: - create dpdk_port_attach and dpdk_port_detach functions - modify mutex locking order v2: - use rte_eth_dev_is_valid_port() to check if a port is valid INSTALL.DPDK.md | 24 + NEWS | 1 + lib/netdev-dpdk.c | 101 ++ 3 files changed, 119 insertions(+), 7 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 93f92e4..8d5a0e0 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -267,6 +267,29 @@ Using the DPDK with ovs-vswitchd: For more details regarding egress-policer parameters please refer to the vswitch.xml. +9. Port Hotplug + + Ovs supports port hotplugging, it allows to use ports that were not bound + to DPDK when vswitchd was started. + In order to attach a port, it has to be bound to DPDK using the + dpdk_nic_bind.py script: + + `$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + + Then it can be attached to OVS: + + `ovs-appctl netdev-dpdk/port-attach :01:00.0` + + At this point, the user can create a ovs port using the add-port command. + + It is also possible to detach a port from ovs, the user has to remove the + port using the del-port command, then it can be detached using: + + `ovs-appctl netdev-dpdk/port-detach dpdk0` + + This feature is not supported by all the NICs, please refer to the + [DPDK Port Hotplug Framework] in order to get more information. + Performance Tuning: --- @@ -999,3 +1022,4 @@ Please report problems to b...@openvswitch.org. [INSTALL.md]:INSTALL.md [DPDK Linux GSG]: http://www.dpdk.org/doc/guides/linux_gsg/build_dpdk.html#binding-and-unbinding-network-ports-to-from-the-igb-uioor-vfio-modules [DPDK Docs]: http://dpdk.org/doc +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html diff --git a/NEWS b/NEWS index 4e81cad..d89d9a7 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,7 @@ Post-v2.5.0 * DB entries have been added for many of the DPDK EAL command line arguments. Additional arguments can be passed via the dpdk-extra entry. + * Port Hotplug is now supported. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. - ovs-appctl: diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index af86d19..6159a60 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -630,7 +630,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -2118,6 +2118,83 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static void +netdev_dpdk_port_attach(struct unixctl_conn *conn, int argc OVS_UNUSED, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +char response[128]; +uint8_t port_id; + +ovs_mutex_lock(&dpdk_mutex); + +ret = rte_eth_dev_attach(argv[1], &port_id); +if (ret < 0) { +snprintf(response, sizeof(response), + "Error attaching device '%s'", argv[1]); +ovs_mutex_unlock(&dpdk_mutex); +unixctl_command_reply_error(conn, response); +return; +} + +snprintf(response, sizeof(response), + "Device '%s' has been attached as 'dpdk%d'", argv[1], port_id); + +ovs_mutex_unlock(&dpdk_mutex); +unixctl_command_reply(conn, response); +} + +static void +netdev_dpdk_port_detach(struct unixctl_conn *conn, int argc OVS_UNUSED, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +char response[128]; +unsigned int parsed_port; +uint8_t port_id; +char devname[RTE_ETH_NAME_MAX_LEN]; + +ovs_mutex_lock(&dpdk_mutex); + +ret = dpdk_dev_parse_name(argv[1], "dpdk", &parsed_port); +if (ret) { +snprintf(response, sizeof(response), + "'%s' is not a valid port", argv[1]); +goto error; +} + +port_id = parsed_port; + +struct netde
[ovs-dev] [PATCH v6] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds two appctl commands: netdev-dpdk/port-attach and netdev-dpdk/port-detach After the user attaches a new device, it has to be added to a bridge using the add-port command, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B Tested-by: ian.sto...@intel.com --- v6: - add explicit comment about supporting VFIO - rebase to master v5: - use two appctl commands instead of a single one - rebase to master v4: - fix typo in commit message - remove unnecessary whitespace change in INSTALL.DPDK.md v3: - create dpdk_port_attach and dpdk_port_detach functions - modify mutex locking order v2: - use rte_eth_dev_is_valid_port() to check if a port is valid INSTALL.DPDK.md | 25 ++ NEWS | 1 + lib/netdev-dpdk.c | 101 ++ 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 68735cc..948957b 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -286,6 +286,30 @@ Using the DPDK with ovs-vswitchd: For more details regarding ingress-policer see the vswitch.xml. +10. Port Hotplug + + Ovs supports port hotplugging, it allows to use ports that were not bound + to DPDK when vswitchd was started. + In order to attach a port, it has to be bound to DPDK using the + dpdk_nic_bind.py script: + + `$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + + Then it can be attached to OVS: + + `ovs-appctl netdev-dpdk/port-attach :01:00.0` + + At this point, the user can create a ovs port using the add-port command. + + It is also possible to detach a port from ovs, the user has to remove the + port using the del-port command, then it can be detached using: + + `ovs-appctl netdev-dpdk/port-detach dpdk0` + + 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. + Performance Tuning: --- @@ -1018,3 +1042,4 @@ Please report problems to b...@openvswitch.org. [INSTALL.md]:INSTALL.md [DPDK Linux GSG]: http://www.dpdk.org/doc/guides/linux_gsg/build_dpdk.html#binding-and-unbinding-network-ports-to-from-the-igb-uioor-vfio-modules [DPDK Docs]: http://dpdk.org/doc +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html diff --git a/NEWS b/NEWS index ba201cf..4018836 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ Post-v2.5.0 arguments. Additional arguments can be passed via the dpdk-extra entry. * Add ingress policing functionality. + * Port Hotplug is now supported. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. - ovs-appctl: diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 6cae930..f5a8678 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -649,7 +649,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -2231,6 +2231,83 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static void +netdev_dpdk_port_attach(struct unixctl_conn *conn, int argc OVS_UNUSED, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +char response[128]; +uint8_t port_id; + +ovs_mutex_lock(&dpdk_mutex); + +ret = rte_eth_dev_attach(argv[1], &port_id); +if (ret < 0) { +snprintf(response, sizeof(response), + "Error attaching device '%s'", argv[1]); +ovs_mutex_unlock(&dpdk_mutex); +unixctl_command_reply_error(conn, response); +return; +} + +snprintf(response, sizeof(response), + "Device '%s' has been attached as 'dpdk%d'", argv[1], port_id); + +ovs_mutex_unlock(&dpdk_mutex); +unixctl_command_reply(conn, response); +} + +static void +netdev_dpdk_port_detach(struct unixctl_conn *conn, int argc OVS_UNUSED, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +char response[128]; +unsigned int parsed_port; +uint8_t port_id; +char devname[RTE_ETH_NAME_MAX_LEN]; + +ovs_mutex_lock(&dpdk_mutex); + +ret = dpdk_dev_parse_name(argv[1], "dpdk", &parsed_port); +if (ret) { +snprintf(response, sizeof(response), + "'%s' is not a valid port", argv[1]);
[ovs-dev] [PATCH] acinclude: fix issue when configuring with --with-dpdk
when an empty path is given to the --with-dpdk option (--with-dpdk="" or --width-dpdk=$NON_SET_ENV_VARIABLE) the configure script does not show any error and configures OvS without DPDK support, this can create some confusion. This patch modifies that behavior showing an explicity error in that case. Signed-off-by: Mauricio Vasquez B --- acinclude.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index f3de855..0a14856 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -161,10 +161,11 @@ dnl Configure DPDK source tree AC_DEFUN([OVS_CHECK_DPDK], [ AC_ARG_WITH([dpdk], [AC_HELP_STRING([--with-dpdk=/path/to/dpdk], - [Specify the DPDK build directory])]) + [Specify the DPDK build directory])], + [have_dpdk=true]) AC_MSG_CHECKING([whether dpdk datapath is enabled]) - if test -z "$with_dpdk" || test "$with_dpdk" = no; then + if test "$have_dpdk" != true || test "$with_dpdk" = no; then AC_MSG_RESULT([no]) DPDKLIB_FOUND=false else -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v7] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds two appctl commands: netdev-dpdk/port-attach and netdev-dpdk/port-detach After the user attaches a new device, it has to be added to a bridge using the add-port command, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- v7: - rebase to master v6: - add explicit comment about supporting VFIO - rebase to master v5: - use two appctl commands instead of a single one - rebase to master v4: - fix typo in commit message - remove unnecessary whitespace change in INSTALL.DPDK.md v3: - create dpdk_port_attach and dpdk_port_detach functions - modify mutex locking order v2: - use rte_eth_dev_is_valid_port() to check if a port is valid INSTALL.DPDK-ADVANCED.md | 25 NEWS | 1 + lib/netdev-dpdk.c| 101 +++ 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md index 9ae536d..61b4e82 100644 --- a/INSTALL.DPDK-ADVANCED.md +++ b/INSTALL.DPDK-ADVANCED.md @@ -12,6 +12,7 @@ OVS DPDK ADVANCED INSTALL GUIDE 7. [QOS](#qos) 8. [Rate Limiting](#rl) 9. [Vsperf](#vsperf) +10. [Port Hotplug](#hotplug) ## 1. Overview @@ -835,6 +836,29 @@ environment. More information can be found in below link. https://wiki.opnfv.org/display/vsperf/VSperf+Home +## 10. Port Hotplug + +OvS supports port hotplugging, it allows to use ports that were not bound +to DPDK when vswitchd was started. +In order to attach a port, it has to be bound to DPDK using the +dpdk_nic_bind.py script: + +`$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + +Then it can be attached to OVS: + +`ovs-appctl netdev-dpdk/port-attach :01:00.0` + +At this point, the user can create a ovs port using the add-port command. + +It is also possible to detach a port from ovs, the user has to remove the +port using the del-port command, then it can be detached using: + +`ovs-appctl netdev-dpdk/port-detach dpdk0` + +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. Bug Reporting: -- @@ -850,3 +874,4 @@ Please report problems to b...@openvswitch.org. [Guest VM using libvirt]: INSTALL.DPDK.md#ovstc [INSTALL DPDK]: INSTALL.DPDK.md#build [INSTALL OVS]: INSTALL.DPDK.md#build +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html diff --git a/NEWS b/NEWS index 6496dc1..9064225 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,7 @@ Post-v2.5.0 * PMD threads servicing vHost User ports can now come from the NUMA node that device memory is located on if CONFIG_RTE_LIBRTE_VHOST_NUMA is enabled in DPDK. + * Port Hotplug is now supported. - Increase number of registers to 16. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 85b18fd..3fab52c 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -644,7 +644,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -2172,6 +2172,83 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static void +netdev_dpdk_port_attach(struct unixctl_conn *conn, int argc OVS_UNUSED, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +char response[128]; +uint8_t port_id; + +ovs_mutex_lock(&dpdk_mutex); + +ret = rte_eth_dev_attach(argv[1], &port_id); +if (ret < 0) { +snprintf(response, sizeof(response), + "Error attaching device '%s'", argv[1]); +ovs_mutex_unlock(&dpdk_mutex); +unixctl_command_reply_error(conn, response); +return; +} + +snprintf(response, sizeof(response), + "Device '%s' has been attached as 'dpdk%d'", argv[1], port_id); + +ovs_mutex_unlock(&dpdk_mutex); +unixctl_command_reply(conn, response); +} + +static void +netdev_dpdk_port_detach(struct unixctl_conn *conn, int argc OVS_UNUSED, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +char response[128]; +unsigned int parsed_port; +uint8_t port_id; +char devname[RTE_ETH_NAME_MAX_LEN]; + +ovs_mutex_lock(&dpdk_mutex); + +ret = dpdk_dev_parse_name(argv[1], "dpdk", &
[ovs-dev] [PATCH 2/2] README: add referente to DPDK installation
there was not any reference to the DPDK installation in the main README file. Signed-off-by: Mauricio Vasquez B --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 13a132a..cf53437 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,8 @@ To use Open vSwitch... - ...without using a kernel module, read [INSTALL.userspace.md]. +- ...with DPDK, read [INSTALL.DPDK.md]. + - ...with SELinux, read [INSTALL.SELinux.md]. For answers to common questions, read [FAQ.md]. @@ -116,6 +118,7 @@ b...@openvswitch.org [INSTALL.md]:INSTALL.md [INSTALL.Debian.md]:INSTALL.Debian.md [INSTALL.Docker.md]:INSTALL.Docker.md +[INSTALL.DPDK.md]:INSTALL.DPDK.md [INSTALL.Fedora.md]:INSTALL.Fedora.md [INSTALL.KVM.md]:INSTALL.KVM.md [INSTALL.Libvirt.md]:INSTALL.Libvirt.md -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 1/2] README: add missing reference to INSTALL.SELinux.md
Signed-off-by: Mauricio Vasquez B --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 69c4912..13a132a 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ b...@openvswitch.org [INSTALL.KVM.md]:INSTALL.KVM.md [INSTALL.Libvirt.md]:INSTALL.Libvirt.md [INSTALL.RHEL.md]:INSTALL.RHEL.md +[INSTALL.SELinux.md]:INSTALL.SELinux.md [INSTALL.SSL.md]:INSTALL.SSL.md [INSTALL.userspace.md]:INSTALL.userspace.md [INSTALL.XenServer.md]:INSTALL.XenServer.md -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] ovn: make external_ids naming uniform
In some places it is called "external-ids" while in others "external_ids" is used. This commit changes it to external_ids in all of them. Signed-off-by: Mauricio Vasquez B --- ovn/controller/ovn-controller.8.xml | 12 ++-- ovn/ovn-architecture.7.xml | 8 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ovn/controller/ovn-controller.8.xml b/ovn/controller/ovn-controller.8.xml index 3fda8e7..4681b3f 100644 --- a/ovn/controller/ovn-controller.8.xml +++ b/ovn/controller/ovn-controller.8.xml @@ -159,7 +159,7 @@ Open vSwitch Database Usage - ovn-controller uses a number of external-ids + ovn-controller uses a number of external_ids keys in the Open vSwitch database to keep track of ports and interfaces. For proper operation, users should not change or clear these keys: @@ -176,7 +176,7 @@ -external-ids:ovn-localnet-port in the Port +external_ids:ovn-localnet-port in the Port table @@ -193,13 +193,13 @@ Each localnet logical port is implemented as a pair of patch ports, one in the integration bridge, one in a different - bridge, with the same external-ids:ovn-localnet-port + bridge, with the same external_ids:ovn-localnet-port value. -external-ids:ovn-l2gateway-port in the Port +external_ids:ovn-l2gateway-port in the Port table @@ -216,13 +216,13 @@ Each l2gateway logical port is implemented as a pair of patch ports, one in the integration bridge, one in a different - bridge, with the same external-ids:ovn-l2gateway-port + bridge, with the same external_ids:ovn-l2gateway-port value. -external-ids:ovn-logical-patch-port in the +external_ids:ovn-logical-patch-port in the Port table diff --git a/ovn/ovn-architecture.7.xml b/ovn/ovn-architecture.7.xml index 9c7166f..1a1bd39 100644 --- a/ovn/ovn-architecture.7.xml +++ b/ovn/ovn-architecture.7.xml @@ -447,7 +447,7 @@ where the VM is powered on, the integration between the hypervisor and Open vSwitch (described in IntegrationGuide.md) adds the VIF to the OVN integration bridge and stores vif-id in - external-ids:iface-id to indicate that the + external_ids:iface-id to indicate that the interface is an instantiation of the new VIF. (None of this code is new in OVN; this is pre-existing integration work that has already been done on hypervisors that support OVS.) @@ -455,10 +455,10 @@ On the hypervisor where the VM is powered on, ovn-controller - notices external-ids:iface-id in the new + notices external_ids:iface-id in the new Interface. In response, in the OVN Southbound DB, it updates the Binding table's chassis column for the - row that links the logical port from external-ids: + row that links the logical port from external_ids: iface-id to the hypervisor. Afterward, ovn-controller updates the local hypervisor's OpenFlow tables so that packets to and from the VIF are properly handled. @@ -632,7 +632,7 @@ parent_port column of Binding table, the ovn-controller in the hypervisor whose OVN integration bridge has that same value in vif-id in - external-ids:iface-id + external_ids:iface-id updates the local hypervisor's OpenFlow tables so that packets to and from the VIF with the particular VLAN tag are properly handled. Afterward it updates the chassis column of -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 2/2] tests/dpdk/ring_client: extend range of supported dpdkr ports
Current implementation of the ring_client test only supports until the dpdkr255 port, this patch extends it to support the full range of possible dpdkr ports. Signed-off-by: Mauricio Vasquez B --- v3: use str_to_uint tests/dpdk/ring_client.c | 46 +++--- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/tests/dpdk/ring_client.c b/tests/dpdk/ring_client.c index aeaeaca..089657a 100644 --- a/tests/dpdk/ring_client.c +++ b/tests/dpdk/ring_client.c @@ -42,6 +42,8 @@ #include #include +#include "util.h" + /* Number of packets to attempt to read from queue. */ #define PKT_READ_SIZE ((uint16_t)32) @@ -51,25 +53,21 @@ #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 -#define BASE_10 10 - /* Our client id number - tells us which rx queue to read, and tx * queue to write to. */ -static uint8_t client_id = 0; +static unsigned int client_id; /* * Given the rx queue name template above, get the queue name. */ static inline const char * -get_rx_queue_name(unsigned id) +get_rx_queue_name(unsigned int id) { -/* Buffer for return value. Size calculated by %u being replaced - * by maximum 3 digits (plus an extra byte for safety). - */ -static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2]; +/* Buffer for return value. */ +static char buffer[RTE_RING_NAMESIZE]; -snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id); +snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id); return buffer; } @@ -77,14 +75,12 @@ get_rx_queue_name(unsigned id) * Given the tx queue name template above, get the queue name. */ static inline const char * -get_tx_queue_name(unsigned id) +get_tx_queue_name(unsigned int id) { -/* Buffer for return value. Size calculated by %u being replaced - * by maximum 3 digits (plus an extra byte for safety). - */ -static char buffer[sizeof(MP_CLIENT_TXQ_NAME) + 2]; +/* Buffer for return value. */ +static char buffer[RTE_RING_NAMESIZE]; -snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_TXQ_NAME, id); +snprintf(buffer, sizeof(buffer), MP_CLIENT_TXQ_NAME, id); return buffer; } @@ -98,27 +94,15 @@ usage(const char *progname) } /* - * Convert the client id number from a string to an int. + * Convert the client id number from a string to an usigned int. */ static int parse_client_num(const char *client) { -char *end = NULL; -unsigned long temp = 0; - -if (client == NULL || *client == '\0') { +if(str_to_uint(client, 10, &client_id)) +return 0; + else return -1; -} - -temp = strtoul(client, &end, BASE_10); -/* If valid string argument is provided, terminating '/0' character - * is stored in 'end'. */ -if (end == NULL || *end != '\0') { -return -1; -} - -client_id = (uint8_t)temp; -return 0; } /* -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 1/2] lib/netdev-dpdk: make device name parsing more robust
Current implementation of dpdk_dev_parse_name does not perform a robust error handling, port names as "dpdkr" and "dpdkr1x" are considered valid. With this patch only positive port numbers in decimal notation are considered valid. Signed-off-by: Mauricio Vasquez B --- v3: - use str_to_uint lib/netdev-dpdk.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index de7e488..0fe0151 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -187,7 +187,7 @@ struct dpdk_ring { /* For the client rings */ struct rte_ring *cring_tx; struct rte_ring *cring_rx; -int user_port_id; /* User given port no, parsed from port name */ +unsigned int user_port_id; /* User given port no, parsed from port name */ int eth_port_id; /* ethernet device port id */ struct ovs_list list_node OVS_GUARDED_BY(dpdk_mutex); }; @@ -636,6 +636,8 @@ unlock: return err; } +/* dev_name must be the prefix followed by a positive decimal number. + * (no leading + or - signs are allowed) */ static int dpdk_dev_parse_name(const char dev_name[], const char prefix[], unsigned int *port_no) @@ -647,8 +649,11 @@ dpdk_dev_parse_name(const char dev_name[], const char prefix[], } cport = dev_name + strlen(prefix); -*port_no = strtol(cport, NULL, 0); /* string must be null terminated */ -return 0; + +if(str_to_uint(cport, 10, port_no)) +return 0; +else +return ENODEV; } static int -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] INSTALL.DPDK: remove issue with QEMU v2.4.0 and dpdkvhostuser
The patch mentioned in the commit e73b7508fb58 ("INSTALL.DPDK: Mention issue with QEMU v2.4.0 & dpdkvhostuser") is present in DPDK v2.2.0, then this issue is not valid anymore. Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.md | 12 1 file changed, 12 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 1fc1b66..9ec8bf6 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -950,18 +950,6 @@ Restrictions: increased to the desired number of queues. Both DPDK and OVS must be recompiled for this change to take effect. - vHost and QEMU v2.4.0+: - - For versions of QEMU v2.4.0 and later, it is currently not possible to -unbind more than one dpdkvhostuser port from the guest kernel driver -without causing the ovs-vswitchd process to crash. If this is a requirement -for your use case, it is recommended either to use a version of QEMU -between v2.2.0 and v2.3.1 (inclusive), or alternatively, to apply the -following patch to DPDK and rebuild: -http://dpdk.org/dev/patchwork/patch/7736/ -This problem will likely be resolved in Open vSwitch at a later date, when -the next release of DPDK (which includes the above patch) is available and -integrated into OVS. - Bug Reporting: -- -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [RFC] lib/netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds two appctl commands: netdev-dpdk/attach and netdev-dpdk/detach. After the user attaches a new device, it can use the add-port command to use it in a switch, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- lib/netdev-dpdk.c | 79 +++ 1 file changed, 79 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index f402354..c3a99e7 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2253,12 +2253,91 @@ dpdk_vhost_user_class_init(void) } static void +netdev_dpdk_attach(struct unixctl_conn *conn, int argc, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +uint8_t port_id; +char response[512]; + +ovs_mutex_lock(&dpdk_mutex); + +ret = rte_eth_dev_attach(argv[1], &port_id); +if(ret < 0) { +snprintf(response, sizeof(response), +"Error attaching device ''", argv[1]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +snprintf(response, sizeof(response), +"Device '%s' has been attached as 'dpdk%d'", argv[1], port_id); +unixctl_command_reply(conn, response); + +unlock: +ovs_mutex_unlock(&dpdk_mutex); +} + +static void +netdev_dpdk_detach(struct unixctl_conn *conn, int argc, +const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +unsigned int port_id; +char name[RTE_ETH_NAME_MAX_LEN]; +char response[512]; + +ret = dpdk_dev_parse_name(argv[1], "dpdk", &port_id); +if(ret) { +snprintf(response, sizeof(response), +"'%s' is not a valid dpdk device", argv[1]); +unixctl_command_reply_error(conn, response); +return; +} + +ovs_mutex_lock(&dpdk_mutex); + +struct netdev * netdev = netdev_from_name(argv[1]); +if(netdev) { +netdev_close(netdev); +snprintf(response, sizeof(response), +"Port '%s' is being used. Remove it before detaching", argv[1]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +rte_eth_dev_close(port_id); + +ret = rte_eth_dev_detach(port_id, name); +if(ret < 0) { +snprintf(response, sizeof(response), +"Port '%s' can not be detached", argv[1]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +snprintf(response, sizeof(response), "Port '%s' has been detached", argv[1]); +unixctl_command_reply(conn, response); + +unlock: +ovs_mutex_unlock(&dpdk_mutex); +} + +static void dpdk_common_init(void) { unixctl_command_register("netdev-dpdk/set-admin-state", "[netdev] up|down", 1, 2, netdev_dpdk_set_admin_state, NULL); +unixctl_command_register("netdev-dpdk/attach", + "device", 1, 1, + netdev_dpdk_attach, NULL); + +unixctl_command_register("netdev-dpdk/detach", + "port", 1, 1, + netdev_dpdk_detach, NULL); + ovs_thread_create("dpdk_watchdog", dpdk_watchdog, NULL); } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 3/3] NEWS: dpdk port hotplug is now supported
Signed-off-by: Mauricio Vasquez B --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index ea7f3a1..2ba8659 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Post-v2.5.0 assignment. * Type of log messages from PMD threads changed from INFO to DBG. * QoS functionality with sample egress-policer implementation. + * Port Hotplug is now supported. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. - ovs-appctl: -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 1/3] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds an appctl command: netdev-dpdk/port-clt After the user attaches a new device, it has to be added to a bridge using the to use the add-port command, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- lib/netdev-dpdk.c | 73 +++ 1 file changed, 73 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 7c4cd07..05fa0df 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1982,6 +1982,75 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static void +netdev_dpdk_port_ctl(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +uint8_t port_id; +unsigned int parsed_port; +char devname[RTE_ETH_NAME_MAX_LEN]; +char response[512]; + +ovs_mutex_lock(&dpdk_mutex); + +if (strcmp(argv[1], "attach") == 0) { +ret = rte_eth_dev_attach(argv[2], &port_id); +if (ret < 0) { +snprintf(response, sizeof(response), + "Error attaching device '%s'", argv[2]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +snprintf(response, sizeof(response), + "Device '%s' has been attached as 'dpdk%d'", argv[2], port_id); +unixctl_command_reply(conn, response); + +} else if (strcmp(argv[1], "detach") == 0) { +ret = dpdk_dev_parse_name(argv[2], "dpdk", &parsed_port); +if (ret) { +snprintf(response, sizeof(response), + "'%s' is not a valid dpdk device", argv[2]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +port_id = parsed_port; + +struct netdev * netdev = netdev_from_name(argv[2]); +if (netdev) { +netdev_close(netdev); +snprintf(response, sizeof(response), + "Port '%s' is being used. Remove it before detaching", + argv[2]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +rte_eth_dev_close(port_id); + +ret = rte_eth_dev_detach(port_id, devname); +if (ret < 0) { +snprintf(response, sizeof(response), + "Port '%s' can not be detached", argv[2]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +snprintf(response, sizeof(response), + "Port '%s' has been detached", argv[2]); +unixctl_command_reply(conn, response); +} else { +snprintf(response, sizeof(response), + "'%s' is not a valid argument", argv[1]); +unixctl_command_reply_error(conn, response); +} + +unlock: +ovs_mutex_unlock(&dpdk_mutex); +} + /* * Set virtqueue flags so that we do not receive interrupts. */ @@ -2262,6 +2331,10 @@ dpdk_common_init(void) "[netdev] up|down", 1, 2, netdev_dpdk_set_admin_state, NULL); +unixctl_command_register("netdev-dpdk/port-ctl", + "attach/detach device", 2, 2, + netdev_dpdk_port_ctl, NULL); + ovs_thread_create("dpdk_watchdog", dpdk_watchdog, NULL); } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 2/3] INSTALL.DPDK: add port hotplug documentation
Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.md | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 9ec8bf6..4095402 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -81,7 +81,7 @@ Using the DPDK with ovs-vswitchd: 1. Setup system boot Add the following options to the kernel bootline: - + `default_hugepagesz=1GB hugepagesz=1G hugepages=1` 2. Setup DPDK devices: @@ -227,6 +227,29 @@ Using the DPDK with ovs-vswitchd: For more details regarding egress-policer parameters please refer to the vswitch.xml. +9. Port Hotplug + + ovs supports port hotplugging, it allows to use ports that were not bound + to DPDK when vswitchd was started. + In order to attach a port, it has to be bound to DPDK using the + dpdk_nic_bind.py script: + + `$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + + Then it can be attached to OVS: + + `ovs-appctl netdev-dpdk/port-ctl attach :01:00.0` + + At this point, the user can create a ovs port using the add-port command. + + It is also possible to detach a port from ovs, the user has to remove the + port using the del-port command, then it can be detached using: + + `ovs-appctl netdev-dpdk/port-ctl detach dpdk0` + + This feature is not supported by all the NICs, please refer to the + [DPDK Port Hotplug Framework] in order to get more information. + Performance Tuning: --- @@ -959,3 +982,4 @@ Please report problems to b...@openvswitch.org. [INSTALL.md]:INSTALL.md [DPDK Linux GSG]: http://www.dpdk.org/doc/guides/linux_gsg/build_dpdk.html#binding-and-unbinding-network-ports-to-from-the-igb-uioor-vfio-modules [DPDK Docs]: http://dpdk.org/doc +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds an appctl command: netdev-dpdk/port-clt After the user attaches a new device, it has to be added to a bridge using the to use the add-port command, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.md | 26 +++- NEWS | 1 + lib/netdev-dpdk.c | 88 ++- 3 files changed, 107 insertions(+), 8 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 9ec8bf6..4095402 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -81,7 +81,7 @@ Using the DPDK with ovs-vswitchd: 1. Setup system boot Add the following options to the kernel bootline: - + `default_hugepagesz=1GB hugepagesz=1G hugepages=1` 2. Setup DPDK devices: @@ -227,6 +227,29 @@ Using the DPDK with ovs-vswitchd: For more details regarding egress-policer parameters please refer to the vswitch.xml. +9. Port Hotplug + + ovs supports port hotplugging, it allows to use ports that were not bound + to DPDK when vswitchd was started. + In order to attach a port, it has to be bound to DPDK using the + dpdk_nic_bind.py script: + + `$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + + Then it can be attached to OVS: + + `ovs-appctl netdev-dpdk/port-ctl attach :01:00.0` + + At this point, the user can create a ovs port using the add-port command. + + It is also possible to detach a port from ovs, the user has to remove the + port using the del-port command, then it can be detached using: + + `ovs-appctl netdev-dpdk/port-ctl detach dpdk0` + + This feature is not supported by all the NICs, please refer to the + [DPDK Port Hotplug Framework] in order to get more information. + Performance Tuning: --- @@ -959,3 +982,4 @@ Please report problems to b...@openvswitch.org. [INSTALL.md]:INSTALL.md [DPDK Linux GSG]: http://www.dpdk.org/doc/guides/linux_gsg/build_dpdk.html#binding-and-unbinding-network-ports-to-from-the-igb-uioor-vfio-modules [DPDK Docs]: http://dpdk.org/doc +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html diff --git a/NEWS b/NEWS index ea7f3a1..2ba8659 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Post-v2.5.0 assignment. * Type of log messages from PMD threads changed from INFO to DBG. * QoS functionality with sample egress-policer implementation. + * Port Hotplug is now supported. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. - ovs-appctl: diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index e09b471..4fcab36 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -599,7 +599,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -1985,6 +1985,75 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static void +netdev_dpdk_port_ctl(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[], void *aux OVS_UNUSED) +{ +int ret; +uint8_t port_id; +unsigned int parsed_port; +char devname[RTE_ETH_NAME_MAX_LEN]; +char response[512]; + +ovs_mutex_lock(&dpdk_mutex); + +if (strcmp(argv[1], "attach") == 0) { +ret = rte_eth_dev_attach(argv[2], &port_id); +if (ret < 0) { +snprintf(response, sizeof(response), + "Error attaching device '%s'", argv[2]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +snprintf(response, sizeof(response), + "Device '%s' has been attached as 'dpdk%d'", argv[2], port_id); +unixctl_command_reply(conn, response); + +} else if (strcmp(argv[1], "detach") == 0) { +ret = dpdk_dev_parse_name(argv[2], "dpdk", &parsed_port); +if (ret) { +snprintf(response, sizeof(response), + "'%s' is not a valid dpdk device", argv[2]); +unixctl_command_reply_error(conn, response); +goto unlock; +} + +port_id = parsed_port; + +struct netdev *netdev = netdev_from_name(argv[2]); +if (netdev) { +netdev_close(netdev); +snprintf(response, sizeof(response), + "Port '%s' is
[ovs-dev] [PATCH v3] netdev-dpdk: add hotplug support
In order to use dpdk ports in ovs they have to be bound to a DPDK compatible driver before ovs is started. This patch adds the possibility to hotplug (or hot-unplug) a device after ovs has been started. The implementation adds an appctl command: netdev-dpdk/port-clt After the user attaches a new device, it has to be added to a bridge using the to use the add-port command, similarly, before detaching a device, it has to be removed using the del-port command. Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.md | 26 +- NEWS | 1 + lib/netdev-dpdk.c | 102 ++ 3 files changed, 121 insertions(+), 8 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 9ec8bf6..4095402 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -81,7 +81,7 @@ Using the DPDK with ovs-vswitchd: 1. Setup system boot Add the following options to the kernel bootline: - + `default_hugepagesz=1GB hugepagesz=1G hugepages=1` 2. Setup DPDK devices: @@ -227,6 +227,29 @@ Using the DPDK with ovs-vswitchd: For more details regarding egress-policer parameters please refer to the vswitch.xml. +9. Port Hotplug + + ovs supports port hotplugging, it allows to use ports that were not bound + to DPDK when vswitchd was started. + In order to attach a port, it has to be bound to DPDK using the + dpdk_nic_bind.py script: + + `$DPDK_DIR/tools/dpdk_nic_bind.py --bind=igb_uio :01:00.0` + + Then it can be attached to OVS: + + `ovs-appctl netdev-dpdk/port-ctl attach :01:00.0` + + At this point, the user can create a ovs port using the add-port command. + + It is also possible to detach a port from ovs, the user has to remove the + port using the del-port command, then it can be detached using: + + `ovs-appctl netdev-dpdk/port-ctl detach dpdk0` + + This feature is not supported by all the NICs, please refer to the + [DPDK Port Hotplug Framework] in order to get more information. + Performance Tuning: --- @@ -959,3 +982,4 @@ Please report problems to b...@openvswitch.org. [INSTALL.md]:INSTALL.md [DPDK Linux GSG]: http://www.dpdk.org/doc/guides/linux_gsg/build_dpdk.html#binding-and-unbinding-network-ports-to-from-the-igb-uioor-vfio-modules [DPDK Docs]: http://dpdk.org/doc +[DPDK Port Hotplug Framework]: http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html diff --git a/NEWS b/NEWS index ea7f3a1..2ba8659 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Post-v2.5.0 assignment. * Type of log messages from PMD threads changed from INFO to DBG. * QoS functionality with sample egress-policer implementation. + * Port Hotplug is now supported. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. - ovs-appctl: diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index e09b471..cd98a2b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -599,7 +599,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) OVS_REQUIRES(dpdk_mutex) int diag; int n_rxq, n_txq; -if (dev->port_id < 0 || dev->port_id >= rte_eth_dev_count()) { +if (!rte_eth_dev_is_valid_port(dev->port_id)) { return ENODEV; } @@ -1985,6 +1985,89 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, unixctl_command_reply(conn, "OK"); } +static int +dpdk_port_attach(const char * port, char * response, size_t size) +OVS_REQUIRES(dpdk_mutex) +{ +int ret; +uint8_t port_id; + +ret = rte_eth_dev_attach(port, &port_id); +if (ret < 0) { +snprintf(response, size, "Error attaching device '%s'", port); +return -1; +} + +snprintf(response, size, + "Device '%s' has been attached as 'dpdk%d'", port, port_id); +return 0; +} + +static int +dpdk_port_detach(const char * port, char * response, size_t size) +OVS_REQUIRES(dpdk_mutex) +{ +int ret; +unsigned int parsed_port; +uint8_t port_id; +char devname[RTE_ETH_NAME_MAX_LEN]; + +ret = dpdk_dev_parse_name(port, "dpdk", &parsed_port); +if (ret) { +snprintf(response, size, "'%s' is not a valid dpdk device", port); +return -1; +} + +port_id = parsed_port; + +struct netdev *netdev = netdev_from_name(port); +if (netdev) { +netdev_close(netdev); +snprintf(response, size, + "Port '%s' is being used. Remove it before detaching", port); +return -1; +} + +rte_eth_dev_close(port_id); + +ret = rte_eth_dev_detach(port_id, devname); +if (ret < 0) { +snprintf(response, size, "Port '%s' can not be detached", port); +return -1; +} + +snprintf(response, size, "Port '%s' has been detached", port); +return 0; +} + +static
[ovs-dev] [PATCH] doc: fix bad link to dpdk advance installation guide
The link was pointing to a wrong place after the file was converted to rst. Fixes: 167703d664fc ("doc: Convert INSTALL.DPDK to rST") Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.rst | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL.DPDK.rst b/INSTALL.DPDK.rst index f09abe2..c4b9167 100644 --- a/INSTALL.DPDK.rst +++ b/INSTALL.DPDK.rst @@ -55,7 +55,7 @@ In addition to the requirements described in the `installation guide Detailed system requirements can be found at `DPDK requirements`_, while more detailed install information can be found in the `advanced installation guide -<../../INSTALL.DPDK-advanced.md>`__. +`__. .. _DPDK supported NIC: http://dpdk.org/doc/nics .. _DPDK requirements: http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html @@ -229,7 +229,7 @@ them to cores 1,2, run::: $ ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=6 For details on using ivshmem with DPDK, refer to `the advanced installation -guide <../../INSTALL.DPDK-ADVANCED.md>`__. +guide `__. Refer to ovs-vswitchd.conf.db(5) for additional information on configuration options. @@ -338,7 +338,7 @@ DPDK 'testpmd' application can be run in the Guest VM for high speed packet forwarding between vhostuser ports. DPDK and testpmd application has to be compiled on the guest VM. Below are the steps for setting up the testpmd application in the VM. More information on the vhostuser ports can be found in -the `advanced install guide <../../INSTALL.DPDK-ADVANCED.md>`__. +the `advanced install guide `__. .. note:: Support for DPDK in the guest requires QEMU >= 2.2.0. @@ -574,12 +574,12 @@ When you finish testing, bind the vNICs back to kernel::: .. note:: More information on the dpdkvhostuser ports can be found in the `advanced - installation guide <../../INSTALL.DPDK-ADVANCED.md>`__. + installation guide `__. PHY-VM-PHY (IVSHMEM loopback) ~ -Refer to the `advanced installation guide <../../INSTALL.DPDK-ADVANCED.md>`__. +Refer to the `advanced installation guide `__. Limitations -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] doc: fix duplicated colons in rst documents
Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.rst | 148 +- INSTALL.Debian.rst| 20 +-- INSTALL.Docker.rst| 76 +++--- INSTALL.KVM.rst | 24 ++-- INSTALL.Windows.rst | 136 ++ INSTALL.XenServer.rst | 32 --- INSTALL.userspace.rst | 12 +++- 7 files changed, 336 insertions(+), 112 deletions(-) diff --git a/INSTALL.DPDK.rst b/INSTALL.DPDK.rst index c4b9167..5780909 100644 --- a/INSTALL.DPDK.rst +++ b/INSTALL.DPDK.rst @@ -66,7 +66,9 @@ Installing DPDK -1. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``::: +1. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``: + +:: $ cd /usr/src/ $ wget http://dpdk.org/browse/dpdk/snapshot/dpdk-16.07.zip @@ -76,13 +78,17 @@ DPDK 2. Configure and install DPDK - Build and install the DPDK library::: + Build and install the DPDK library: + +:: $ export DPDK_TARGET=x86_64-native-linuxapp-gcc $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET $ make install T=$DPDK_TARGET DESTDIR=install - If IVSHMEM support is required, use a different target::: + If IVSHMEM support is required, use a different target: + +:: $ export DPDK_TARGET=x86_64-ivshmem-linuxapp-gcc @@ -106,7 +112,9 @@ has to be configured with DPDK support (``--with-dpdk``). 2. Bootstrap, if required, as described in the `installation guide `__. -3. Configure the package using the ``--with-dpdk`` flag::: +3. Configure the package using the ``--with-dpdk`` flag: + +:: $ ./configure --with-dpdk=$DPDK_BUILD @@ -132,19 +140,27 @@ Setup Hugepages Allocate a number of 2M Huge pages: - For persistent allocation of huge pages, write to hugepages.conf file - in `/etc/sysctl.d`::: + in `/etc/sysctl.d`: + +:: $ echo 'vm.nr_hugepages=2048' > /etc/sysctl.d/hugepages.conf -- For run-time allocation of huge pages, use the ``sysctl`` utility::: +- For run-time allocation of huge pages, use the ``sysctl`` utility: + +:: $ sysctl -w vm.nr_hugepages=N # where N = No. of 2M huge pages -To verify hugepage configuration::: +To verify hugepage configuration: + +:: $ grep HugePages_ /proc/meminfo -Mount the hugepages, if not already mounted by default::: +Mount the hugepages, if not already mounted by default: + +:: $ mount -t hugetlbfs none /dev/hugepages`` @@ -157,13 +173,17 @@ VFIO is prefered to the UIO driver when using recent versions of DPDK. VFIO support required support from both the kernel and BIOS. For the former, kernel version > 3.6 must be used. For the latter, you must enable VT-d in the BIOS and ensure this is configured via grub. To ensure VT-d is enabled via the BIOS, -run::: +run: + +:: $ dmesg | grep -e DMAR -e IOMMU If VT-d is not enabled in the BIOS, enable it now. -To ensure VT-d is enabled in the kernel, run::: +To ensure VT-d is enabled in the kernel, run: + +:: $ cat /proc/cmdline | grep iommu=pt $ cat /proc/cmdline | grep intel_iommu=on @@ -171,7 +191,9 @@ To ensure VT-d is enabled in the kernel, run::: If VT-d is not enabled in the kernel, enable it now. Once VT-d is correctly configured, load the required modules and bind the NIC -to the VFIO driver::: +to the VFIO driver: + +:: $ modprobe vfio-pci $ /usr/bin/chmod a+x /dev/vfio @@ -187,7 +209,9 @@ Open vSwitch should be started as described in the `installation guide special configuration to enable DPDK functionality. DPDK configuration arguments can be passed to ovs-vswitchd via the ``other_config`` column of the ``Open_vSwitch`` table. At a minimum, the ``dpdk-init`` option must be set to -``true``. For example::: +``true``. For example: + +:: $ export DB_SOCK=/usr/local/var/run/openvswitch/db.sock $ ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true @@ -216,7 +240,9 @@ listed below. Defaults will be provided for all values not explicitly set. If allocating more than one GB hugepage (as for IVSHMEM), you can configure the amount of memory used from any given NUMA nodes. For example, to use 1GB from -NUMA node 0, run::: +NUMA node 0, run: + +:: $ ovs-vsctl --no-wait set Open_vSwitch . \ other_config:dpdk-socket-mem="1024,0" @@ -224,7 +250,9 @@ NUMA node 0, run::: Similarly, if you wish to better scale the workloads across cores, then multiple pmd threads can be created and pinned to CPU cores by explicity specifying ``pmd-cpu-mask``. For example, to spawn two pmd threads and pin -them to cores 1,2, run::: +them to cores 1,2, run: + +:: $ ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=6 @@ -245,33 +273,43 @@ Creating bridges and ports ~~ You can now use ovs-vsctl to set up bridges and other Open vSwitch features. -Bridges should be created with a ``datapath
[ovs-dev] [PATCH v2] doc: v2: fix bad link to dpdk advance installation guide
Previous fix was also wrong. Fixes: 167703d ("doc: Convert INSTALL.DPDK to rST") Signed-off-by: Mauricio Vasquez B --- INSTALL.DPDK.rst | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL.DPDK.rst b/INSTALL.DPDK.rst index 5780909..4ca9b27 100644 --- a/INSTALL.DPDK.rst +++ b/INSTALL.DPDK.rst @@ -55,7 +55,7 @@ In addition to the requirements described in the `installation guide Detailed system requirements can be found at `DPDK requirements`_, while more detailed install information can be found in the `advanced installation guide -`__. +`__. .. _DPDK supported NIC: http://dpdk.org/doc/nics .. _DPDK requirements: http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html @@ -257,7 +257,7 @@ them to cores 1,2, run: $ ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=6 For details on using ivshmem with DPDK, refer to `the advanced installation -guide `__. +guide `__. Refer to ovs-vswitchd.conf.db(5) for additional information on configuration options. @@ -386,7 +386,7 @@ DPDK 'testpmd' application can be run in the Guest VM for high speed packet forwarding between vhostuser ports. DPDK and testpmd application has to be compiled on the guest VM. Below are the steps for setting up the testpmd application in the VM. More information on the vhostuser ports can be found in -the `advanced install guide `__. +the `advanced install guide `__. .. note:: Support for DPDK in the guest requires QEMU >= 2.2.0. @@ -648,12 +648,12 @@ When you finish testing, bind the vNICs back to kernel: .. note:: More information on the dpdkvhostuser ports can be found in the `advanced - installation guide `__. + installation guide `__. PHY-VM-PHY (IVSHMEM loopback) ~ -Refer to the `advanced installation guide `__. +Refer to the `advanced installation guide `__. Limitations -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2] doc: fix duplicated colons in rst documents
Signed-off-by: Mauricio Vasquez B --- FAQ.rst | 106 +- INSTALL.DPDK.rst | 74 +-- INSTALL.Debian.rst| 10 ++--- INSTALL.Docker.rst| 38 +- INSTALL.KVM.rst | 12 +++--- INSTALL.Windows.rst | 68 INSTALL.XenServer.rst | 16 INSTALL.userspace.rst | 6 +-- 8 files changed, 165 insertions(+), 165 deletions(-) diff --git a/FAQ.rst b/FAQ.rst index 4ee4c2b..d250c28 100644 --- a/FAQ.rst +++ b/FAQ.rst @@ -276,7 +276,7 @@ Q: What DPDK version does each Open vSwitch release work with? 2.6.x16.07 = -Q: I get an error like this when I configure Open vSwitch::: +Q: I get an error like this when I configure Open vSwitch:: configure: error: Linux kernel in is version , but version newer than is not supported (please refer to the @@ -479,7 +479,7 @@ Q: How do I configure a DPDK port as an access port? startup when other_config:dpdk-init is set to 'true'. Secondly, when adding a DPDK port, unlike a system port, the type for the -interface must be specified. For example::: +interface must be specified. For example:: $ ovs-vsctl add-br br0 $ ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk @@ -546,7 +546,7 @@ Q: How do I configure mirroring of all traffic to a GRE tunnel? A: The following commands configure br0 with eth0 and tap0 as trunk ports. All traffic coming in or going out on eth0 or tap0 is also mirrored to gre0, a GRE tunnel to the remote host 192.168.1.10; any traffic arriving on -gre0 is dropped::: +gre0 is dropped:: $ ovs-vsctl add-br br0 $ ovs-vsctl add-port br0 eth0 @@ -557,7 +557,7 @@ Q: How do I configure mirroring of all traffic to a GRE tunnel? -- --id=@m create mirror name=m0 select-all=true output-port=@p \ -- set bridge br0 mirrors=@m -To later disable mirroring and destroy the GRE tunnel::: +To later disable mirroring and destroy the GRE tunnel:: $ ovs-vsctl clear bridge br0 mirrors $ ovs-vsctl del-port br0 gre0 @@ -720,7 +720,7 @@ Configuration Problems -- Q: I created a bridge and added my Ethernet port to it, using commands like -these::: +these:: ovs-vsctl add-br br0 ovs-vsctl add-port br0 eth0 @@ -735,7 +735,7 @@ eth0. Help! You can restore functionality by moving the IP address to an Open vSwitch "internal" device, such as the network device named after the bridge itself. For example, assuming that eth0's IP address is 192.168.128.5, you -could run the commands below to fix up the situation::: +could run the commands below to fix up the situation:: $ ifconfig eth0 0.0.0.0 $ ifconfig br0 192.168.128.5 @@ -763,7 +763,7 @@ eth0. Help! applies to all network devices except Open vSwitch "internal" devices. Q: I created a bridge and added a couple of Ethernet ports to it, using -commands like these::: +commands like these:: $ ovs-vsctl add-br br0 $ ovs-vsctl add-port br0 eth0 @@ -785,7 +785,7 @@ very high. - If you added eth0 and eth1 to get higher bandwidth or higher reliability between OVS and your physical Ethernet switch, use a bond. The following - commands create br0 and then add eth0 and eth1 as a bond::: + commands create br0 and then add eth0 and eth1 as a bond:: $ ovs-vsctl add-br br0 $ ovs-vsctl add-bond br0 bond0 eth0 eth1 @@ -814,7 +814,7 @@ very high. prevent loops, turn on spanning tree protocol (STP). The following commands create br0, enable STP, and add eth0 and eth1 to the bridge. The order is important because you don't want have to have a loop in your - network even transiently::: + network even transiently:: $ ovs-vsctl add-br br0 $ ovs-vsctl set bridge br0 stp_enable=true @@ -898,7 +898,7 @@ Q: Open vSwitch does not seem to obey my packet filter rules. Q: It seems that Open vSwitch does nothing when I removed a port and then immediately put it back. For example, consider that p1 is a port of -``type=internal``::: +``type=internal``:: $ ovs-vsctl del-port br0 p1 -- \ add-port br0 p1 -- \ @@ -917,7 +917,7 @@ immediately put it back. For example, consider that p1 is a port of corresponding interface, you need to separate operations into multiple OVSDB transactions and ensure that at least the first one does not have ``--no-wait``. In the following example, the first ovs-vsctl will block -until Open vSwitch reloads the new configuration and removes the port::: +until Open vSwitch reloads the new configuration and removes the port:: $ ovs-vsctl del-port br0 p1 $ ovs-vsctl add-port br0 p1 -
[ovs-dev] [PATCH] lib/netdev-dpdk: increase ring name length for dpdkr ports
A ring name length of 10 characters is not enough for dpdkr ports starting from dpdkr10, then it is increased to 20 characters. Signed-off-by: Mauricio Vasquez B --- lib/netdev-dpdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index b209df2..60c4262 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1921,7 +1921,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, unsigned int *eth_port_id) { struct dpdk_ring *ivshmem; -char ring_name[10]; +char ring_name[20]; int err; ivshmem = dpdk_rte_mzalloc(sizeof *ivshmem); @@ -1930,7 +1930,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, } /* XXX: Add support for multiquque ring. */ -err = snprintf(ring_name, 10, "%s_tx", dev_name); +err = snprintf(ring_name, sizeof(ring_name), "%s_tx", dev_name); if (err < 0) { return -err; } @@ -1943,7 +1943,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, return ENOMEM; } -err = snprintf(ring_name, 10, "%s_rx", dev_name); +err = snprintf(ring_name, sizeof(ring_name), "%s_rx", dev_name); if (err < 0) { return -err; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2] lib/netdev-dpdk: increase ring name length for dpdkr ports
A ring name length of 10 characters is not enough for dpdkr ports starting from dpdkr10, then it is increased to RTE_RING_NAMESIZE characters. Signed-off-by: Mauricio Vasquez B --- v2: - Use RTE_RING_NAMESIZE instead of a numerical constant. lib/netdev-dpdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index b209df2..90512aa 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1921,7 +1921,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, unsigned int *eth_port_id) { struct dpdk_ring *ivshmem; -char ring_name[10]; +char ring_name[RTE_RING_NAMESIZE]; int err; ivshmem = dpdk_rte_mzalloc(sizeof *ivshmem); @@ -1930,7 +1930,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, } /* XXX: Add support for multiquque ring. */ -err = snprintf(ring_name, 10, "%s_tx", dev_name); +err = snprintf(ring_name, sizeof(ring_name), "%s_tx", dev_name); if (err < 0) { return -err; } @@ -1943,7 +1943,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, return ENOMEM; } -err = snprintf(ring_name, 10, "%s_rx", dev_name); +err = snprintf(ring_name, sizeof(ring_name), "%s_rx", dev_name); if (err < 0) { return -err; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 2/3] tests/dpdk/ring_client: extend range of supported dpdkr ports
Current implementation allows to support only until the dpdkr255 port, this patch extends it to support the full range of possible dpdkr ports. Signed-off-by: Mauricio Vasquez B --- tests/dpdk/ring_client.c | 43 ++- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/dpdk/ring_client.c b/tests/dpdk/ring_client.c index aeaeaca..9ccec4f 100644 --- a/tests/dpdk/ring_client.c +++ b/tests/dpdk/ring_client.c @@ -33,6 +33,9 @@ */ #include +#include +#include +#include #include #include @@ -56,20 +59,18 @@ /* Our client id number - tells us which rx queue to read, and tx * queue to write to. */ -static uint8_t client_id = 0; +static unsigned int client_id; /* * Given the rx queue name template above, get the queue name. */ static inline const char * -get_rx_queue_name(unsigned id) +get_rx_queue_name(unsigned int id) { -/* Buffer for return value. Size calculated by %u being replaced - * by maximum 3 digits (plus an extra byte for safety). - */ -static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2]; +/* Buffer for return value. */ +static char buffer[RTE_RING_NAMESIZE]; -snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id); +snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id); return buffer; } @@ -77,14 +78,12 @@ get_rx_queue_name(unsigned id) * Given the tx queue name template above, get the queue name. */ static inline const char * -get_tx_queue_name(unsigned id) +get_tx_queue_name(unsigned int id) { -/* Buffer for return value. Size calculated by %u being replaced - * by maximum 3 digits (plus an extra byte for safety). - */ -static char buffer[sizeof(MP_CLIENT_TXQ_NAME) + 2]; +/* Buffer for return value. */ +static char buffer[RTE_RING_NAMESIZE]; -snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_TXQ_NAME, id); +snprintf(buffer, sizeof(buffer), MP_CLIENT_TXQ_NAME, id); return buffer; } @@ -98,7 +97,7 @@ usage(const char *progname) } /* - * Convert the client id number from a string to an int. + * Convert the client id number from a string to an usigned int. */ static int parse_client_num(const char *client) @@ -110,14 +109,24 @@ parse_client_num(const char *client) return -1; } -temp = strtoul(client, &end, BASE_10); +errno = 0; +temp = strtol(client, &end, BASE_10); + +if(errno != 0) { +return -1; +} + /* If valid string argument is provided, terminating '/0' character * is stored in 'end'. */ -if (end == NULL || *end != '\0') { +if(end == NULL || *end != '\0' || end == client) { +return -1; +} + +if(temp > UINT_MAX) { return -1; } -client_id = (uint8_t)temp; +client_id = (unsigned int)temp; return 0; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 1/3] lib/netdev-dpdk: make device name parsing more robust
Current implementation of dpdk_dev_parse_name does not perform a robust error handling, port names as "dpdkr" or "dpdkr1x" are considered valid. Signed-off-by: Mauricio Vasquez B --- lib/netdev-dpdk.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index de7e488..ac81f2f 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -187,7 +188,7 @@ struct dpdk_ring { /* For the client rings */ struct rte_ring *cring_tx; struct rte_ring *cring_rx; -int user_port_id; /* User given port no, parsed from port name */ +unsigned int user_port_id; /* User given port no, parsed from port name */ int eth_port_id; /* ethernet device port id */ struct ovs_list list_node OVS_GUARDED_BY(dpdk_mutex); }; @@ -641,13 +642,30 @@ dpdk_dev_parse_name(const char dev_name[], const char prefix[], unsigned int *port_no) { const char *cport; +unsigned long port; +char *endptr; if (strncmp(dev_name, prefix, strlen(prefix))) { return ENODEV; } +errno = 0; cport = dev_name + strlen(prefix); -*port_no = strtol(cport, NULL, 0); /* string must be null terminated */ +port = strtol(cport, &endptr, 10); + +if(errno != 0) { +return errno; +} + +if(endptr == NULL || *endptr != '\0' || endptr == cport) { +return ENODEV; +} + +if(port > UINT_MAX) { +return ENODEV; +} + +*port_no = port; return 0; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 3/3] lib/netdev-dpdk: increase ring name length for dpdkr ports
A ring name length of 10 characters is not enough for dpdkr ports starting from dpdkr10, then it is increased to RTE_RING_NAMESIZE characters. Signed-off-by: Mauricio Vasquez B --- lib/netdev-dpdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ac81f2f..7caa70c 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1939,7 +1939,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, unsigned int *eth_port_id) { struct dpdk_ring *ivshmem; -char ring_name[10]; +char ring_name[RTE_RING_NAMESIZE]; int err; ivshmem = dpdk_rte_mzalloc(sizeof *ivshmem); @@ -1948,7 +1948,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, } /* XXX: Add support for multiquque ring. */ -err = snprintf(ring_name, 10, "%s_tx", dev_name); +err = snprintf(ring_name, sizeof(ring_name), "%s_tx", dev_name); if (err < 0) { return -err; } @@ -1961,7 +1961,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, return ENOMEM; } -err = snprintf(ring_name, 10, "%s_rx", dev_name); +err = snprintf(ring_name, sizeof(ring_name), "%s_rx", dev_name); if (err < 0) { return -err; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2 2/2] tests/dpdk/ring_client: extend range of supported dpdkr ports
Current implementation of the ring_client test only supports up to the dpdkr255 port, this patch extends it to support the full range of possible dpdkr ports. Signed-off-by: Mauricio Vasquez B --- v2: - replace strtol by strtoul Thanks to Aaron Conole! tests/dpdk/ring_client.c | 44 +++- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tests/dpdk/ring_client.c b/tests/dpdk/ring_client.c index aeaeaca..d02c60b 100644 --- a/tests/dpdk/ring_client.c +++ b/tests/dpdk/ring_client.c @@ -33,6 +33,10 @@ */ #include +#include +#include +#include +#include #include #include @@ -56,20 +60,18 @@ /* Our client id number - tells us which rx queue to read, and tx * queue to write to. */ -static uint8_t client_id = 0; +static unsigned int client_id; /* * Given the rx queue name template above, get the queue name. */ static inline const char * -get_rx_queue_name(unsigned id) +get_rx_queue_name(unsigned int id) { -/* Buffer for return value. Size calculated by %u being replaced - * by maximum 3 digits (plus an extra byte for safety). - */ -static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2]; +/* Buffer for return value. */ +static char buffer[RTE_RING_NAMESIZE]; -snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id); +snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id); return buffer; } @@ -77,14 +79,12 @@ get_rx_queue_name(unsigned id) * Given the tx queue name template above, get the queue name. */ static inline const char * -get_tx_queue_name(unsigned id) +get_tx_queue_name(unsigned int id) { -/* Buffer for return value. Size calculated by %u being replaced - * by maximum 3 digits (plus an extra byte for safety). - */ -static char buffer[sizeof(MP_CLIENT_TXQ_NAME) + 2]; +/* Buffer for return value. */ +static char buffer[RTE_RING_NAMESIZE]; -snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_TXQ_NAME, id); +snprintf(buffer, sizeof(buffer), MP_CLIENT_TXQ_NAME, id); return buffer; } @@ -98,7 +98,7 @@ usage(const char *progname) } /* - * Convert the client id number from a string to an int. + * Convert the client id number from a string to an usigned int. */ static int parse_client_num(const char *client) @@ -106,18 +106,28 @@ parse_client_num(const char *client) char *end = NULL; unsigned long temp = 0; -if (client == NULL || *client == '\0') { +if (client == NULL || !isdigit(client[0])) { return -1; } +errno = 0; temp = strtoul(client, &end, BASE_10); + +if(errno != 0) { +return -1; +} + /* If valid string argument is provided, terminating '/0' character * is stored in 'end'. */ -if (end == NULL || *end != '\0') { +if(end == NULL || *end != '\0' || end == client) { +return -1; +} + +if(temp > UINT_MAX) { return -1; } -client_id = (uint8_t)temp; +client_id = (unsigned int)temp; return 0; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2 1/2] lib/netdev-dpdk: make device name parsing more robust
Current implementation of dpdk_dev_parse_name does not perform a robust error handling, port names as "dpdkr", "dpdkr1x", "dpdkr 5" are considered valid. With this path only positive port numbers in decimal notation are considered valid. Signed-off-by: Mauricio Vasquez B --- v2: - replace strtol by strtoul - more strict parsing, ports as "dpdr 5" are now not valid. Thanks to Aaron Conole! lib/netdev-dpdk.c | 30 -- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index de7e488..5d09230 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -18,7 +18,9 @@ #include #include +#include #include +#include #include #include #include @@ -187,7 +189,7 @@ struct dpdk_ring { /* For the client rings */ struct rte_ring *cring_tx; struct rte_ring *cring_rx; -int user_port_id; /* User given port no, parsed from port name */ +unsigned int user_port_id; /* User given port no, parsed from port name */ int eth_port_id; /* ethernet device port id */ struct ovs_list list_node OVS_GUARDED_BY(dpdk_mutex); }; @@ -636,18 +638,42 @@ unlock: return err; } +/* dev_name must be the prefix followed by a positive decimal number. + * (no leading + or - signs are allowed) */ static int dpdk_dev_parse_name(const char dev_name[], const char prefix[], unsigned int *port_no) { const char *cport; +unsigned long port; +char *endptr; if (strncmp(dev_name, prefix, strlen(prefix))) { return ENODEV; } +errno = 0; cport = dev_name + strlen(prefix); -*port_no = strtol(cport, NULL, 0); /* string must be null terminated */ + +if(!isdigit(cport[0])) { +return ENODEV; +} + +port = strtoul(cport, &endptr, 10); + +if(errno != 0) { +return errno; +} + +if(endptr == NULL || *endptr != '\0' || endptr == cport) { +return ENODEV; +} + +if(port > UINT_MAX) { +return ENODEV; +} + +*port_no = port; return 0; } -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] netdev-dpdk: assume dpdkr peer can be multi-producer/consumer
Although netdev does explicit locking, it is only valid from the ovs perspective, then only the ring ends used by ovs should be declared as single producer/consumer. The other ends that are used by the application should be declared as multiple producer/consumer that is the most general case. Signed-off-by: Mauricio Vasquez B --- lib/netdev-dpdk.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 4658416..e3a0771 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1931,9 +1931,9 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, return -err; } -/* Create single consumer/producer rings, netdev does explicit locking. */ +/* Create single producer tx ring, netdev does explicit locking. */ ivshmem->cring_tx = rte_ring_create(ring_name, DPDK_RING_SIZE, SOCKET0, -RING_F_SP_ENQ | RING_F_SC_DEQ); +RING_F_SP_ENQ); if (ivshmem->cring_tx == NULL) { rte_free(ivshmem); return ENOMEM; @@ -1944,9 +1944,9 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, return -err; } -/* Create single consumer/producer rings, netdev does explicit locking. */ +/* Create single consumer rx ring, netdev does explicit locking. */ ivshmem->cring_rx = rte_ring_create(ring_name, DPDK_RING_SIZE, SOCKET0, -RING_F_SP_ENQ | RING_F_SC_DEQ); +RING_F_SC_DEQ); if (ivshmem->cring_rx == NULL) { rte_free(ivshmem); return ENOMEM; -- 1.9.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev