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 <thomas@monjalon.net> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
This commit is contained in:
parent
af4a86d446
commit
2ed187ba07
@ -1310,16 +1310,10 @@ mlx5_mr_update_ext_mp_cb(struct rte_mempool *mp, void *opaque,
|
|||||||
static struct rte_eth_dev *
|
static struct rte_eth_dev *
|
||||||
pci_dev_to_eth_dev(struct rte_pci_device *pdev)
|
pci_dev_to_eth_dev(struct rte_pci_device *pdev)
|
||||||
{
|
{
|
||||||
struct rte_dev_iterator it;
|
uint16_t port_id;
|
||||||
struct rte_device *dev;
|
|
||||||
|
|
||||||
/**
|
RTE_ETH_FOREACH_DEV_OF(port_id, &pdev->device)
|
||||||
* We really need to iterate all devices regardless of
|
return &rte_eth_devices[port_id];
|
||||||
* their owner.
|
|
||||||
*/
|
|
||||||
RTE_DEV_FOREACH(dev, "class=eth", &it)
|
|
||||||
if (dev == &pdev->device)
|
|
||||||
return it.class_device;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user