* [PATCH rdma-next] IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported
@ 2020-01-26 17:17 Leon Romanovsky
2020-02-11 18:25 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2020-01-26 17:17 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Mark Zhang, RDMA mailing list, Maor Gottlieb, Leon Romanovsky
From: Mark Zhang <markz@mellanox.com>
When bind a QP with a counter and the QP state is not RESET, return
failure if the rts2rts_qp_counters_set_id is not supported. This is
to prevent cases like manual bind for Connect-IB devices from returning
success when the feature is not supported.
Fixes: d14133dd4161 ("IB/mlx5: Support set qp counter")
Signed-off-by: Mark Zhang <markz@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/qp.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index a4f8e7030787..957f3a52589b 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -3441,9 +3441,6 @@ static int __mlx5_ib_qp_set_counter(struct ib_qp *qp,
struct mlx5_ib_qp_base *base;
u32 set_id;
- if (!MLX5_CAP_GEN(dev->mdev, rts2rts_qp_counters_set_id))
- return 0;
-
if (counter)
set_id = counter->id;
else
@@ -6576,6 +6573,7 @@ void mlx5_ib_drain_rq(struct ib_qp *qp)
*/
int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter)
{
+ struct mlx5_ib_dev *dev = to_mdev(qp->device);
struct mlx5_ib_qp *mqp = to_mqp(qp);
int err = 0;
@@ -6585,6 +6583,11 @@ int mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter)
goto out;
}
+ if (!MLX5_CAP_GEN(dev->mdev, rts2rts_qp_counters_set_id)) {
+ err = -EOPNOTSUPP;
+ goto out;
+ }
+
if (mqp->state == IB_QPS_RTS) {
err = __mlx5_ib_qp_set_counter(qp, counter);
if (!err)
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-next] IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported
2020-01-26 17:17 [PATCH rdma-next] IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported Leon Romanovsky
@ 2020-02-11 18:25 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-02-11 18:25 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, Mark Zhang, RDMA mailing list, Maor Gottlieb,
Leon Romanovsky
On Sun, Jan 26, 2020 at 07:17:08PM +0200, Leon Romanovsky wrote:
> From: Mark Zhang <markz@mellanox.com>
>
> When bind a QP with a counter and the QP state is not RESET, return
> failure if the rts2rts_qp_counters_set_id is not supported. This is
> to prevent cases like manual bind for Connect-IB devices from returning
> success when the feature is not supported.
>
> Fixes: d14133dd4161 ("IB/mlx5: Support set qp counter")
> Signed-off-by: Mark Zhang <markz@mellanox.com>
> Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> drivers/infiniband/hw/mlx5/qp.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
Applied to for-rc, thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-11 18:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-26 17:17 [PATCH rdma-next] IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported Leon Romanovsky
2020-02-11 18:25 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).