From: Michael Baum Date: Wed, 24 Jun 2020 13:23:57 +0000 (+0000) Subject: net/mlx5: use direct API to find port by device X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a294e58c80a8c012d064247b1b242604ba6042a9;p=dpdk.git net/mlx5: use direct API to find port by device Using RTE_ETH_FOREACH_DEV_OF loop is not necessary when the driver wants to find only the first match. Use rte_eth_find_next_of to find it. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index adbe07c4c7..3b781b68ae 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -313,9 +313,10 @@ pci_dev_to_eth_dev(struct rte_pci_device *pdev) { uint16_t port_id; - RTE_ETH_FOREACH_DEV_OF(port_id, &pdev->device) - return &rte_eth_devices[port_id]; - return NULL; + port_id = rte_eth_find_next_of(0, &pdev->device); + if (port_id == RTE_MAX_ETHPORTS) + return NULL; + return &rte_eth_devices[port_id]; } /**