#include <rte_pci.h>
#include <rte_debug.h>
#include <rte_atomic.h>
+#include <rte_rwlock.h>
#include <rte_log.h>
#include <rte_kvargs.h>
#include <rte_devargs.h>
/* Reported driver name. */
#define MLX5_PCI_DRIVER_NAME "mlx5_pci"
+#define MLX5_AUXILIARY_DRIVER_NAME "mlx5_auxiliary"
/* Bit-field manipulation. */
#define BITFIELD_DECLARE(bf, type, size) \
int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \
char name[mkstr_size_##name + 1]; \
\
+ memset(name, 0, mkstr_size_##name + 1); \
snprintf(name, sizeof(name), "" __VA_ARGS__)
enum {
return MLX5_CQE_STATUS_SW_OWN;
}
+/*
+ * Get PCI address <DBDF> string from EAL device.
+ *
+ * @param[out] addr
+ * The output address buffer string
+ * @param[in] size
+ * The output buffer size
+ * @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);
+int mlx5_dev_to_pci_str(const struct rte_device *dev, char *addr, size_t size);
+
+/*
+ * 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_get_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);
+__rte_internal
+int mlx5_auxiliary_get_child_name(const char *dev, const char *node,
+ char *child, size_t size);
enum mlx5_class {
MLX5_CLASS_INVALID,