net/mlx5: add Direct Verbs driver to glue
authorOri Kam <orika@mellanox.com>
Mon, 24 Sep 2018 23:17:51 +0000 (23:17 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:53:49 +0000 (18:53 +0200)
This commit adds all Direct Verbs required functions to the glue lib.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
drivers/net/mlx5/Makefile
drivers/net/mlx5/meson.build
drivers/net/mlx5/mlx5_glue.c
drivers/net/mlx5/mlx5_glue.h

index d510a42..4243b37 100644 (file)
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_mlx5.a
 LIB_GLUE = $(LIB_GLUE_BASE).$(LIB_GLUE_VERSION)
 LIB_GLUE_BASE = librte_pmd_mlx5_glue.so
-LIB_GLUE_VERSION = 18.05.0
+LIB_GLUE_VERSION = 18.11.0
 
 # Sources.
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5.c
index 8075496..3d09ece 100644 (file)
@@ -4,7 +4,7 @@
 
 pmd_dlopen = get_option('enable_driver_mlx_glue')
 LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
-LIB_GLUE_VERSION = '18.05.0'
+LIB_GLUE_VERSION = '18.11.0'
 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
 if pmd_dlopen
        dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1)
index 84f9492..48590df 100644 (file)
@@ -346,6 +346,48 @@ mlx5_glue_dv_create_qp(struct ibv_context *context,
 #endif
 }
 
+static struct mlx5dv_flow_matcher *
+mlx5_glue_dv_create_flow_matcher(struct ibv_context *context,
+                                struct mlx5dv_flow_matcher_attr *matcher_attr)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       return mlx5dv_create_flow_matcher(context, matcher_attr);
+#else
+       (void)context;
+       (void)matcher_attr;
+       return NULL;
+#endif
+}
+
+static struct ibv_flow *
+mlx5_glue_dv_create_flow(struct mlx5dv_flow_matcher *matcher,
+                        struct mlx5dv_flow_match_parameters *match_value,
+                        size_t num_actions,
+                        struct mlx5dv_flow_action_attr *actions_attr)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       return mlx5dv_create_flow(matcher, match_value,
+                                 num_actions, actions_attr);
+#else
+       (void)matcher;
+       (void)match_value;
+       (void)num_actions;
+       (void)actions_attr;
+       return NULL;
+#endif
+}
+
+static int
+mlx5_glue_dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *matcher)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       return mlx5dv_destroy_flow_matcher(matcher);
+#else
+       (void)matcher;
+       return 0;
+#endif
+}
+
 alignas(RTE_CACHE_LINE_SIZE)
 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
        .version = MLX5_GLUE_VERSION,
@@ -392,4 +434,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
        .dv_set_context_attr = mlx5_glue_dv_set_context_attr,
        .dv_init_obj = mlx5_glue_dv_init_obj,
        .dv_create_qp = mlx5_glue_dv_create_qp,
+       .dv_create_flow_matcher = mlx5_glue_dv_create_flow_matcher,
+       .dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher,
+       .dv_create_flow = mlx5_glue_dv_create_flow,
 };
index e584d36..f6e4e38 100644 (file)
@@ -39,6 +39,13 @@ struct mlx5dv_qp_init_attr;
 struct mlx5dv_wq_init_attr;
 #endif
 
+#ifndef HAVE_IBV_FLOW_DV_SUPPORT
+struct mlx5dv_flow_matcher;
+struct mlx5dv_flow_matcher_attr;
+struct mlx5dv_flow_action_attr;
+struct mlx5dv_flow_match_parameters;
+#endif
+
 /* LIB_GLUE_VERSION must be updated every time this structure is modified. */
 struct mlx5_glue {
        const char *version;
@@ -122,6 +129,14 @@ struct mlx5_glue {
                (struct ibv_context *context,
                 struct ibv_qp_init_attr_ex *qp_init_attr_ex,
                 struct mlx5dv_qp_init_attr *dv_qp_init_attr);
+       struct mlx5dv_flow_matcher *(*dv_create_flow_matcher)
+               (struct ibv_context *context,
+                struct mlx5dv_flow_matcher_attr *matcher_attr);
+       int (*dv_destroy_flow_matcher)(struct mlx5dv_flow_matcher *matcher);
+       struct ibv_flow *(*dv_create_flow)(struct mlx5dv_flow_matcher *matcher,
+                         struct mlx5dv_flow_match_parameters *match_value,
+                         size_t num_actions,
+                         struct mlx5dv_flow_action_attr *actions_attr);
 };
 
 const struct mlx5_glue *mlx5_glue;