DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
To: dev@dpdk.org
Cc: matan@mellanox.com, rasland@mellanox.com
Subject: [dpdk-dev] [PATCH 02/12] net/mlx5: update PCI address retrieving routine
Date: Wed, 25 Sep 2019 07:53:25 +0000	[thread overview]
Message-ID: <1569398015-6027-3-git-send-email-viacheslavo@mellanox.com> (raw)
In-Reply-To: <1569398015-6027-1-git-send-email-viacheslavo@mellanox.com>

The routine mlx5_ibv_device_to_pci_addr() takes Infiniband
device list object, takes the device sysfs path from there
and retrieves PCI address. The routine may be implemented
in more generic way by taking sysfs path directly as parameter
and can be used for getting PCI address of netdevs.

The generic routine is renamed to mlx5_dev_to_pci_addr()

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5.c        |  3 ++-
 drivers/net/mlx5/mlx5.h        |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c | 12 ++++++------
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b4096a4..dd8159c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -2184,7 +2184,8 @@ struct mlx5_dev_spawn_data {
 		struct rte_pci_addr pci_addr;
 
 		DRV_LOG(DEBUG, "checking device \"%s\"", ibv_list[ret]->name);
-		if (mlx5_ibv_device_to_pci_addr(ibv_list[ret], &pci_addr))
+		if (mlx5_dev_to_pci_addr
+			(ibv_list[ret]->ibdev_path, &pci_addr))
 			continue;
 		if (pci_dev->addr.domain != pci_addr.domain ||
 		    pci_dev->addr.bus != pci_addr.bus ||
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index f45d627..9a3fd36 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -701,8 +701,8 @@ int mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev,
 			   struct rte_eth_fc_conf *fc_conf);
 int mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev,
 			   struct rte_eth_fc_conf *fc_conf);
-int mlx5_ibv_device_to_pci_addr(const struct ibv_device *device,
-				struct rte_pci_addr *pci_addr);
+int mlx5_dev_to_pci_addr(const char *dev_path,
+			 struct rte_pci_addr *pci_addr);
 void mlx5_dev_link_status_handler(void *arg);
 void mlx5_dev_interrupt_handler(void *arg);
 void mlx5_dev_interrupt_handler_devx(void *arg);
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index ad53721..71f63ac 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1131,10 +1131,10 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)
 }
 
 /**
- * Get PCI information from struct ibv_device.
+ * Get PCI information by sysfs device path.
  *
- * @param device
- *   Pointer to Ethernet device structure.
+ * @param dev_path
+ *   Pointer to device sysfs folder name.
  * @param[out] pci_addr
  *   PCI bus address output buffer.
  *
@@ -1142,12 +1142,12 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_ibv_device_to_pci_addr(const struct ibv_device *device,
-			    struct rte_pci_addr *pci_addr)
+mlx5_dev_to_pci_addr(const char *dev_path,
+		     struct rte_pci_addr *pci_addr)
 {
 	FILE *file;
 	char line[32];
-	MKSTR(path, "%s/device/uevent", device->ibdev_path);
+	MKSTR(path, "%s/device/uevent", dev_path);
 
 	file = fopen(path, "rb");
 	if (file == NULL) {
-- 
1.8.3.1


  parent reply	other threads:[~2019-09-25  7:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25  7:53 [dpdk-dev] [PATCH 00/12] net/mlx5: add bonding configuration support Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 01/12] net/mlx5: move backing PCI device to private context Viacheslav Ovsiienko
2019-09-25  7:53 ` Viacheslav Ovsiienko [this message]
2019-09-25  7:53 ` [dpdk-dev] [PATCH 03/12] net/mlx5: allocate device list explicitly Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 04/12] net/mlx5: add VF LAG mode bonding device recognition Viacheslav Ovsiienko
2019-09-30 10:34   ` Ferruh Yigit
2019-10-01  9:02     ` Slava Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 05/12] net/mlx5: generate bonding device name Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 06/12] net/mlx5: check the kernel support for VF LAG bonding Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 07/12] net/mlx5: query vport index match mode and parameters Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 08/12] net/mlx5: elaborate E-Switch port parameters query Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 09/12] net/mlx5: update source and destination vport translations Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 10/12] net/mlx5: extend switch domain searching range Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 11/12] net/mlx5: update switch port ID in bonding configuration Viacheslav Ovsiienko
2019-09-25  7:53 ` [dpdk-dev] [PATCH 12/12] net/mlx5: check sibling device configurations mismatch Viacheslav Ovsiienko
2019-09-25 10:29 ` [dpdk-dev] [PATCH 00/12] net/mlx5: add bonding configuration support Matan Azrad
2019-09-29 11:47 ` Raslan Darawsheh

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=1569398015-6027-3-git-send-email-viacheslavo@mellanox.com \
    --to=viacheslavo@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=rasland@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).