Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/bnxt_re: Add extended psn structure for 57500 adapters

The new 57500 series of adapter has bigger psn search structure. The size
of new structure is 16B. Changing the control path memory allocation and
fast path code to accommodate the new psn structure while maintaining the
backward compatibility.

There are few additional changes listed below:
- For 57500 chip max-sge are limited to 6 for now.
- For 57500 chip max-receive-sge should be set to 6 for now.
- Add driver/hardware interface structure for new chip.

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Devesh Sharma and committed by
Jason Gunthorpe
37f91cff 374c5285

+70 -18
+10 -3
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 884 884 struct bnxt_re_qp_req ureq; 885 885 struct bnxt_qplib_qp *qplib_qp = &qp->qplib_qp; 886 886 struct ib_umem *umem; 887 - int bytes = 0; 887 + int bytes = 0, psn_sz; 888 888 struct ib_ucontext *context = pd->ib_pd.uobject->context; 889 889 struct bnxt_re_ucontext *cntx = container_of(context, 890 890 struct bnxt_re_ucontext, ··· 894 894 895 895 bytes = (qplib_qp->sq.max_wqe * BNXT_QPLIB_MAX_SQE_ENTRY_SIZE); 896 896 /* Consider mapping PSN search memory only for RC QPs. */ 897 - if (qplib_qp->type == CMDQ_CREATE_QP_TYPE_RC) 898 - bytes += (qplib_qp->sq.max_wqe * sizeof(struct sq_psn_search)); 897 + if (qplib_qp->type == CMDQ_CREATE_QP_TYPE_RC) { 898 + psn_sz = bnxt_qplib_is_chip_gen_p5(&rdev->chip_ctx) ? 899 + sizeof(struct sq_psn_search_ext) : 900 + sizeof(struct sq_psn_search); 901 + bytes += (qplib_qp->sq.max_wqe * psn_sz); 902 + } 899 903 bytes = PAGE_ALIGN(bytes); 900 904 umem = ib_umem_get(udata, ureq.qpsva, bytes, IB_ACCESS_LOCAL_WRITE, 1); 901 905 if (IS_ERR(umem)) ··· 1656 1652 __from_ib_access_flags(qp_attr->qp_access_flags); 1657 1653 /* LOCAL_WRITE access must be set to allow RC receive */ 1658 1654 qp->qplib_qp.access |= BNXT_QPLIB_ACCESS_LOCAL_WRITE; 1655 + /* Temp: Set all params on QP as of now */ 1656 + qp->qplib_qp.access |= CMDQ_MODIFY_QP_ACCESS_REMOTE_WRITE; 1657 + qp->qplib_qp.access |= CMDQ_MODIFY_QP_ACCESS_REMOTE_READ; 1659 1658 } 1660 1659 if (qp_attr_mask & IB_QP_PKEY_INDEX) { 1661 1660 qp->qplib_qp.modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_PKEY;
+38 -13
drivers/infiniband/hw/bnxt_re/qplib_fp.c
··· 870 870 unsigned long int psn_search, poff = 0; 871 871 struct bnxt_qplib_q *sq = &qp->sq; 872 872 struct bnxt_qplib_q *rq = &qp->rq; 873 + int i, rc, req_size, psn_sz = 0; 873 874 struct bnxt_qplib_hwq *xrrq; 874 - int i, rc, req_size, psn_sz; 875 875 u16 cmd_flags = 0, max_ssge; 876 876 u32 sw_prod, qp_flags = 0; 877 + u16 max_rsge; 877 878 878 879 RCFW_CMD_PREP(req, CREATE_QP, cmd_flags); 879 880 ··· 884 883 req.qp_handle = cpu_to_le64(qp->qp_handle); 885 884 886 885 /* SQ */ 887 - psn_sz = (qp->type == CMDQ_CREATE_QP_TYPE_RC) ? 888 - sizeof(struct sq_psn_search) : 0; 886 + if (qp->type == CMDQ_CREATE_QP_TYPE_RC) { 887 + psn_sz = bnxt_qplib_is_chip_gen_p5(res->cctx) ? 888 + sizeof(struct sq_psn_search_ext) : 889 + sizeof(struct sq_psn_search); 890 + } 889 891 sq->hwq.max_elements = sq->max_wqe; 890 892 rc = bnxt_qplib_alloc_init_hwq(res->pdev, &sq->hwq, sq->sglist, 891 893 sq->nmap, &sq->hwq.max_elements, ··· 918 914 poff = (psn_search & ~PAGE_MASK) / 919 915 BNXT_QPLIB_MAX_PSNE_ENTRY_SIZE; 920 916 } 921 - for (i = 0; i < sq->hwq.max_elements; i++) 917 + for (i = 0; i < sq->hwq.max_elements; i++) { 922 918 sq->swq[i].psn_search = 923 919 &psn_search_ptr[get_psne_pg(i + poff)] 924 920 [get_psne_idx(i + poff)]; 921 + /*psns_ext will be used only for P5 chips. */ 922 + sq->swq[i].psn_ext = 923 + (struct sq_psn_search_ext *) 924 + &psn_search_ptr[get_psne_pg(i + poff)] 925 + [get_psne_idx(i + poff)]; 926 + } 925 927 } 926 928 pbl = &sq->hwq.pbl[PBL_LVL_0]; 927 929 req.sq_pbl = cpu_to_le64(pbl->pg_map_arr[0]); ··· 1026 1016 req.sq_fwo_sq_sge = cpu_to_le16( 1027 1017 ((max_ssge & CMDQ_CREATE_QP_SQ_SGE_MASK) 1028 1018 << CMDQ_CREATE_QP_SQ_SGE_SFT) | 0); 1019 + max_rsge = bnxt_qplib_is_chip_gen_p5(res->cctx) ? 6 : rq->max_sge; 1029 1020 req.rq_fwo_rq_sge = cpu_to_le16( 1030 - ((rq->max_sge & CMDQ_CREATE_QP_RQ_SGE_MASK) 1021 + ((max_rsge & CMDQ_CREATE_QP_RQ_SGE_MASK) 1031 1022 << CMDQ_CREATE_QP_RQ_SGE_SFT) | 0); 1032 1023 /* ORRQ and IRRQ */ 1033 1024 if (psn_sz) { ··· 1073 1062 1074 1063 qp->id = le32_to_cpu(resp.xid); 1075 1064 qp->cur_qp_state = CMDQ_MODIFY_QP_NEW_STATE_RESET; 1065 + qp->cctx = res->cctx; 1076 1066 INIT_LIST_HEAD(&qp->sq_flush); 1077 1067 INIT_LIST_HEAD(&qp->rq_flush); 1078 1068 rcfw->qp_tbl[qp->id].qp_id = qp->id; ··· 1760 1748 } 1761 1749 swq->next_psn = sq->psn & BTH_PSN_MASK; 1762 1750 if (swq->psn_search) { 1763 - swq->psn_search->opcode_start_psn = cpu_to_le32( 1764 - ((swq->start_psn << SQ_PSN_SEARCH_START_PSN_SFT) & 1765 - SQ_PSN_SEARCH_START_PSN_MASK) | 1766 - ((wqe->type << SQ_PSN_SEARCH_OPCODE_SFT) & 1767 - SQ_PSN_SEARCH_OPCODE_MASK)); 1768 - swq->psn_search->flags_next_psn = cpu_to_le32( 1769 - ((swq->next_psn << SQ_PSN_SEARCH_NEXT_PSN_SFT) & 1770 - SQ_PSN_SEARCH_NEXT_PSN_MASK)); 1751 + u32 opcd_spsn; 1752 + u32 flg_npsn; 1753 + 1754 + opcd_spsn = ((swq->start_psn << SQ_PSN_SEARCH_START_PSN_SFT) & 1755 + SQ_PSN_SEARCH_START_PSN_MASK); 1756 + opcd_spsn |= ((wqe->type << SQ_PSN_SEARCH_OPCODE_SFT) & 1757 + SQ_PSN_SEARCH_OPCODE_MASK); 1758 + flg_npsn = ((swq->next_psn << SQ_PSN_SEARCH_NEXT_PSN_SFT) & 1759 + SQ_PSN_SEARCH_NEXT_PSN_MASK); 1760 + if (bnxt_qplib_is_chip_gen_p5(qp->cctx)) { 1761 + swq->psn_ext->opcode_start_psn = 1762 + cpu_to_le32(opcd_spsn); 1763 + swq->psn_ext->flags_next_psn = 1764 + cpu_to_le32(flg_npsn); 1765 + } else { 1766 + swq->psn_search->opcode_start_psn = 1767 + cpu_to_le32(opcd_spsn); 1768 + swq->psn_search->flags_next_psn = 1769 + cpu_to_le32(flg_npsn); 1770 + } 1771 1771 } 1772 1772 queue_err: 1773 1773 if (sch_handler) { ··· 2077 2053 opcode = CQ_BASE_CQE_TYPE_RES_RC; 2078 2054 break; 2079 2055 case CMDQ_CREATE_QP_TYPE_UD: 2056 + case CMDQ_CREATE_QP_TYPE_GSI: 2080 2057 opcode = CQ_BASE_CQE_TYPE_RES_UD; 2081 2058 break; 2082 2059 }
+2
drivers/infiniband/hw/bnxt_re/qplib_fp.h
··· 106 106 u32 start_psn; 107 107 u32 next_psn; 108 108 struct sq_psn_search *psn_search; 109 + struct sq_psn_search_ext *psn_ext; 109 110 }; 110 111 111 112 struct bnxt_qplib_swqe { ··· 255 254 struct bnxt_qplib_qp { 256 255 struct bnxt_qplib_pd *pd; 257 256 struct bnxt_qplib_dpi *dpi; 257 + struct bnxt_qplib_chip_ctx *cctx; 258 258 u64 qp_handle; 259 259 #define BNXT_QPLIB_QP_ID_INVALID 0xFFFFFFFF 260 260 u32 id;
+2 -1
drivers/infiniband/hw/bnxt_re/qplib_sp.c
··· 119 119 * reporting the max number 120 120 */ 121 121 attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS; 122 - attr->max_qp_sges = sb->max_sge; 122 + attr->max_qp_sges = bnxt_qplib_is_chip_gen_p5(rcfw->res->cctx) ? 123 + 6 : sb->max_sge; 123 124 attr->max_cq = le32_to_cpu(sb->max_cq); 124 125 attr->max_cq_wqes = le32_to_cpu(sb->max_cqe); 125 126 attr->max_cq_sges = attr->max_qp_sges;
+18 -1
drivers/infiniband/hw/bnxt_re/roce_hsi.h
··· 159 159 #define SQ_PSN_SEARCH_NEXT_PSN_MASK 0xffffffUL 160 160 #define SQ_PSN_SEARCH_NEXT_PSN_SFT 0 161 161 #define SQ_PSN_SEARCH_FLAGS_MASK 0xff000000UL 162 - #define SQ_PSN_SEARCH_FLAGS_SFT 24 162 + #define SQ_PSN_SEARCH_FLAGS_SFT 24 163 + }; 164 + 165 + /* sq_psn_search_ext (size:128b/16B) */ 166 + struct sq_psn_search_ext { 167 + __le32 opcode_start_psn; 168 + #define SQ_PSN_SEARCH_EXT_START_PSN_MASK 0xffffffUL 169 + #define SQ_PSN_SEARCH_EXT_START_PSN_SFT 0 170 + #define SQ_PSN_SEARCH_EXT_OPCODE_MASK 0xff000000UL 171 + #define SQ_PSN_SEARCH_EXT_OPCODE_SFT 24 172 + __le32 flags_next_psn; 173 + #define SQ_PSN_SEARCH_EXT_NEXT_PSN_MASK 0xffffffUL 174 + #define SQ_PSN_SEARCH_EXT_NEXT_PSN_SFT 0 175 + #define SQ_PSN_SEARCH_EXT_FLAGS_MASK 0xff000000UL 176 + #define SQ_PSN_SEARCH_EXT_FLAGS_SFT 24 177 + __le16 start_slot_idx; 178 + __le16 reserved16; 179 + __le32 reserved32; 163 180 }; 164 181 165 182 /* Send SQ WQE (40 bytes) */