]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RDMA/bnxt_re: Fix setting mandatory attributes for modify_qp
authorDamodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Wed, 11 Dec 2024 08:39:29 +0000 (14:09 +0530)
committerLeon Romanovsky <leon@kernel.org>
Mon, 16 Dec 2024 13:33:31 +0000 (08:33 -0500)
Firmware expects "min_rnr_timer" as a mandatory attribute in
MODIFY_QP command during the RTR-RTS transition. This needs
to be enforced by the driver which is missing while setting
bnxt_set_mandatory_attributes that sends these flags as part
of modify_qp optimization.

Fixes: 82c32d219272 ("RDMA/bnxt_re: Add support for optimized modify QP")
Reviewed-by: Rukhsana Ansari <rukhsana.ansari@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/20241211083931.968831-4-kalesh-anakkur.purayil@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/bnxt_re/qplib_fp.c
drivers/infiniband/hw/bnxt_re/qplib_res.h
drivers/infiniband/hw/bnxt_re/roce_hsi.h

index 093bfb748cdfde9fa4b0281553f7f31de581111a..5169804e6f12754519ac2d792dff04f5891b9d03 100644 (file)
@@ -1285,7 +1285,8 @@ static void __filter_modify_flags(struct bnxt_qplib_qp *qp)
        }
 }
 
-static void bnxt_set_mandatory_attributes(struct bnxt_qplib_qp *qp,
+static void bnxt_set_mandatory_attributes(struct bnxt_qplib_res *res,
+                                         struct bnxt_qplib_qp *qp,
                                          struct cmdq_modify_qp *req)
 {
        u32 mandatory_flags = 0;
@@ -1300,6 +1301,14 @@ static void bnxt_set_mandatory_attributes(struct bnxt_qplib_qp *qp,
                mandatory_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_PKEY;
        }
 
+       if (_is_min_rnr_in_rtr_rts_mandatory(res->dattr->dev_cap_flags2) &&
+           (qp->cur_qp_state == CMDQ_MODIFY_QP_NEW_STATE_RTR &&
+            qp->state == CMDQ_MODIFY_QP_NEW_STATE_RTS)) {
+               if (qp->type == CMDQ_MODIFY_QP_QP_TYPE_RC)
+                       mandatory_flags |=
+                               CMDQ_MODIFY_QP_MODIFY_MASK_MIN_RNR_TIMER;
+       }
+
        if (qp->type == CMDQ_MODIFY_QP_QP_TYPE_UD ||
            qp->type == CMDQ_MODIFY_QP_QP_TYPE_GSI)
                mandatory_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_QKEY;
@@ -1340,7 +1349,7 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
                /* Set mandatory attributes for INIT -> RTR and RTR -> RTS transition */
                if (_is_optimize_modify_qp_supported(res->dattr->dev_cap_flags2) &&
                    is_optimized_state_transition(qp))
-                       bnxt_set_mandatory_attributes(qp, &req);
+                       bnxt_set_mandatory_attributes(res, qp, &req);
        }
        bmask = qp->modify_flags;
        req.modify_mask = cpu_to_le32(qp->modify_flags);
index 21fb148713a6f918449b49a47e9140329fc7c5f1..cbfc49a1a56d7c6ae72bfe45033b4af847f4c6c7 100644 (file)
@@ -584,6 +584,11 @@ static inline bool _is_optimize_modify_qp_supported(u16 dev_cap_ext_flags2)
        return dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_OPTIMIZE_MODIFY_QP_SUPPORTED;
 }
 
+static inline bool _is_min_rnr_in_rtr_rts_mandatory(u16 dev_cap_ext_flags2)
+{
+       return !!(dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_MIN_RNR_RTR_RTS_OPT_SUPPORTED);
+}
+
 static inline bool _is_cq_coalescing_supported(u16 dev_cap_ext_flags2)
 {
        return dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_CQ_COALESCING_SUPPORTED;
index a98fc9c2313e7e0cb8b38dc09afcfeaa8c3a51e6..0ee60fdc18b33edb18f43cc2899e43194ca8886c 100644 (file)
@@ -2215,6 +2215,7 @@ struct creq_query_func_resp_sb {
        #define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE   (0x2UL << 4)
        #define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_LAST \
                        CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE
+       #define CREQ_QUERY_FUNC_RESP_SB_MIN_RNR_RTR_RTS_OPT_SUPPORTED            0x1000UL
        __le16  max_xp_qp_size;
        __le16  create_qp_batch_size;
        __le16  destroy_qp_batch_size;