diff mbox series

[1/2] common/mlx5: add glue function for duplicate rule ability

Message ID 20210528132524.32451-1-jiaweiw@nvidia.com (mailing list archive)
State Superseded
Delegated to: Raslan Darawsheh
Headers show
Series [1/2] common/mlx5: add glue function for duplicate rule ability | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jiawei(Jonny) Wang May 28, 2021, 1:25 p.m. UTC
Add glue function to update the duplicate rule allow/disallow
through rdma-core DV API.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 drivers/common/mlx5/linux/meson.build |  2 ++
 drivers/common/mlx5/linux/mlx5_glue.c | 12 ++++++++++++
 drivers/common/mlx5/linux/mlx5_glue.h |  1 +
 3 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build
index 007834a49b..c0bfab1f33 100644
--- a/drivers/common/mlx5/linux/meson.build
+++ b/drivers/common/mlx5/linux/meson.build
@@ -191,6 +191,8 @@  has_sym_args = [
             'mlx5dv_dump_dr_rule' ],
         [ 'HAVE_MLX5_DR_ACTION_ASO_CT', 'infiniband/mlx5dv.h',
             'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ],
+    	[ 'HAVE_MLX5_DR_ALLOW_DUPLICATE', 'infiniband/mlx5dv.h',
+    	'mlx5dv_dr_domain_allow_duplicate_rules' ],
 ]
 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 d3bd645a5b..145cf83fd9 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -1321,6 +1321,17 @@  mlx5_glue_dv_alloc_pp(struct ibv_context *context,
 #endif
 }
 
+static void
+mlx5_glue_dr_allow_duplicate_rules(void *domain, uint32_t allow)
+{
+#ifdef HAVE_MLX5_DR_ALLOW_DUPLICATE
+	mlx5dv_dr_domain_allow_duplicate_rules(domain, allow);
+#else
+	(void)(allow);
+	(void)(domain);
+#endif
+}
+
 static void
 mlx5_glue_dv_free_pp(struct mlx5dv_pp *pp)
 {
@@ -1441,6 +1452,7 @@  const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
 		mlx5_glue_dr_create_flow_action_sampler,
 	.dr_create_flow_action_dest_array =
 		mlx5_glue_dr_action_create_dest_array,
+	.dr_allow_duplicate_rules = mlx5_glue_dr_allow_duplicate_rules,
 	.devx_query_eqn = mlx5_glue_devx_query_eqn,
 	.devx_create_event_channel = mlx5_glue_devx_create_event_channel,
 	.devx_destroy_event_channel = mlx5_glue_devx_destroy_event_channel,
diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h
index 97462e9ab8..56246bca18 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.h
+++ b/drivers/common/mlx5/linux/mlx5_glue.h
@@ -336,6 +336,7 @@  struct mlx5_glue {
 			 struct mlx5dv_devx_async_event_hdr *event_data,
 			 size_t event_resp_len);
 	void (*dr_reclaim_domain_memory)(void *domain, uint32_t enable);
+	void (*dr_allow_duplicate_rules)(void *domain, uint32_t allow);
 	struct mlx5dv_pp *(*dv_alloc_pp)(struct ibv_context *context,
 					 size_t pp_context_sz,
 					 const void *pp_context,