Skip to content

Commit fd3af5e

Browse files
chiarameiohasrleon
authored andcommitted
RDMA/mlx5: Track DCT, DCI and REG_UMR QPs as diver_detail resources.
Allow user to see driver-specific QPs (the "driver_detail" QPs) through the rdmatool, when requested. When creating DCT, DCI and REG_UMR QPs, we designate them as driver_detail resources. When filling the QP info for the rdma tool, for the driver_detail QPs: -the QP type is IB_QPT_DRIVER -the subtype is a string with the QP name ("DCT", "DCI", "REG_UMR") Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com> Link: https://lore.kernel.org/r/452432d7d0917f053a80a893a614169857fe3b10.1713268997.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent e18fa0b commit fd3af5e

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3097,7 +3097,6 @@ static int create_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
30973097
switch (qp->type) {
30983098
case MLX5_IB_QPT_DCT:
30993099
err = create_dct(dev, pd, qp, params);
3100-
rdma_restrack_no_track(&qp->ibqp.res);
31013100
break;
31023101
case MLX5_IB_QPT_DCI:
31033102
err = create_dci(dev, pd, qp, params);
@@ -3109,9 +3108,9 @@ static int create_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
31093108
err = mlx5_ib_create_gsi(pd, qp, params->attr);
31103109
break;
31113110
case MLX5_IB_QPT_HW_GSI:
3112-
case MLX5_IB_QPT_REG_UMR:
31133111
rdma_restrack_no_track(&qp->ibqp.res);
31143112
fallthrough;
3113+
case MLX5_IB_QPT_REG_UMR:
31153114
default:
31163115
if (params->udata)
31173116
err = create_user_qp(dev, pd, qp, params);

drivers/infiniband/hw/mlx5/restrack.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,34 @@ static int fill_res_cq_entry_raw(struct sk_buff *msg, struct ib_cq *ibcq)
156156
return fill_res_raw(msg, dev, MLX5_SGMT_TYPE_PRM_QUERY_CQ, cq->mcq.cqn);
157157
}
158158

159+
static int fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ibqp)
160+
{
161+
struct mlx5_ib_qp *qp = to_mqp(ibqp);
162+
int ret;
163+
164+
if (qp->type < IB_QPT_DRIVER)
165+
return 0;
166+
167+
switch (qp->type) {
168+
case MLX5_IB_QPT_REG_UMR:
169+
ret = nla_put_string(msg, RDMA_NLDEV_ATTR_RES_SUBTYPE,
170+
"REG_UMR");
171+
break;
172+
case MLX5_IB_QPT_DCT:
173+
ret = nla_put_string(msg, RDMA_NLDEV_ATTR_RES_SUBTYPE, "DCT");
174+
break;
175+
case MLX5_IB_QPT_DCI:
176+
ret = nla_put_string(msg, RDMA_NLDEV_ATTR_RES_SUBTYPE, "DCI");
177+
break;
178+
default:
179+
return 0;
180+
}
181+
if (ret)
182+
return ret;
183+
184+
return nla_put_u8(msg, RDMA_NLDEV_ATTR_RES_TYPE, IB_QPT_DRIVER);
185+
}
186+
159187
static int fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ibqp)
160188
{
161189
struct mlx5_ib_dev *dev = to_mdev(ibqp->device);
@@ -168,6 +196,7 @@ static const struct ib_device_ops restrack_ops = {
168196
.fill_res_cq_entry_raw = fill_res_cq_entry_raw,
169197
.fill_res_mr_entry = fill_res_mr_entry,
170198
.fill_res_mr_entry_raw = fill_res_mr_entry_raw,
199+
.fill_res_qp_entry = fill_res_qp_entry,
171200
.fill_res_qp_entry_raw = fill_res_qp_entry_raw,
172201
.fill_stat_mr_entry = fill_stat_mr_entry,
173202
};

0 commit comments

Comments
 (0)