From 75a9a73ddbdd3e7581078752aadb1c980617e739 Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Thu, 25 Feb 2021 10:44:58 +0000 Subject: [PATCH] common/mlx5/linux: add glue function to query WQ When Rx queue is created by VERBS API ibv_create_wq there is a dedicated rdma-core API to query an information about this WQ(Work Queue). VERBS WQ querying is needed for PMD cases which combine VERBS objects with DevX objects. Next feature to use this glue function is the HW queue counters. Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/mlx5_glue.c | 18 ++++++++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 8146c79287..964f7e74ef 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -1067,6 +1067,23 @@ mlx5_glue_devx_qp_query(struct ibv_qp *qp, #endif } +static int +mlx5_glue_devx_wq_query(struct ibv_wq *wq, const void *in, size_t inlen, + void *out, size_t outlen) +{ +#ifdef HAVE_IBV_DEVX_QP + return mlx5dv_devx_wq_query(wq, in, inlen, out, outlen); +#else + (void)wq; + (void)in; + (void)inlen; + (void)out; + (void)outlen; + errno = ENOTSUP; + return errno; +#endif +} + static int mlx5_glue_devx_port_query(struct ibv_context *ctx, uint32_t port_num, @@ -1403,6 +1420,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .devx_umem_reg = mlx5_glue_devx_umem_reg, .devx_umem_dereg = mlx5_glue_devx_umem_dereg, .devx_qp_query = mlx5_glue_devx_qp_query, + .devx_wq_query = mlx5_glue_devx_wq_query, .devx_port_query = mlx5_glue_devx_port_query, .dr_dump_domain = mlx5_glue_dr_dump_domain, .dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory, diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index 8be446a902..9e385be957 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -307,6 +307,8 @@ struct mlx5_glue { int (*devx_qp_query)(struct ibv_qp *qp, const void *in, size_t inlen, void *out, size_t outlen); + int (*devx_wq_query)(struct ibv_wq *wq, const void *in, size_t inlen, + void *out, size_t outlen); int (*devx_port_query)(struct ibv_context *ctx, uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port); -- 2.20.1