From: Kevin Traynor Date: Mon, 27 Nov 2017 17:25:49 +0000 (+0000) Subject: netdev-dpdk: Remove uneeded call to rte_eth_dev_count(). X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=255b7bda98974c9732c435c3d500d50e20bd728e;p=ovs.git netdev-dpdk: Remove uneeded call to rte_eth_dev_count(). 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 versions of DPDK >= 17.02 rte_eth_dev_get_port_by_name() does handle this case (DPDK commit f9ae888b1e19). rte_eth_dev_count() is no longer needed so remove it. Acked-by: Ciara Loftus Signed-off-by: Kevin Traynor Signed-off-by: Ian Stokes --- diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 3b6808ae1..29f72e9c1 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1208,8 +1208,7 @@ netdev_dpdk_process_devargs(struct netdev_dpdk *dev, char *name = xmemdup0(devargs, strcspn(devargs, ",")); 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 */ if (!rte_eth_dev_attach(devargs, &new_port_id)) { @@ -2543,8 +2542,7 @@ 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; }