Skip to content

Commit 8d310ba

Browse files
selvintxavierrleon
authored andcommitted
RDMA/bnxt_re: Allow MSN table capability check
FW reports the HW capability to use PSN table or MSN table and driver/library need to select it based on this capability. Use the new capability instead of the older capability check for HW retransmission while handling the MSN/PSN table. FW report zero (PSN table) for older adapters to maintain backward compatibility. Also, Updated the FW interface structures to handle the new fields. Signed-off-by: Selvin Xavier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 1613e60 commit 8d310ba

File tree

6 files changed

+44
-8
lines changed

6 files changed

+44
-8
lines changed

drivers/infiniband/hw/bnxt_re/qplib_fp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
984984
u16 nsge;
985985

986986
if (res->dattr)
987-
qp->dev_cap_flags = res->dattr->dev_cap_flags;
987+
qp->is_host_msn_tbl = _is_host_msn_table(res->dattr->dev_cap_flags2);
988988

989989
sq->dbinfo.flags = 0;
990990
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
@@ -1002,7 +1002,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
10021002
sizeof(struct sq_psn_search_ext) :
10031003
sizeof(struct sq_psn_search);
10041004

1005-
if (BNXT_RE_HW_RETX(qp->dev_cap_flags)) {
1005+
if (qp->is_host_msn_tbl) {
10061006
psn_sz = sizeof(struct sq_msn_search);
10071007
qp->msn = 0;
10081008
}
@@ -1016,7 +1016,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
10161016
hwq_attr.aux_depth = psn_sz ? bnxt_qplib_set_sq_size(sq, qp->wqe_mode)
10171017
: 0;
10181018
/* Update msn tbl size */
1019-
if (BNXT_RE_HW_RETX(qp->dev_cap_flags) && psn_sz) {
1019+
if (qp->is_host_msn_tbl && psn_sz) {
10201020
hwq_attr.aux_depth = roundup_pow_of_two(bnxt_qplib_set_sq_size(sq, qp->wqe_mode));
10211021
qp->msn_tbl_sz = hwq_attr.aux_depth;
10221022
qp->msn = 0;
@@ -1637,7 +1637,7 @@ static void bnxt_qplib_fill_psn_search(struct bnxt_qplib_qp *qp,
16371637
if (!swq->psn_search)
16381638
return;
16391639
/* Handle MSN differently on cap flags */
1640-
if (BNXT_RE_HW_RETX(qp->dev_cap_flags)) {
1640+
if (qp->is_host_msn_tbl) {
16411641
bnxt_qplib_fill_msn_search(qp, wqe, swq);
16421642
return;
16431643
}
@@ -1819,7 +1819,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
18191819
}
18201820

18211821
swq = bnxt_qplib_get_swqe(sq, &wqe_idx);
1822-
bnxt_qplib_pull_psn_buff(qp, sq, swq, BNXT_RE_HW_RETX(qp->dev_cap_flags));
1822+
bnxt_qplib_pull_psn_buff(qp, sq, swq, qp->is_host_msn_tbl);
18231823

18241824
idx = 0;
18251825
swq->slot_idx = hwq->prod;
@@ -2009,7 +2009,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
20092009
rc = -EINVAL;
20102010
goto done;
20112011
}
2012-
if (!BNXT_RE_HW_RETX(qp->dev_cap_flags) || msn_update) {
2012+
if (!qp->is_host_msn_tbl || msn_update) {
20132013
swq->next_psn = sq->psn & BTH_PSN_MASK;
20142014
bnxt_qplib_fill_psn_search(qp, wqe, swq);
20152015
}

drivers/infiniband/hw/bnxt_re/qplib_fp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ struct bnxt_qplib_qp {
340340
struct list_head rq_flush;
341341
u32 msn;
342342
u32 msn_tbl_sz;
343-
u16 dev_cap_flags;
343+
bool is_host_msn_tbl;
344344
};
345345

346346
#define BNXT_QPLIB_MAX_CQE_ENTRY_SIZE sizeof(struct cq_base)

drivers/infiniband/hw/bnxt_re/qplib_res.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,12 @@ static inline bool _is_hw_retx_supported(u16 dev_cap_flags)
554554

555555
#define BNXT_RE_HW_RETX(a) _is_hw_retx_supported((a))
556556

557+
static inline bool _is_host_msn_table(u16 dev_cap_ext_flags2)
558+
{
559+
return (dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_MASK) ==
560+
CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_HOST_MSN_TABLE;
561+
}
562+
557563
static inline u8 bnxt_qplib_dbr_pacing_en(struct bnxt_qplib_chip_ctx *cctx)
558564
{
559565
return cctx->modes.dbr_pacing;

drivers/infiniband/hw/bnxt_re/qplib_sp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
156156
(0x01 << RCFW_DBR_BASE_PAGE_SHIFT);
157157
attr->max_sgid = BNXT_QPLIB_NUM_GIDS_SUPPORTED;
158158
attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags);
159+
attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2);
159160

160161
bnxt_qplib_query_version(rcfw, attr->fw_ver);
161162

drivers/infiniband/hw/bnxt_re/qplib_sp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct bnxt_qplib_dev_attr {
7272
u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ];
7373
bool is_atomic;
7474
u16 dev_cap_flags;
75+
u16 dev_cap_flags2;
7576
u32 max_dpi;
7677
};
7778

drivers/infiniband/hw/bnxt_re/roce_hsi.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,8 +2157,36 @@ struct creq_query_func_resp_sb {
21572157
__le32 tqm_alloc_reqs[12];
21582158
__le32 max_dpi;
21592159
u8 max_sge_var_wqe;
2160-
u8 reserved_8;
2160+
u8 dev_cap_ext_flags;
2161+
#define CREQ_QUERY_FUNC_RESP_SB_ATOMIC_OPS_NOT_SUPPORTED 0x1UL
2162+
#define CREQ_QUERY_FUNC_RESP_SB_DRV_VERSION_RGTR_SUPPORTED 0x2UL
2163+
#define CREQ_QUERY_FUNC_RESP_SB_CREATE_QP_BATCH_SUPPORTED 0x4UL
2164+
#define CREQ_QUERY_FUNC_RESP_SB_DESTROY_QP_BATCH_SUPPORTED 0x8UL
2165+
#define CREQ_QUERY_FUNC_RESP_SB_ROCE_STATS_EXT_CTX_SUPPORTED 0x10UL
2166+
#define CREQ_QUERY_FUNC_RESP_SB_CREATE_SRQ_SGE_SUPPORTED 0x20UL
2167+
#define CREQ_QUERY_FUNC_RESP_SB_FIXED_SIZE_WQE_DISABLED 0x40UL
2168+
#define CREQ_QUERY_FUNC_RESP_SB_DCN_SUPPORTED 0x80UL
21612169
__le16 max_inline_data_var_wqe;
2170+
__le32 start_qid;
2171+
u8 max_msn_table_size;
2172+
u8 reserved8_1;
2173+
__le16 dev_cap_ext_flags_2;
2174+
#define CREQ_QUERY_FUNC_RESP_SB_OPTIMIZE_MODIFY_QP_SUPPORTED 0x1UL
2175+
#define CREQ_QUERY_FUNC_RESP_SB_CHANGE_UDP_SRC_PORT_WQE_SUPPORTED 0x2UL
2176+
#define CREQ_QUERY_FUNC_RESP_SB_CQ_COALESCING_SUPPORTED 0x4UL
2177+
#define CREQ_QUERY_FUNC_RESP_SB_MEMORY_REGION_RO_SUPPORTED 0x8UL
2178+
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_MASK 0x30UL
2179+
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_SFT 4
2180+
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_HOST_PSN_TABLE (0x0UL << 4)
2181+
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_HOST_MSN_TABLE (0x1UL << 4)
2182+
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE (0x2UL << 4)
2183+
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_LAST \
2184+
CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE
2185+
__le16 max_xp_qp_size;
2186+
__le16 create_qp_batch_size;
2187+
__le16 destroy_qp_batch_size;
2188+
__le16 reserved16;
2189+
__le64 reserved64;
21622190
};
21632191

21642192
/* cmdq_set_func_resources (size:448b/56B) */

0 commit comments

Comments
 (0)