diff mbox

[for-next] IB/mlx5: Fix port counter ID association to QP offset

Message ID 1468416311-25643-1-git-send-email-leon@kernel.org (mailing list archive)
State Accepted
Headers show

Commit Message

Leon Romanovsky July 13, 2016, 1:25 p.m. UTC
From: Alex Vesker <valex@mellanox.com>

The q-counter-id is given in modify-QP command associates
the QP with the counter. The offset to which the counter
ID was set is incorrect, causing IB port counters not to
count on QP.

Fixes: 0837e86a7a34 ('IB/mlx5: Add per port counters')
Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
---
 drivers/infiniband/hw/mlx5/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Bloch July 13, 2016, 2:09 p.m. UTC | #1
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> owner@vger.kernel.org] On Behalf Of Leon Romanovsky
> Sent: Wednesday, July 13, 2016 4:25 PM
> To: dledford@redhat.com
> Cc: linux-rdma@vger.kernel.org; Alex Vesker <valex@mellanox.com>
> Subject: [PATCH for-next] IB/mlx5: Fix port counter ID association to QP
> offset
> 
> From: Alex Vesker <valex@mellanox.com>
> 
> The q-counter-id is given in modify-QP command associates
> the QP with the counter. The offset to which the counter
> ID was set is incorrect, causing IB port counters not to
> count on QP.
> 
> Fixes: 0837e86a7a34 ('IB/mlx5: Add per port counters')
> Signed-off-by: Alex Vesker <valex@mellanox.com>
> Signed-off-by: Leon Romanovsky <leon@kernel.org>
> ---
>  drivers/infiniband/hw/mlx5/qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/qp.c
> b/drivers/infiniband/hw/mlx5/qp.c
> index 5ca14a2..40b2045 100644
> --- a/drivers/infiniband/hw/mlx5/qp.c
> +++ b/drivers/infiniband/hw/mlx5/qp.c
> @@ -2657,7 +2657,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
>  		struct mlx5_ib_port *mibport = &dev->port[port_num];
> 
>  		context->qp_counter_set_usr_page |=
> -			cpu_to_be32(mibport->q_cnt_id << 16);
> +			cpu_to_be32((u32)(mibport->q_cnt_id) << 24);
>  	}
> 
>  	if (!ibqp->uobject && cur_state == IB_QPS_RESET && new_state ==
> IB_QPS_INIT)
> --
> 2.1.4
> 
> --

Alex thank for noticing and fixing this.

Tested-by: Mark Bloch <markb@mellanox.com>

Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Aug. 2, 2016, 6:43 p.m. UTC | #2
On Wed, 2016-07-13 at 14:09 +0000, Mark Bloch wrote:
> > 
> > -----Original Message-----
> > From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> > owner@vger.kernel.org] On Behalf Of Leon Romanovsky
> > Sent: Wednesday, July 13, 2016 4:25 PM
> > To: dledford@redhat.com
> > Cc: linux-rdma@vger.kernel.org; Alex Vesker <valex@mellanox.com>
> > Subject: [PATCH for-next] IB/mlx5: Fix port counter ID association
> > to QP
> > offset
> > 
> > From: Alex Vesker <valex@mellanox.com>
> > 
> > The q-counter-id is given in modify-QP command associates
> > the QP with the counter. The offset to which the counter
> > ID was set is incorrect, causing IB port counters not to
> > count on QP.
> > 
> > Fixes: 0837e86a7a34 ('IB/mlx5: Add per port counters')
> > Signed-off-by: Alex Vesker <valex@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leon@kernel.org>
> > 
> Alex thank for noticing and fixing this.
> 
> Tested-by: Mark Bloch <markb@mellanox.com>

Thanks, applied.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 5ca14a2..40b2045 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -2657,7 +2657,7 @@  static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
 		struct mlx5_ib_port *mibport = &dev->port[port_num];
 
 		context->qp_counter_set_usr_page |=
-			cpu_to_be32(mibport->q_cnt_id << 16);
+			cpu_to_be32((u32)(mibport->q_cnt_id) << 24);
 	}
 
 	if (!ibqp->uobject && cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT)