net/mlx5: check VLAN push/pop support
[dpdk.git] / drivers / common / mlx5 / mlx5_common.c
index 97d3e3e..459cf4b 100644 (file)
@@ -14,7 +14,6 @@
 #include "mlx5_common.h"
 #include "mlx5_common_os.h"
 #include "mlx5_common_log.h"
-#include "mlx5_common_pci.h"
 #include "mlx5_common_private.h"
 
 uint8_t haswell_broadwell_cpu;
@@ -197,6 +196,29 @@ to_mlx5_device(const struct rte_device *rte_dev)
        return NULL;
 }
 
+int
+mlx5_dev_to_pci_str(const struct rte_device *dev, char *addr, size_t size)
+{
+       struct rte_pci_addr pci_addr = { 0 };
+       int ret;
+
+       if (mlx5_dev_is_pci(dev)) {
+               /* Input might be <BDF>, format PCI address to <DBDF>. */
+               ret = rte_pci_addr_parse(dev->name, &pci_addr);
+               if (ret != 0)
+                       return -ENODEV;
+               rte_pci_device_name(&pci_addr, addr, size);
+               return 0;
+       }
+#ifdef RTE_EXEC_ENV_LINUX
+       return mlx5_auxiliary_get_pci_str(RTE_DEV_TO_AUXILIARY_CONST(dev),
+                       addr, size);
+#else
+       rte_errno = ENODEV;
+       return -rte_errno;
+#endif
+}
+
 static void
 dev_release(struct mlx5_common_device *dev)
 {
@@ -398,6 +420,9 @@ mlx5_class_driver_register(struct mlx5_class_driver *driver)
 static void mlx5_common_driver_init(void)
 {
        mlx5_common_pci_init();
+#ifdef RTE_EXEC_ENV_LINUX
+       mlx5_common_auxiliary_init();
+#endif
 }
 
 static bool mlx5_common_initialized;