net/mlx5: add Linux-specific header file
authorOphir Munk <ophirmu@mellanox.com>
Wed, 3 Jun 2020 15:06:01 +0000 (15:06 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jun 2020 17:21:07 +0000 (19:21 +0200)
File drivers/net/linux/mlx5_os.h is added. It includes specific
Linux definitions such as PCI driver flags, link state changes
interrupts, link removal interrupts, etc.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
drivers/net/mlx5/Makefile
drivers/net/mlx5/linux/mlx5_os.h [new file with mode: 0644]
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5.h

index 115b66c..41ab73e 100644 (file)
@@ -41,6 +41,7 @@ CFLAGS += -g
 CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5
 CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5/linux
 CFLAGS += -I$(RTE_SDK)/drivers/net/mlx5
+CFLAGS += -I$(RTE_SDK)/drivers/net/mlx5/linux
 CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5
 CFLAGS += -D_BSD_SOURCE
 CFLAGS += -D_DEFAULT_SOURCE
diff --git a/drivers/net/mlx5/linux/mlx5_os.h b/drivers/net/mlx5/linux/mlx5_os.h
new file mode 100644 (file)
index 0000000..f310f17
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2015 6WIND S.A.
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#ifndef RTE_PMD_MLX5_OS_H_
+#define RTE_PMD_MLX5_OS_H_
+
+/* verb enumerations translations to local enums. */
+enum {
+       DEV_SYSFS_NAME_MAX = IBV_SYSFS_NAME_MAX,
+       DEV_SYSFS_PATH_MAX = IBV_SYSFS_PATH_MAX
+};
+
+#define PCI_DRV_FLAGS  (RTE_PCI_DRV_INTR_LSC | \
+                       RTE_PCI_DRV_INTR_RMV | \
+                       RTE_PCI_DRV_PROBE_AGAIN)
+#endif /* RTE_PMD_MLX5_OS_H_ */
index f62ad12..16ab8b0 100644 (file)
@@ -2114,8 +2114,7 @@ struct rte_pci_driver mlx5_driver = {
        .remove = mlx5_pci_remove,
        .dma_map = mlx5_dma_map,
        .dma_unmap = mlx5_dma_unmap,
-       .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV |
-                    RTE_PCI_DRV_PROBE_AGAIN,
+       .drv_flags = PCI_DRV_FLAGS,
 };
 
 /**
index f5d9aad..eca4472 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "mlx5_defs.h"
 #include "mlx5_utils.h"
+#include "mlx5_os.h"
 #include "mlx5_autoconf.h"
 
 enum mlx5_ipool_index {
@@ -536,8 +537,8 @@ struct mlx5_dev_ctx_shared {
        void *pd; /* Protection Domain. */
        uint32_t pdn; /* Protection Domain number. */
        uint32_t tdn; /* Transport Domain number. */
-       char ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */
-       char ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for secondary */
+       char ibdev_name[DEV_SYSFS_NAME_MAX]; /* SYSFS dev name. */
+       char ibdev_path[DEV_SYSFS_PATH_MAX]; /* SYSFS dev path for secondary */
        struct mlx5_dev_attr device_attr; /* Device properties. */
        LIST_ENTRY(mlx5_dev_ctx_shared) mem_event_cb;
        /**< Called by memory event callback. */