DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: replace a port lookup with ethdev API
@ 2019-04-18  0:15 Thomas Monjalon
  2019-04-18  0:15 ` Thomas Monjalon
  2019-04-22 17:46 ` Shahaf Shuler
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Monjalon @ 2019-04-18  0:15 UTC (permalink / raw)
  To: Shahaf Shuler, Yongseok Koh; +Cc: dev

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>
---
 drivers/net/mlx5/mlx5_mr.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 44b65916d..8f35cb2d8 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;
 }
 
-- 
2.21.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-22 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  0:15 [dpdk-dev] [PATCH] net/mlx5: replace a port lookup with ethdev API Thomas Monjalon
2019-04-18  0:15 ` Thomas Monjalon
2019-04-22 17:46 ` Shahaf Shuler
2019-04-22 17:46   ` Shahaf Shuler

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).