From: Thomas Monjalon Date: Thu, 18 Apr 2019 00:15:29 +0000 (+0200) Subject: net/mlx5: replace a port lookup with ethdev API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2ed187ba072a4d5ccb8ce95698be62938724b704;p=dpdk.git net/mlx5: replace a port lookup with ethdev API Looking for an ethdev port is better (and more efficient) with an ethdev API than an EAL one. Signed-off-by: Thomas Monjalon Acked-by: Shahaf Shuler --- diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index a3732d47c5..e4957a4506 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -1310,16 +1310,10 @@ mlx5_mr_update_ext_mp_cb(struct rte_mempool *mp, void *opaque, static struct rte_eth_dev * pci_dev_to_eth_dev(struct rte_pci_device *pdev) { - struct rte_dev_iterator it; - struct rte_device *dev; + uint16_t port_id; - /** - * We really need to iterate all devices regardless of - * their owner. - */ - RTE_DEV_FOREACH(dev, "class=eth", &it) - if (dev == &pdev->device) - return it.class_device; + RTE_ETH_FOREACH_DEV_OF(port_id, &pdev->device) + return &rte_eth_devices[port_id]; return NULL; }