[dpdk-dev] [PATCH 4/8] common/mlx5: add glue func create flow hit action

Matan Azrad matan at nvidia.com
Thu Oct 29 22:57:57 CET 2020


From: Dekel Peled <dekelp at nvidia.com>

Add glue function to create the flow hit action using DV API,
if rdma-core support exists.

Signed-off-by: Dekel Peled <dekelp at nvidia.com>
---
 drivers/common/mlx5/linux/meson.build |  2 ++
 drivers/common/mlx5/linux/mlx5_glue.c | 16 ++++++++++++++++
 drivers/common/mlx5/linux/mlx5_glue.h |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build
index 9ef8e18..7c552a3 100644
--- a/drivers/common/mlx5/linux/meson.build
+++ b/drivers/common/mlx5/linux/meson.build
@@ -179,6 +179,8 @@ has_sym_args = [
 	[ 'HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY', 'infiniband/mlx5dv.h',
 	'mlx5dv_dr_action_create_dest_array'],
 	[ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ],
+        [ 'HAVE_MLX5DV_DR_ACTION_FLOW_HIT', 'infiniband/mlx5dv.h',
+        'mlx5dv_dr_action_create_flow_hit'],
 ]
 config = configuration_data()
 foreach arg:has_sym_args
diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c
index 4a76902..02007f6 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -1283,6 +1283,21 @@
 #endif
 }
 
+static void *
+mlx5_glue_dr_action_create_flow_hit(struct mlx5dv_devx_obj *devx_obj,
+				    uint32_t offset, uint8_t reg_c_index)
+{
+#ifdef HAVE_MLX5DV_DR_ACTION_FLOW_HIT
+	return mlx5dv_dr_action_create_flow_hit(devx_obj, offset, reg_c_index);
+#else
+	(void)(devx_obj);
+	(void)(offset);
+	(void)(reg_c_index);
+	errno = ENOTSUP;
+	return NULL;
+#endif
+}
+
 __rte_cache_aligned
 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
 	.version = MLX5_GLUE_VERSION,
@@ -1402,4 +1417,5 @@
 	.dv_free_var = mlx5_glue_dv_free_var,
 	.dv_alloc_pp = mlx5_glue_dv_alloc_pp,
 	.dv_free_pp = mlx5_glue_dv_free_pp,
+	.dr_action_create_flow_hit = mlx5_glue_dr_action_create_flow_hit,
 };
diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h
index a5e7fb3..1a50e01 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.h
+++ b/drivers/common/mlx5/linux/mlx5_glue.h
@@ -345,6 +345,9 @@ struct mlx5_glue {
 			(void *domain,
 			 size_t num_dest,
 			 struct mlx5dv_dr_action_dest_attr *dests[]);
+	void *(*dr_action_create_flow_hit)(struct mlx5dv_devx_obj *devx_obj,
+					   uint32_t offset,
+					   uint8_t reg_c_index);
 };
 
 extern const struct mlx5_glue *mlx5_glue;
-- 
1.8.3.1



More information about the dev mailing list