DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: use direct API to find port by device
@ 2020-06-24 13:23 Michael Baum
  0 siblings, 0 replies; only message in thread
From: Michael Baum @ 2020-06-24 13:23 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo

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 <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_mr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index adbe07c..3b781b6 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -313,9 +313,10 @@ struct mr_update_mp_data {
 {
 	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];
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-24 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 13:23 [dpdk-dev] [PATCH] net/mlx5: use direct API to find port by device Michael Baum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).