[v2,02/14] common/mlx5: move description of PCI sysfs functions
Checks
Commit Message
From: Thomas Monjalon <thomas@monjalon.net>
The Linux-specific functions mlx5_get_pci_addr() and
mlx5_get_ifname_sysfs() are better described in the .h file.
The requirement for using mlx5_get_pci_addr() is explicit:
the node /device must exist in the provided sysfs path.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/common/mlx5/linux/mlx5_common_os.c | 22 ------------------
drivers/common/mlx5/mlx5_common.h | 26 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 22 deletions(-)
Comments
> -----Original Message-----
> From: Xueming(Steven) Li <xuemingl@nvidia.com>
> Sent: Tuesday, July 13, 2021 16:14
> To: Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> dev@dpdk.org; Xueming(Steven) Li <xuemingl@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>
> Subject: [PATCH v2 02/14] common/mlx5: move description of PCI sysfs
> functions
>
> From: Thomas Monjalon <thomas@monjalon.net>
>
> The Linux-specific functions mlx5_get_pci_addr() and
> mlx5_get_ifname_sysfs() are better described in the .h file.
>
> The requirement for using mlx5_get_pci_addr() is explicit:
> the node /device must exist in the provided sysfs path.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
@@ -23,17 +23,6 @@
const struct mlx5_glue *mlx5_glue;
#endif
-/**
- * Get PCI information by sysfs device path.
- *
- * @param dev_path
- * Pointer to device sysfs folder name.
- * @param[out] pci_addr
- * PCI bus address output buffer.
- *
- * @return
- * 0 on success, a negative errno value otherwise and rte_errno is set.
- */
int
mlx5_dev_to_pci_addr(const char *dev_path,
struct rte_pci_addr *pci_addr)
@@ -159,17 +148,6 @@ mlx5_translate_port_name(const char *port_name_in,
port_info_out->name_type = MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN;
}
-/**
- * Get kernel interface name from IB device path.
- *
- * @param[in] ibdev_path
- * Pointer to IB device path.
- * @param[out] ifname
- * Interface name output buffer.
- *
- * @return
- * 0 on success, a negative errno value otherwise and rte_errno is set.
- */
int
mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname)
{
@@ -204,8 +204,34 @@ check_cqe(volatile struct mlx5_cqe *cqe, const uint16_t cqes_n,
return MLX5_CQE_STATUS_SW_OWN;
}
+/*
+ * Get PCI address from sysfs of a PCI-related device.
+ *
+ * @param[in] dev_path
+ * The sysfs path should not point to the direct plain PCI device.
+ * Instead, the node "/device/" is used to access the real device.
+ * @param[out] pci_addr
+ * Parsed PCI address.
+ *
+ * @return
+ * - 0 on success.
+ * - Negative value and rte_errno is set otherwise.
+ */
__rte_internal
int mlx5_dev_to_pci_addr(const char *dev_path, struct rte_pci_addr *pci_addr);
+
+/*
+ * Get kernel network interface name from sysfs IB device path.
+ *
+ * @param[in] ibdev_path
+ * The sysfs path to IB device.
+ * @param[out] ifname
+ * Interface name output of size IF_NAMESIZE.
+ *
+ * @return
+ * - 0 on success.
+ * - Negative value and rte_errno is set otherwise.
+ */
__rte_internal
int mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname);