From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1EF30A00E6 for ; Thu, 18 Apr 2019 02:15:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B91721B8C9; Thu, 18 Apr 2019 02:15:39 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 05C281B8C2 for ; Thu, 18 Apr 2019 02:15:39 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6B55922050; Wed, 17 Apr 2019 20:15:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 17 Apr 2019 20:15:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=mesmtp; bh=1NmlPg+dn6DBKLOS5ViGRuz Hdd3medNCxPIlkgFk1+4=; b=NvuziNpBAjobMVGM2iroIOjQfeG/81tOD9lEvx8 /pFj7+qtecuw8Trv0BXKsVsrbnCP2RIlnlA8QPxgDPfPpyd7ysx8R/KldbYhr7Wg 3MTU4lyaW6ZdwrvnOhVDStR1ajZEtdP7JK64jd3V1YLJZz1Brbf/X0kYhkA9zSnl 49Ew= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=1NmlPg+dn6DBKLOS5 ViGRuzHdd3medNCxPIlkgFk1+4=; b=N4jg7glZCUh+Jb7bQ78KeM95gn3ulRR4x onTxm12XhGxaAOtYZ0nFaZ3Zovn0ZmTomCHijD2rU34ktHNsFAaWCt+uqxEIubm0 faCVyfmtw8hRmhCw/o+bjtDXzk1NU4g3k2AMTt8rBZC73Ck/05DbGnNDIVH96k9y Vccy/m7Ayay69Hfw7yOkkxcbpOyBwNJFXeou3ZQCwfCxdLqM1yGj7S4Tj8/I9UM8 aoTVfjEVFff6/6EuyiJ9ifcOU74PCCqzqauwmiY2vCCh0gANLrNuS77KtKAp710r bTNwU5TZsHfsKXv7HeadOyc5kd+gV9QC1v8AM66CWH/Ouu1rE68OA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrfeeggddvlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghsucfo ohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkphepje ejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgr shesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 23E23E40E3; Wed, 17 Apr 2019 20:15:36 -0400 (EDT) From: Thomas Monjalon To: Shahaf Shuler , Yongseok Koh Cc: dev@dpdk.org Date: Thu, 18 Apr 2019 02:15:29 +0200 Message-Id: <20190418001529.7528-1-thomas@monjalon.net> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/mlx5: replace a port lookup with ethdev API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190418001529.NJRwac2iKeCkSZWFtKeuJTkoivod2JhKzF8chZoFj0k@z> Looking for an ethdev port is better (and more efficient) with an ethdev API than an EAL one. Signed-off-by: Thomas Monjalon --- 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