Skip to content

Commit 10189e8

Browse files
Mark Zhangjgunthorpe
authored andcommitted
IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported
When binding a QP with a counter and the QP state is not RESET, return failure if the rts2rts_qp_counters_set_id is not supported by the device. This is to prevent cases like manual bind for Connect-IB devices from returning success when the feature is not supported. Fixes: d14133d ("IB/mlx5: Support set qp counter") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Zhang <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a72f4ac commit 10189e8

File tree

1 file changed

+6
-3
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+6
-3
lines changed

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,9 +3441,6 @@ static int __mlx5_ib_qp_set_counter(struct ib_qp *qp,
34413441
struct mlx5_ib_qp_base *base;
34423442
u32 set_id;
34433443

3444-
if (!MLX5_CAP_GEN(dev->mdev, rts2rts_qp_counters_set_id))
3445-
return 0;
3446-
34473444
if (counter)
34483445
set_id = counter->id;
34493446
else
@@ -6576,6 +6573,7 @@ void mlx5_ib_drain_rq(struct ib_qp *qp)
65766573
*/
65776574
int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter)
65786575
{
6576+
struct mlx5_ib_dev *dev = to_mdev(qp->device);
65796577
struct mlx5_ib_qp *mqp = to_mqp(qp);
65806578
int err = 0;
65816579

@@ -6585,6 +6583,11 @@ int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter)
65856583
goto out;
65866584
}
65876585

6586+
if (!MLX5_CAP_GEN(dev->mdev, rts2rts_qp_counters_set_id)) {
6587+
err = -EOPNOTSUPP;
6588+
goto out;
6589+
}
6590+
65886591
if (mqp->state == IB_QPS_RTS) {
65896592
err = __mlx5_ib_qp_set_counter(qp, counter);
65906593
if (!err)

0 commit comments

Comments
 (0)