Skip to content

Commit c1336bb

Browse files
PatrisiousHaddadrleon
authored andcommitted
IB/mlx5: Fix rdma counter binding for RAW QP
Previously when we had a RAW QP, we bound a counter to it when it moved to INIT state, using the counter context inside RQC. But when we try to modify that counter later in RTS state we used modify QP which tries to change the counter inside QPC instead of RQC. Now we correctly modify the counter set_id inside of RQC instead of QPC for the RAW QP. Fixes: d14133d ("IB/mlx5: Support set qp counter") Signed-off-by: Patrisious Haddad <phaddad@nvidia.com> Reviewed-by: Mark Zhang <markzhang@nvidia.com> Link: https://lore.kernel.org/r/2e5ab6713784a8fe997d19c508187a0dfecf2dfc.1696847964.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 5ac388d commit c1336bb

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

  • drivers/infiniband/hw/mlx5

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4045,6 +4045,30 @@ static unsigned int get_tx_affinity(struct ib_qp *qp,
40454045
return tx_affinity;
40464046
}
40474047

4048+
static int __mlx5_ib_qp_set_raw_qp_counter(struct mlx5_ib_qp *qp, u32 set_id,
4049+
struct mlx5_core_dev *mdev)
4050+
{
4051+
struct mlx5_ib_raw_packet_qp *raw_packet_qp = &qp->raw_packet_qp;
4052+
struct mlx5_ib_rq *rq = &raw_packet_qp->rq;
4053+
u32 in[MLX5_ST_SZ_DW(modify_rq_in)] = {};
4054+
void *rqc;
4055+
4056+
if (!qp->rq.wqe_cnt)
4057+
return 0;
4058+
4059+
MLX5_SET(modify_rq_in, in, rq_state, rq->state);
4060+
MLX5_SET(modify_rq_in, in, uid, to_mpd(qp->ibqp.pd)->uid);
4061+
4062+
rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx);
4063+
MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RDY);
4064+
4065+
MLX5_SET64(modify_rq_in, in, modify_bitmask,
4066+
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID);
4067+
MLX5_SET(rqc, rqc, counter_set_id, set_id);
4068+
4069+
return mlx5_core_modify_rq(mdev, rq->base.mqp.qpn, in);
4070+
}
4071+
40484072
static int __mlx5_ib_qp_set_counter(struct ib_qp *qp,
40494073
struct rdma_counter *counter)
40504074
{
@@ -4060,6 +4084,9 @@ static int __mlx5_ib_qp_set_counter(struct ib_qp *qp,
40604084
else
40614085
set_id = mlx5_ib_get_counters_id(dev, mqp->port - 1);
40624086

4087+
if (mqp->type == IB_QPT_RAW_PACKET)
4088+
return __mlx5_ib_qp_set_raw_qp_counter(mqp, set_id, dev->mdev);
4089+
40634090
base = &mqp->trans_qp.base;
40644091
MLX5_SET(rts2rts_qp_in, in, opcode, MLX5_CMD_OP_RTS2RTS_QP);
40654092
MLX5_SET(rts2rts_qp_in, in, qpn, base->mqp.qpn);

0 commit comments

Comments
 (0)