]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_ib: Make sure that PSN does not overflow.
authorMajd Dibbiny <majd@mellanox.com>
Sun, 24 Aug 2014 10:50:03 +0000 (13:50 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:23 +0000 (14:45 -0700)
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 <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/infiniband/hw/mlx4/qp.c

index 84df3d8c935583af0db3a3a11ad0280a526aca0d..e5586d37eadddfa625df41c517c7c78e3dde83fb 100644 (file)
@@ -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) {