Skip to content

Commit

Permalink
netdev-dpdk: Remove uneeded call to rte_eth_dev_count().
Browse files Browse the repository at this point in the history
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 f9ae888).
rte_eth_dev_count() is no longer needed so remove it.

Acked-by: Ciara Loftus <[email protected]>
Signed-off-by: Kevin Traynor <[email protected]>
Signed-off-by: Ian Stokes <[email protected]>
  • Loading branch information
kevintraynor authored and istokes committed Dec 8, 2017
1 parent b2e72a9 commit 255b7bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 255b7bd

Please sign in to comment.