From: Majd Dibbiny Date: Sun, 24 Aug 2014 10:50:03 +0000 (+0300) Subject: mlx4_ib: Make sure that PSN does not overflow. X-Git-Tag: v4.1.12-92~293^2~1^2~22 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=21c887c6d37e0673cdac0ddcf22fbe080ec8adbf;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 84df3d8c93558..e5586d37eaddd 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) {