Skip to content

Commit

Permalink
netdev-dpdk: Use rte_eth_is_valid_port instead of manual check
Browse files Browse the repository at this point in the history
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Mauricio Vásquez B <mauricio.vasquez@polito.it>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
  • Loading branch information
cloftus authored and ddiproietto committed Aug 15, 2016
1 parent c59b72b commit 7cd1261
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/netdev-dpdk.c
Expand Up @@ -701,7 +701,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;
}

Expand Down Expand Up @@ -2160,8 +2160,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);
Expand Down

0 comments on commit 7cd1261

Please sign in to comment.