[ovs-dev] [PATCH] netdev-dpdk: Remove uneeded call to rte_eth_dev_count().

Kevin Traynor ktraynor at redhat.com
Mon Nov 27 15:30:29 UTC 2017


The call to rte_eth_dev_count() was added as workaround
for rte_eth_dev_get_port_by_name() not handling cases
when there was no DPDK ports. In recent versions of DPDK,
rte_eth_dev_get_port_by_name() does handle this
case, so the rte_eth_dev_count() call can be removed.

CC: Ciara Loftus <ciara.loftus at intel.com>
Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
---
 lib/netdev-dpdk.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index faff842..0436ff0 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1192,6 +1192,5 @@ netdev_dpdk_process_devargs(struct netdev_dpdk *dev,
     dpdk_port_t new_port_id = DPDK_ETH_PORT_ID_INVALID;
 
-    if (!rte_eth_dev_count()
-            || rte_eth_dev_get_port_by_name(name, &new_port_id)
+    if (rte_eth_dev_get_port_by_name(name, &new_port_id)
             || !rte_eth_dev_is_valid_port(new_port_id)) {
         /* Device not found in DPDK, attempt to attach it */
@@ -2526,6 +2525,5 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc OVS_UNUSED,
     ovs_mutex_lock(&dpdk_mutex);
 
-    if (!rte_eth_dev_count() || rte_eth_dev_get_port_by_name(argv[1],
-                                                             &port_id)) {
+    if (rte_eth_dev_get_port_by_name(argv[1], &port_id)) {
         response = xasprintf("Device '%s' not found in DPDK", argv[1]);
         goto error;
-- 
1.8.3.1



More information about the dev mailing list