]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/bnxt_re: Fix the max WQE size for static WQE support
authorSelvin Xavier <selvin.xavier@broadcom.com>
Wed, 4 Sep 2024 10:04:13 +0000 (03:04 -0700)
committerLeon Romanovsky <leon@kernel.org>
Mon, 9 Sep 2024 18:17:09 +0000 (21:17 +0300)
When variable size WQE is supported, max_qp_sges reported
is more than 6. For devices that supports variable size WQE,
the Send WQE size calculation is wrong when an an older library
that doesn't support variable size WQE is used.

Set the WQE size to 128 when static WQE is supported.

Fixes: de1d364c3815 ("RDMA/bnxt_re: Add support for Variable WQE in Genp7 adapters")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/1725444253-13221-3-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/qplib_sp.h

index ecee691ed1e0a12f91e4676c6dbc8f6d3d43099f..460f33914825c6865cd8e4b4b559f94cacb71653 100644 (file)
@@ -1006,23 +1006,22 @@ static int bnxt_re_setup_swqe_size(struct bnxt_re_qp *qp,
        align = sizeof(struct sq_send_hdr);
        ilsize = ALIGN(init_attr->cap.max_inline_data, align);
 
-       sq->wqe_size = bnxt_re_get_wqe_size(ilsize, sq->max_sge);
-       if (sq->wqe_size > bnxt_re_get_swqe_size(dev_attr->max_qp_sges))
-               return -EINVAL;
-       /* For gen p4 and gen p5 backward compatibility mode
-        * wqe size is fixed to 128 bytes
+       /* For gen p4 and gen p5 fixed wqe compatibility mode
+        * wqe size is fixed to 128 bytes - ie 6 SGEs
         */
-       if (sq->wqe_size < bnxt_re_get_swqe_size(dev_attr->max_qp_sges) &&
-                       qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC)
-               sq->wqe_size = bnxt_re_get_swqe_size(dev_attr->max_qp_sges);
+       if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC) {
+               sq->wqe_size = bnxt_re_get_swqe_size(BNXT_STATIC_MAX_SGE);
+               sq->max_sge = BNXT_STATIC_MAX_SGE;
+       } else {
+               sq->wqe_size = bnxt_re_get_wqe_size(ilsize, sq->max_sge);
+               if (sq->wqe_size > bnxt_re_get_swqe_size(dev_attr->max_qp_sges))
+                       return -EINVAL;
+       }
 
        if (init_attr->cap.max_inline_data) {
                qplqp->max_inline_data = sq->wqe_size -
                        sizeof(struct sq_send_hdr);
                init_attr->cap.max_inline_data = qplqp->max_inline_data;
-               if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_STATIC)
-                       sq->max_sge = qplqp->max_inline_data /
-                               sizeof(struct sq_sge);
        }
 
        return 0;
index 4ce44aabfdc17d8076577ecfe50c66f6d6c5767e..acd9c14a31c4ba9966ecf263857428fa6a393b0a 100644 (file)
@@ -358,4 +358,6 @@ int bnxt_qplib_modify_cc(struct bnxt_qplib_res *res,
 #define BNXT_VAR_MAX_SGE        13
 #define BNXT_RE_MAX_RQ_WQES     65536
 
+#define BNXT_STATIC_MAX_SGE    6
+
 #endif /* __BNXT_QPLIB_SP_H__*/