In rdma-core, the "mlx5dv_dr_domain_sync" function was already
provided. It is used to flush the rule submission queue. The wrapper
function in the glue layer is added for using this.
It only supports DR flows right now the same as domain creating and
destroying functions.

Signed-off-by: Bing Zhao <bi...@nvidia.com>
Acked-by: Ori Kam <or...@nvidia.com>
---
 drivers/common/mlx5/linux/mlx5_glue.c | 14 ++++++++++++++
 drivers/common/mlx5/linux/mlx5_glue.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/common/mlx5/linux/mlx5_glue.c 
b/drivers/common/mlx5/linux/mlx5_glue.c
index 47b7e98..4a76902 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -494,6 +494,19 @@
 #endif
 }
 
+static int
+mlx5_glue_dr_sync_domain(void *domain, uint32_t flags)
+{
+#ifdef HAVE_MLX5DV_DR
+       return mlx5dv_dr_domain_sync(domain, flags);
+#else
+       (void)domain;
+       (void)flags;
+       errno = ENOTSUP;
+       return errno;
+#endif
+}
+
 static struct ibv_cq_ex *
 mlx5_glue_dv_create_cq(struct ibv_context *context,
                       struct ibv_cq_init_attr_ex *cq_attr,
@@ -1331,6 +1344,7 @@
        .dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
        .dr_create_domain = mlx5_glue_dr_create_domain,
        .dr_destroy_domain = mlx5_glue_dr_destroy_domain,
+       .dr_sync_domain = mlx5_glue_dr_sync_domain,
        .dv_create_cq = mlx5_glue_dv_create_cq,
        .dv_create_wq = mlx5_glue_dv_create_wq,
        .dv_query_device = mlx5_glue_dv_query_device,
diff --git a/drivers/common/mlx5/linux/mlx5_glue.h 
b/drivers/common/mlx5/linux/mlx5_glue.h
index 42b2f61..a5e7fb3 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.h
+++ b/drivers/common/mlx5/linux/mlx5_glue.h
@@ -224,6 +224,7 @@ struct mlx5_glue {
        void *(*dr_create_domain)(struct ibv_context *ctx,
                                  enum mlx5dv_dr_domain_type domain);
        int (*dr_destroy_domain)(void *domain);
+       int (*dr_sync_domain)(void *domain, uint32_t flags);
        struct ibv_cq_ex *(*dv_create_cq)
                (struct ibv_context *context,
                 struct ibv_cq_init_attr_ex *cq_attr,
-- 
1.8.3.1

Reply via email to