From 21c887c6d37e0673cdac0ddcf22fbe080ec8adbf Mon Sep 17 00:00:00 2001 From: Majd Dibbiny Date: Sun, 24 Aug 2014 13:50:03 +0300 Subject: [PATCH] mlx4_ib: Make sure that PSN does not overflow. The rq/sq->psn is 24 bits as defined in the IB spec, therefore we mask out the 8 most significant bits to avoid overflow in the modify qp. Signed-off-by: Majd Dibbiny (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker --- drivers/infiniband/hw/mlx4/qp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 84df3d8c9355..e5586d37eadd 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c @@ -1657,7 +1657,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, } if (attr_mask & IB_QP_SQ_PSN) - context->next_send_psn = cpu_to_be32(attr->sq_psn); + context->next_send_psn = cpu_to_be32(attr->sq_psn & 0xffffff); if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) { if (attr->max_dest_rd_atomic) @@ -1679,7 +1679,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, optpar |= MLX4_QP_OPTPAR_RNR_TIMEOUT; } if (attr_mask & IB_QP_RQ_PSN) - context->rnr_nextrecvpsn |= cpu_to_be32(attr->rq_psn); + context->rnr_nextrecvpsn |= cpu_to_be32(attr->rq_psn & 0xffffff); /* proxy and tunnel qp qkeys will be changed in modify-qp wrappers */ if (attr_mask & IB_QP_QKEY) { -- 2.50.1