From: Thomas Monjalon <thomas@monjalon.net>
To: Shahaf Shuler <shahafs@mellanox.com>, Yongseok Koh <yskoh@mellanox.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx5: replace a port lookup with ethdev API
Date: Thu, 18 Apr 2019 02:15:29 +0200 [thread overview]
Message-ID: <20190418001529.7528-1-thomas@monjalon.net> (raw)
Message-ID: <20190418001529.NJRwac2iKeCkSZWFtKeuJTkoivod2JhKzF8chZoFj0k@z> (raw)
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
next reply other threads:[~2019-04-18 0:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 0:15 Thomas Monjalon [this message]
2019-04-18 0:15 ` Thomas Monjalon
2019-04-22 17:46 ` Shahaf Shuler
2019-04-22 17:46 ` Shahaf Shuler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190418001529.7528-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=shahafs@mellanox.com \
--cc=yskoh@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).