On 08/12/2016 05:57 PM, Ciara Loftus wrote:
Signed-off-by: Ciara Loftus <ciara.lof...@intel.com>
It is a necessary fix, specially if hotplug will be introduced.
Acked-by: Mauricio Vásquez B <mauricio.vasq...@polito.it>
---
  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

Reply via email to