RDMA/bnxt_re: Enable Congestion control by default
Subsystems (4)
Selvin Xavier
maintainerv3 cover RDMA/bnxt_re: Enable Congestion control by default
This series includes the code reorgnization in the driver control path. HW interface header file is updated to the latest version. Also, adds support for a new command format which is required for enabling RoCE congestion control.
This series is prepared on top of the resize_cq
(https://lore.kernel.org/all/[email protected]/)
patch which is under review.
Please review and apply.
Thanks,
Selvin
v2 -> v3:
- Fix the sparse warnings
v1 -> v2:
- Fix the warning reported by kbuild test robot about missing static keyword
- Reported-by: kernel test robot <[email protected]>
Selvin Xavier (7):
RDMA/bnxt_re: Update HW interface headers
RDMA/bnxt_re: Remove HW queue mapping from RoCE Driver RDMA/bnxt_re: Convert RCFW_CMD_PREP macro to static inline function RDMA/bnxt_re: Reduce number of argumets to control path command APIs RDMA/bnxt_re: RoCE slow path TLV support
RDAM/bnxt_re: Use tlv apis while processing the slow path commands RDMA/bnxt_re: Enable congestion control by default
drivers/infiniband/hw/bnxt_re/main.c | 101 +- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 161 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 97 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 66 +- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 337 +- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 68 +- drivers/infiniband/hw/bnxt_re/qplib_tlv.h | 162 + drivers/infiniband/hw/bnxt_re/roce_hsi.h | 7423 +++++++++++++++---------- drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 81 + 9 files changed, 5108 insertions(+), 3388 deletions(-) create mode 100644 drivers/infiniband/hw/bnxt_re/qplib_tlv.h
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v3 1/7 RDMA/bnxt_re: Update HW interface headers
Updating the HW structures to the latest version.
This is copied from the code maintained internally. No functionality changes in this patch. Code is re-organized to match the file maintained in the internal tree. Also, New HW interface structures are added, which will be used by the drivers in future.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 2 +- drivers/infiniband/hw/bnxt_re/roce_hsi.h | 7423 +++++++++++++++---------- drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 81 + 3 files changed, 4429 insertions(+), 3077 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 -1
@@ -1286,7 +1286,7 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)memcpy (req.dest_mac, qp->ah.dmac,6 );if (bmask &CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU ) - req.path_mtu = qp->path_mtu; + req.path_mtu_pingpong_push_enable |= qp->path_mtu;if (bmask &CMDQ_MODIFY_QP_MODIFY_MASK_TIMEOUT ) req.timeout = qp->timeout;
drivers/infiniband/hw/bnxt_re/roce_hsi.h +4347 -3076
2,992 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +81 -0
81 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.5.5
Part of the diff is not shown here. View the raw message.
Selvin Xavier
maintainerPATCH v3 2/7 RDMA/bnxt_re: Remove HW queue mapping from RoCE Driver
In reply to Selvin Xavierbnxt_en driver does the queue mapping for RoCE traffic. Removing the queue mapping from RoCE driver.
--- drivers/infiniband/hw/bnxt_re/main.c | 77 -------------------------------- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 15 ------- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 - 3 files changed, 93 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +0 -77
@@ -921,49 +921,6 @@ static void bnxt_re_dispatch_event(struct ib_device *ibdev, struct ib_qp *qp, } } -#define HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN 0x02 -static int bnxt_re_query_hwrm_pri2cos (struct bnxt_re_dev *rdev,u8 dir, -u64 *cid_map) -{ -struct hwrm_queue_pri2cos_qcfg_input req = {0 }; -struct hwrm_queue_pri2cos_qcfg_output resp; -struct bnxt_en_dev *en_dev = rdev->en_dev; -struct bnxt_fw_msg fw_msg; -u32 flags =0 ; -u8 *qcfgmap, *tmp_map; -int rc =0 , i; - -if (!cid_map) -return -EINVAL ; - -memset (&fw_msg,0 ,sizeof (fw_msg)); -bnxt_re_init_hwrm_hdr (rdev, (void *)&req, -HWRM_QUEUE_PRI2COS_QCFG ,-1 ,-1 ); - flags |= (dir &0x01 ); - flags |=HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN ; - req.flags =cpu_to_le32 (flags); - req.port_id = en_dev->pf_port_id; - -bnxt_re_fill_fw_msg (&fw_msg, (void *)&req,sizeof (req), (void *)&resp, -sizeof (resp),DFLT_HWRM_CMD_TIMEOUT ); - rc =bnxt_send_msg (en_dev, &fw_msg); -if (rc) -return rc; - -if (resp.queue_cfg_info) { -ibdev_warn (&rdev->ibdev, -"Asymmetric cos queue configuration detected" ); -ibdev_warn (&rdev->ibdev, -" on device, QoS may not be fully functional\n" ); - } - qcfgmap = &resp.pri0_cos_queue_id; - tmp_map = (u8 *)cid_map; -for (i =0 ; i <IEEE_8021QAZ_MAX_TCS ; i++) - tmp_map[i] = qcfgmap[i]; - -return rc; -} -static bool bnxt_re_is_qp1_or_shadow_qp (struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp) {
@@ -1056,26 +1013,9 @@ static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev)return prio_map; } -static void bnxt_re_parse_cid_map (u8 prio_map,u8 *cid_map,u16 *cosq) -{ -u16 prio; -u8 id; - -for (prio =0 , id =0 ; prio <8 ; prio++) { -if (prio_map & (1 << prio)) { - cosq[id] = cid_map[prio]; - id++; -if (id ==2 )/* Max 2 tcs supported */ -break ; - } - } -} -static int bnxt_re_setup_qos (struct bnxt_re_dev *rdev) {u8 prio_map =0 ; -u64 cid_map; -int rc;/* Get priority for roce */ prio_map =bnxt_re_get_priority_mask (rdev);
@@ -1083,23 +1023,6 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)if (prio_map == rdev->cur_prio_map)return 0 ; rdev->cur_prio_map = prio_map; -/* Get cosq id for this priority */ - rc =bnxt_re_query_hwrm_pri2cos (rdev,0 , &cid_map); -if (rc) { -ibdev_warn (&rdev->ibdev,"no cos for p_mask %x\n" , prio_map); -return rc; - } -/* Parse CoS IDs for app priority */ -bnxt_re_parse_cid_map (prio_map, (u8 *)&cid_map, rdev->cosq); - -/* Config BONO. */ - rc =bnxt_qplib_map_tc2cos (&rdev->qplib_res, rdev->cosq); -if (rc) { -ibdev_warn (&rdev->ibdev,"no tc for cos{%x, %x}\n" , - rdev->cosq[0 ], rdev->cosq[1 ]); -return rc; - } -/* Actual priorities are not programmed as they are already * done by L2 driver; just enable or disable priority vlan tagging */
drivers/infiniband/hw/bnxt_re/qplib_sp.c +0 -15
@@ -679,21 +679,6 @@ int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res,return 0 ; } -int bnxt_qplib_map_tc2cos (struct bnxt_qplib_res *res,u16 *cids) -{ -struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_map_tc_to_cos req; -struct creq_map_tc_to_cos_resp resp; -u16 cmd_flags =0 ; - -RCFW_CMD_PREP (req,MAP_TC_TO_COS , cmd_flags); - req.cos0 =cpu_to_le16 (cids[0 ]); - req.cos1 =cpu_to_le16 (cids[1 ]); - -return bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, -NULL ,0 ); -} -int bnxt_qplib_get_roce_stats (struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_roce_stats *stats) {
drivers/infiniband/hw/bnxt_re/qplib_sp.h +0 -1
@@ -277,7 +277,6 @@ int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res *res, struct bnxt_qplib_frpl *frpl, int max);int bnxt_qplib_free_fast_reg_page_list (struct bnxt_qplib_res *res,struct bnxt_qplib_frpl *frpl); -int bnxt_qplib_map_tc2cos (struct bnxt_qplib_res *res,u16 *cids);int bnxt_qplib_get_roce_stats (struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_roce_stats *stats); int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid,
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v3 3/7 RDMA/bnxt_re: Convert RCFW_CMD_PREP macro to static inline function
In reply to Selvin XavierConvert RCFW_CMD_PREP macro to static inline function. Also, remove the cmd_flags passed as none of the functions are using it.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 55 ++++++++++++--------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 10 ++-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 23 ++++----- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 79 ++++++++++++++++++------------ 4 files changed, 98 insertions(+), 69 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +33 -22
@@ -583,10 +583,11 @@ void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res,struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct cmdq_destroy_srq req;struct creq_destroy_srq_resp resp; -u16 cmd_flags =0 ;int rc; -RCFW_CMD_PREP (req,DESTROY_SRQ , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_DESTROY_SRQ , +sizeof (req));/* Configure the request */ req.srq_cid =cpu_to_le32 (srq->id);
@@ -607,7 +608,6 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,struct creq_create_srq_resp resp;struct cmdq_create_srq req;struct bnxt_qplib_pbl *pbl; -u16 cmd_flags =0 ;u16 pg_sz_lvl;int rc, idx;
@@ -627,7 +627,9 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, goto fail; } -RCFW_CMD_PREP (req,CREATE_SRQ , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_CREATE_SRQ , +sizeof (req));/* Configure the request */ req.dpi =cpu_to_le32 (srq->dpi->dpi);
@@ -704,10 +706,11 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,struct creq_query_srq_resp resp;struct bnxt_qplib_rcfw_sbuf *sbuf;struct creq_query_srq_resp_sb *sb; -u16 cmd_flags =0 ;int rc =0 ; -RCFW_CMD_PREP (req,QUERY_SRQ , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_QUERY_SRQ , +sizeof (req));/* Configure the request */ sbuf =bnxt_qplib_rcfw_alloc_sbuf (rcfw,sizeof (*sb));
@@ -816,13 +819,14 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)struct creq_create_qp1_resp resp;struct cmdq_create_qp1 req;struct bnxt_qplib_pbl *pbl; -u16 cmd_flags =0 ;u32 qp_flags =0 ;u8 pg_sz_lvl;u32 tbl_indx;int rc; -RCFW_CMD_PREP (req,CREATE_QP1 , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_CREATE_QP1 , +sizeof (req));/* General */ req.type = qp->type;
@@ -959,13 +963,14 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)struct bnxt_qplib_hwq *xrrq;struct bnxt_qplib_pbl *pbl;struct cmdq_create_qp req; -u16 cmd_flags =0 ;u32 qp_flags =0 ;u8 pg_sz_lvl;u32 tbl_indx;u16 nsge; -RCFW_CMD_PREP (req,CREATE_QP , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_CREATE_QP , +sizeof (req));/* General */ req.type = qp->type;
@@ -1233,12 +1238,13 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct cmdq_modify_qp req;struct creq_modify_qp_resp resp; -u16 cmd_flags =0 ;u32 temp32[4 ];u32 bmask;int rc; -RCFW_CMD_PREP (req,MODIFY_QP , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_MODIFY_QP , +sizeof (req));/* Filter out the qp_attr_mask based on the state->new transition */ __filter_modify_flags (qp);
@@ -1339,11 +1345,12 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)struct creq_query_qp_resp resp;struct bnxt_qplib_rcfw_sbuf *sbuf;struct creq_query_qp_resp_sb *sb; -u16 cmd_flags =0 ;u32 temp32[4 ];int i, rc =0 ; -RCFW_CMD_PREP (req,QUERY_QP , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_QUERY_QP , +sizeof (req)); sbuf =bnxt_qplib_rcfw_alloc_sbuf (rcfw,sizeof (*sb));if (!sbuf)
@@ -1462,7 +1469,6 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct cmdq_destroy_qp req;struct creq_destroy_qp_resp resp; -u16 cmd_flags =0 ;u32 tbl_indx;int rc;
@@ -1470,7 +1476,9 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, rcfw->qp_tbl[tbl_indx].qp_id =BNXT_QPLIB_QP_ID_INVALID ; rcfw->qp_tbl[tbl_indx].qp_handle =NULL ; -RCFW_CMD_PREP (req,DESTROY_QP , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_DESTROY_QP , +sizeof (req)); req.qp_cid =cpu_to_le32 (qp->id); rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
@@ -2039,7 +2047,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)struct creq_create_cq_resp resp;struct bnxt_qplib_pbl *pbl;struct cmdq_create_cq req; -u16 cmd_flags =0 ;u32 pg_sz_lvl;int rc;
@@ -2052,7 +2059,9 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)if (rc) goto exit; -RCFW_CMD_PREP (req,CREATE_CQ , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_CREATE_CQ , +sizeof (req));if (!cq->dpi) { dev_err(&rcfw->pdev->dev,
@@ -2116,10 +2125,11 @@ int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq,struct cmdq_resize_cq req = {};struct bnxt_qplib_pbl *pbl;u32 pg_sz, lvl, new_sz; -u16 cmd_flags =0 ;int rc; -RCFW_CMD_PREP (req,RESIZE_CQ , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_RESIZE_CQ , +sizeof (req)); hwq_attr.sginfo = &cq->sg_info; hwq_attr.res = res; hwq_attr.depth = new_cqes;
@@ -2150,10 +2160,11 @@ int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)struct cmdq_destroy_cq req;struct creq_destroy_cq_resp resp;u16 total_cnq_events; -u16 cmd_flags =0 ;int rc; -RCFW_CMD_PREP (req,DESTROY_CQ , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_DESTROY_CQ , +sizeof (req)); req.cq_cid =cpu_to_le32 (cq->id); rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +6 -4
@@ -454,10 +454,11 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw) {struct cmdq_deinitialize_fw req;struct creq_deinitialize_fw_resp resp; -u16 cmd_flags =0 ;int rc; -RCFW_CMD_PREP (req,DEINITIALIZE_FW , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_DEINITIALIZE_FW , +sizeof (req)); rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp,NULL ,0 );if (rc)
@@ -472,11 +473,12 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, {struct creq_initialize_fw_resp resp;struct cmdq_initialize_fw req; -u16 cmd_flags =0 ;u8 pgsz, lvl;int rc; -RCFW_CMD_PREP (req,INITIALIZE_FW , cmd_flags); +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_INITIALIZE_FW , +sizeof (req));/* Supply (log-base-2-of-host-page-size - base-page-shift) * to bono to adjust the doorbell page sizes. */
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +12 -11
@@ -51,25 +51,26 @@#define RCFW_DBR_PCI_BAR_REGION 2#define RCFW_DBR_BASE_PAGE_SHIFT 12 -#define RCFW_CMD_PREP (req,CMD , cmd_flags) \ - do { \ - memset(&(req), 0, sizeof((req))); \ - (req).opcode = CMDQ_BASE_OPCODE_##CMD; \ - (req).cmd_size = sizeof((req)); \ - (req).flags = cpu_to_le16(cmd_flags); \ - } while (0) - -#define RCFW_CMD_WAIT_TIME_MS 20000/* 20 Seconds timeout */ -/* Cmdq contains a fix number of a 16-Byte slots */ struct bnxt_qplib_cmdqe {u8 data[16 ]; }; +#define BNXT_QPLIB_CMDQE_UNITS sizeof(struct bnxt_qplib_cmdqe) + +static inline void bnxt_qplib_rcfw_cmd_prep (struct cmdq_base *req, +u8 opcode,u8 cmd_size) +{ +memset (req,0 , cmd_size); + req->opcode = opcode; + req->cmd_size = cmd_size; +} + +#define RCFW_CMD_WAIT_TIME_MS 20000/* 20 Seconds timeout */ +/* CMDQ elements */ #define BNXT_QPLIB_CMDQE_MAX_CNT_256 256#define BNXT_QPLIB_CMDQE_MAX_CNT_8192 8192 -#define BNXT_QPLIB_CMDQE_UNITS sizeof(struct bnxt_qplib_cmdqe)#define BNXT_QPLIB_CMDQE_BYTES (depth) ((depth) * BNXT_QPLIB_CMDQE_UNITS)static inline u32 bnxt_qplib_cmdqe_npages (u32 depth)
drivers/infiniband/hw/bnxt_re/qplib_sp.c +47 -32
209 lines not on this page · raw message
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v3 4/7 RDMA/bnxt_re: Reduce number of argumets to control path command APIs
In reply to Selvin XavierReducing the number of arguments to bnxt_qplib_rcfw_send_message by enclosing all its arguments into a command message structure. Use the same struct while passing the command information to send_message.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 104 +++++++++++++--------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 70 +++++++-------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 25 +++++- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 138 +++++++++++++++++------------ 4 files changed, 199 insertions(+), 138 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +60 -44
@@ -581,8 +581,9 @@ void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res, struct bnxt_qplib_srq *srq) {struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_destroy_srq req; -struct creq_destroy_srq_resp resp; +struct creq_destroy_srq_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_destroy_srq req = {};int rc; bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
@@ -592,8 +593,8 @@ void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res,/* Configure the request */ req.srq_cid =cpu_to_le32 (srq->id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (struct cmdq_base *)&req, - (struct creq_base *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req),sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);kfree (srq->swq);if (rc)return ;
@@ -605,8 +606,9 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, {struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct bnxt_qplib_hwq_attr hwq_attr = {}; -struct creq_create_srq_resp resp; -struct cmdq_create_srq req; +struct creq_create_srq_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_create_srq req = {};struct bnxt_qplib_pbl *pbl;u16 pg_sz_lvl;int rc, idx;
@@ -646,8 +648,8 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, req.pd_id =cpu_to_le32 (srq->pd->id); req.eventq_id =cpu_to_le16 (srq->eventq_hw_ring_id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req),sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc) goto fail;
@@ -702,10 +704,11 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res, struct bnxt_qplib_srq *srq) {struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_query_srq req; -struct creq_query_srq_resp resp; +struct creq_query_srq_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {};struct bnxt_qplib_rcfw_sbuf *sbuf;struct creq_query_srq_resp_sb *sb; +struct cmdq_query_srq req = {};int rc =0 ; bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
@@ -719,8 +722,9 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res, req.resp_size =sizeof (*sb) /BNXT_QPLIB_CMDQE_UNITS ; req.srq_cid =cpu_to_le32 (srq->id); sb = sbuf->sb; - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, - (void *)sbuf,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp, sbuf,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg); srq->threshold =le16_to_cpu (sb->srq_limit);bnxt_qplib_rcfw_free_sbuf (rcfw, sbuf);
@@ -814,10 +818,11 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) {struct bnxt_qplib_hwq_attr hwq_attr = {};struct bnxt_qplib_rcfw *rcfw = res->rcfw; +struct creq_create_qp1_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {};struct bnxt_qplib_q *sq = &qp->sq;struct bnxt_qplib_q *rq = &qp->rq; -struct creq_create_qp1_resp resp; -struct cmdq_create_qp1 req; +struct cmdq_create_qp1 req = {};struct bnxt_qplib_pbl *pbl;u32 qp_flags =0 ;u8 pg_sz_lvl;
@@ -827,7 +832,6 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req,CMDQ_BASE_OPCODE_CREATE_QP1 ,sizeof (req)); -/* General */ req.type = qp->type; req.dpi =cpu_to_le32 (qp->dpi->dpi);
@@ -895,8 +899,8 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) req.qp_flags =cpu_to_le32 (qp_flags); req.pd_id =cpu_to_le32 (qp->pd->id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req),sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc) goto fail;
@@ -956,13 +960,14 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct bnxt_qplib_hwq_attr hwq_attr = {};struct bnxt_qplib_sg_info sginfo = {}; +struct creq_create_qp_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {};struct bnxt_qplib_q *sq = &qp->sq;struct bnxt_qplib_q *rq = &qp->rq; -struct creq_create_qp_resp resp; +struct cmdq_create_qp req = {};int rc, req_size, psn_sz =0 ;struct bnxt_qplib_hwq *xrrq;struct bnxt_qplib_pbl *pbl; -struct cmdq_create_qp req;u32 qp_flags =0 ;u8 pg_sz_lvl;u32 tbl_indx;
@@ -1103,8 +1108,9 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) } req.pd_id =cpu_to_le32 (qp->pd->id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc) goto fail;
@@ -1236,8 +1242,9 @@ static void __filter_modify_flags(struct bnxt_qplib_qp *qp)int bnxt_qplib_modify_qp (struct bnxt_qplib_res *res,struct bnxt_qplib_qp *qp) {struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_modify_qp req; -struct creq_modify_qp_resp resp; +struct creq_modify_qp_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_modify_qp req = {};u32 temp32[4 ];u32 bmask;int rc;
@@ -1330,8 +1337,8 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) req.vlan_pcp_vlan_dei_vlan_id =cpu_to_le16 (qp->vlan_id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req),sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc)return rc; qp->cur_qp_state = qp->state;
@@ -1341,10 +1348,11 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)int bnxt_qplib_query_qp (struct bnxt_qplib_res *res,struct bnxt_qplib_qp *qp) {struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_query_qp req; -struct creq_query_qp_resp resp; +struct creq_query_qp_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {};struct bnxt_qplib_rcfw_sbuf *sbuf;struct creq_query_qp_resp_sb *sb; +struct cmdq_query_qp req = {};u32 temp32[4 ];int i, rc =0 ;
@@ -1359,8 +1367,9 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) req.qp_cid =cpu_to_le32 (qp->id); req.resp_size =sizeof (*sb) /BNXT_QPLIB_CMDQE_UNITS ; - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, - (void *)sbuf,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp, sbuf,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc) goto bail;/* Extract the context from the side buffer */
@@ -1467,8 +1476,9 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) {struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_destroy_qp req; -struct creq_destroy_qp_resp resp; +struct creq_destroy_qp_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_destroy_qp req = {};u32 tbl_indx;int rc;
@@ -1481,8 +1491,9 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, sizeof(req)); req.qp_cid =cpu_to_le32 (qp->id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc) { rcfw->qp_tbl[tbl_indx].qp_id = qp->id; rcfw->qp_tbl[tbl_indx].qp_handle = qp;
@@ -2044,9 +2055,10 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) {struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct bnxt_qplib_hwq_attr hwq_attr = {}; -struct creq_create_cq_resp resp; +struct creq_create_cq_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_create_cq req = {};struct bnxt_qplib_pbl *pbl; -struct cmdq_create_cq req;u32 pg_sz_lvl;int rc;
@@ -2080,9 +2092,9 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) req.cq_fco_cnq_id =cpu_to_le32 ( (cq->cnq_hw_ring_id &CMDQ_CREATE_CQ_CNQ_ID_MASK ) <<CMDQ_CREATE_CQ_CNQ_ID_SFT ); - - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc) goto fail;
@@ -2122,6 +2134,7 @@ int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq,struct bnxt_qplib_hwq_attr hwq_attr = {};struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct creq_resize_cq_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {};struct cmdq_resize_cq req = {};struct bnxt_qplib_pbl *pbl;u32 pg_sz, lvl, new_sz;
@@ -2149,16 +2162,18 @@ int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq, req.new_cq_size_pg_size_lvl =cpu_to_le32 (new_sz | pg_sz | lvl); req.new_pbl =cpu_to_le64 (pbl->pg_map_arr[0 ]); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);return rc; }int bnxt_qplib_destroy_cq (struct bnxt_qplib_res *res,struct bnxt_qplib_cq *cq) {struct bnxt_qplib_rcfw *rcfw = res->rcfw; -struct cmdq_destroy_cq req; -struct creq_destroy_cq_resp resp; +struct creq_destroy_cq_resp resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_destroy_cq req = {};u16 total_cnq_events;int rc;
@@ -2167,8 +2182,9 @@ int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) sizeof(req)); req.cq_cid =cpu_to_le32 (cq->id); - rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void *)&resp,NULL ,0 ); +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg);if (rc)return rc; total_cnq_events =le16_to_cpu (resp.total_cnq_events);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +35 -35
162 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +22 -3
@@ -61,7 +61,6 @@ struct bnxt_qplib_cmdqe {static inline void bnxt_qplib_rcfw_cmd_prep (struct cmdq_base *req,u8 opcode,u8 cmd_size) { -memset (req,0 , cmd_size); req->opcode = opcode; req->cmd_size = cmd_size; }
@@ -191,6 +190,27 @@ struct bnxt_qplib_rcfw {u32 cmdq_depth; }; +struct bnxt_qplib_cmdqmsg { +struct cmdq_base *req; +struct creq_base *resp; +void *sb; +u32 req_sz; +u32 res_sz; +u8 block; +}; + +static inline void bnxt_qplib_fill_cmdqmsg (struct bnxt_qplib_cmdqmsg *msg, +void *req,void *resp,void *sb, +u32 req_sz,u32 res_sz,u8 block) +{ + msg->req = req; + msg->resp = resp; + msg->sb = sb; + msg->req_sz = req_sz; + msg->res_sz = res_sz; + msg->block = block; +} +void bnxt_qplib_free_rcfw_channel (struct bnxt_qplib_rcfw *rcfw); int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, struct bnxt_qplib_rcfw *rcfw,
@@ -211,8 +231,7 @@ struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf(void bnxt_qplib_rcfw_free_sbuf (struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_rcfw_sbuf *sbuf);int bnxt_qplib_rcfw_send_message (struct bnxt_qplib_rcfw *rcfw, -struct cmdq_base *req,struct creq_base *resp, -void *sbuf,u8 is_block); +struct bnxt_qplib_cmdqmsg *msg);int bnxt_qplib_deinit_rcfw (struct bnxt_qplib_rcfw *rcfw); int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
drivers/infiniband/hw/bnxt_re/qplib_sp.c +82 -56
309 lines not on this page · raw message
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v3 5/7 RDMA/bnxt_re: RoCE slow path TLV support
In reply to Selvin XavierHeader file to support TLV encapsulated commands. These functions will be used by the driver in the follow up patches.
---v2->v3:
- Fix sparse warnings
drivers/infiniband/hw/bnxt_re/qplib_tlv.h | 162 ++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 drivers/infiniband/hw/bnxt_re/qplib_tlv.h
drivers/infiniband/hw/bnxt_re/qplib_tlv.h new file +162 -0
@@ -0,0 +1,162 @@ +/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ + +#ifndef __QPLIB_TLV_H__ +#define __QPLIB_TLV_H__ + +struct roce_tlv { +struct tlv tlv; +u8 total_size;// in units of 16 byte chunks +u8 unused[7 ];// for 16 byte alignment +}; + +#define CHUNK_SIZE 16 +#define CHUNKS (x) (((x) + CHUNK_SIZE - 1) / CHUNK_SIZE) + +static inline void __roce_1st_tlv_prep (struct roce_tlv *rtlv,u8 tot_chunks, +u16 content_bytes,u8 flags) +{ + rtlv->tlv.cmd_discr =cpu_to_le16 (CMD_DISCR_TLV_ENCAP ); + rtlv->tlv.tlv_type =cpu_to_le16 (TLV_TYPE_ROCE_SP_COMMAND ); + rtlv->tlv.length =cpu_to_le16 (content_bytes); + rtlv->tlv.flags =TLV_FLAGS_REQUIRED ; + rtlv->tlv.flags |= flags ?TLV_FLAGS_MORE :0 ; + rtlv->total_size = (tot_chunks); +} + +static inline void __roce_ext_tlv_prep (struct roce_tlv *rtlv,u16 tlv_type, +u16 content_bytes,u8 more,u8 flags) +{ + rtlv->tlv.cmd_discr =cpu_to_le16 (CMD_DISCR_TLV_ENCAP ); + rtlv->tlv.tlv_type =cpu_to_le16 (tlv_type); + rtlv->tlv.length =cpu_to_le16 (content_bytes); + rtlv->tlv.flags |= more ?TLV_FLAGS_MORE :0 ; + rtlv->tlv.flags |= flags ?TLV_FLAGS_REQUIRED :0 ; +} + +/* +* TLV size in units of 16 byte chunks +*/ +#define TLV_SIZE ((sizeof(struct roce_tlv) + 15) / 16) +/* +* TLV length in bytes +*/ +#define TLV_BYTES (TLV_SIZE * 16) + +#define HAS_TLV_HEADER (msg) (le16_to_cpu(((struct tlv *)(msg))->cmd_discr) == CMD_DISCR_TLV_ENCAP) +#define GET_TLV_DATA (tlv) ((void *)&((uint8_t *)(tlv))[TLV_BYTES]) + +static inline u8 __get_cmdq_base_opcode (struct cmdq_base *req,u32 size) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) +return ((struct cmdq_base *)GET_TLV_DATA (req))->opcode; +else +return req->opcode; +} + +static inline void __set_cmdq_base_opcode (struct cmdq_base *req, +u32 size,u8 val) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) + ((struct cmdq_base *)GET_TLV_DATA (req))->opcode = val; +else + req->opcode = val; +} + +static inline __le16 __get_cmdq_base_cookie (struct cmdq_base *req,u32 size) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) +return ((struct cmdq_base *)GET_TLV_DATA (req))->cookie; +else +return req->cookie; +} + +static inline void __set_cmdq_base_cookie (struct cmdq_base *req, +u32 size,__le16 val) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) + ((struct cmdq_base *)GET_TLV_DATA (req))->cookie = val; +else + req->cookie = val; +} + +static inline __le64 __get_cmdq_base_resp_addr (struct cmdq_base *req,u32 size) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) +return ((struct cmdq_base *)GET_TLV_DATA (req))->resp_addr; +else +return req->resp_addr; +} + +static inline void __set_cmdq_base_resp_addr (struct cmdq_base *req, +u32 size,__le64 val) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) + ((struct cmdq_base *)GET_TLV_DATA (req))->resp_addr = val; +else + req->resp_addr = val; +} + +static inline u8 __get_cmdq_base_resp_size (struct cmdq_base *req,u32 size) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) +return ((struct cmdq_base *)GET_TLV_DATA (req))->resp_size; +else +return req->resp_size; +} + +static inline void __set_cmdq_base_resp_size (struct cmdq_base *req, +u32 size,u8 val) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) + ((struct cmdq_base *)GET_TLV_DATA (req))->resp_size = val; +else + req->resp_size = val; +} + +static inline u8 __get_cmdq_base_cmd_size (struct cmdq_base *req,u32 size) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) +return ((struct roce_tlv *)(req))->total_size; +else +return req->cmd_size; +} + +static inline void __set_cmdq_base_cmd_size (struct cmdq_base *req, +u32 size,u8 val) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) + ((struct cmdq_base *)GET_TLV_DATA (req))->cmd_size = val; +else + req->cmd_size = val; +} + +static inline __le16 __get_cmdq_base_flags (struct cmdq_base *req,u32 size) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) +return ((struct cmdq_base *)GET_TLV_DATA (req))->flags; +else +return req->flags; +} + +static inline void __set_cmdq_base_flags (struct cmdq_base *req, +u32 size,__le16 val) +{ +if (HAS_TLV_HEADER (req) && size >TLV_BYTES ) + ((struct cmdq_base *)GET_TLV_DATA (req))->flags = val; +else + req->flags = val; +} + +struct bnxt_qplib_tlv_modify_cc_req { +struct roce_tlv tlv_hdr; +struct cmdq_modify_roce_cc base_req; +__le64 tlvpad; +struct cmdq_modify_roce_cc_gen1_tlv ext_req; +}; + +struct bnxt_qplib_tlv_query_rcc_sb { +struct roce_tlv tlv_hdr; +struct creq_query_roce_cc_resp_sb base_sb; +struct creq_query_roce_cc_gen1_resp_sb_tlv gen1_sb; +}; +#endif /* __QPLIB_TLV_H__ */
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v3 6/7 RDAM/bnxt_re: Use tlv apis while processing the slow path commands
In reply to Selvin XavierUse the new TLV APIs for existing slow path commands. The TLV APIs will be used to populate extended headers for some of the Firmware commands, which will be introduced in the patches that follow.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +11 -11
@@ -49,6 +49,7 @@#include "qplib_rcfw.h" #include "qplib_sp.h" #include "qplib_fp.h" +#include "qplib_tlv.h" static void bnxt_qplib_service_creq (struct tasklet_struct *t);
@@ -101,7 +102,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, pdev = rcfw->pdev; - opcode = msg->req->opcode; + opcode =__get_cmdq_base_opcode (msg->req, msg->req_sz); if (!test_bit(FIRMWARE_INITIALIZED_FLAG, &cmdq->flags) && (opcode != CMDQ_BASE_OPCODE_QUERY_FUNC && opcode != CMDQ_BASE_OPCODE_INITIALIZE_FW &&
@@ -137,7 +138,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, cookie |=RCFW_CMD_IS_BLOCKING ;set_bit (cbit, cmdq->cmdq_bitmap); - msg->req->cookie =cpu_to_le16 (cookie); +__set_cmdq_base_cookie (msg->req, msg->req_sz,cpu_to_le16 (cookie)); crsqe = &rcfw->crsqe_tbl[cbit];if (crsqe->resp) {spin_unlock_irqrestore (&hwq->lock, flags);
@@ -153,13 +154,12 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,memset (msg->resp,0 ,sizeof (*msg->resp)); crsqe->resp = (struct creq_qp_event *)msg->resp; crsqe->resp->cookie = msg->req->cookie; - crsqe->req_size = msg->req->cmd_size; -if (msg->req->resp_size && msg->sb) { + crsqe->req_size =__get_cmdq_base_cmd_size (msg->req, msg->req_sz); +if (__get_cmdq_base_resp_size (msg->req, msg->req_sz) && msg->sb) {struct bnxt_qplib_rcfw_sbuf *sbuf = msg->sb; - - msg->req->resp_addr =cpu_to_le64 (sbuf->dma_addr); - msg->req->resp_size = (sbuf->size +BNXT_QPLIB_CMDQE_UNITS -1 ) / -BNXT_QPLIB_CMDQE_UNITS ; +__set_cmdq_base_resp_addr (msg->req, msg->req_sz,cpu_to_le64 (sbuf->dma_addr)); +__set_cmdq_base_resp_size (msg->req, msg->req_sz, +ALIGN (sbuf->size,BNXT_QPLIB_CMDQE_UNITS )); } preq = (u8 *)msg->req;
@@ -214,12 +214,12 @@ int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,return 0 ; do { - opcode = msg->req->opcode; + opcode = __get_cmdq_base_opcode(msg->req, msg->req_sz); rc = __send_message(rcfw, msg); - cookie = le16_to_cpu(msg->req->cookie) & RCFW_MAX_COOKIE_VALUE; + cookie = le16_to_cpu(__get_cmdq_base_cookie(msg->req, msg->req_sz)) & + RCFW_MAX_COOKIE_VALUE; if (!rc) break; - if (!retry_cnt || (rc != -EAGAIN && rc != -EBUSY)) { /* send failed */ dev_err(&rcfw->pdev->dev, "cmdq[%#x]=%#x send failed\n",
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v3 7/7 RDMA/bnxt_re: Enable congestion control by default
In reply to Selvin XavierEnable Congesion control by default. Issue FW command enable the CC during driver load and disable it during unload.
---v2->v3:
- Fix sparse warning related to cookie setting
drivers/infiniband/hw/bnxt_re/main.c | 24 ++++++- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 15 ++-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 20 ++++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 109 +++++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_sp.h | 67 ++++++++++++++++++ 5 files changed, 222 insertions(+), 13 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +23 -1
@@ -1332,6 +1332,27 @@ static int bnxt_re_add_device(struct auxiliary_device *adev, u8 wqe_mode)return rc; } +static void bnxt_re_setup_cc (struct bnxt_re_dev *rdev,bool enable) +{ +struct bnxt_qplib_cc_param cc_param = {}; + +/* Currently enabling only for GenP5 adapters */ +if (!bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx)) +return ; + +if (enable) { + cc_param.enable =1 ; + cc_param.cc_mode =CMDQ_MODIFY_ROCE_CC_CC_MODE_PROBABILISTIC_CC_MODE ; + } + + cc_param.mask = (CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_CC_MODE | +CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_ENABLE_CC | +CMDQ_MODIFY_ROCE_CC_MODIFY_MASK_TOS_ECN ); + +if (bnxt_qplib_modify_cc (&rdev->qplib_res, &cc_param)) +ibdev_err (&rdev->ibdev,"Failed to setup CC enable = %d\n" , enable); +} +/* * "Notifier chain callback can be invoked for the same chain from * different CPUs at the same time".
@@ -1400,7 +1421,7 @@ static void bnxt_re_remove(struct auxiliary_device *adev)*/ goto skip_remove; } - +bnxt_re_setup_cc (rdev, false);ib_unregister_device (&rdev->ibdev);ib_dealloc_device (&rdev->ibdev);bnxt_re_dev_uninit (rdev);
@@ -1432,6 +1453,7 @@ static int bnxt_re_probe(struct auxiliary_device *adev, goto err; } +bnxt_re_setup_cc (rdev, true);mutex_unlock (&bnxt_re_mutex);return 0 ;
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +7 -8
@@ -96,7 +96,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,u32 sw_prod, cmdq_prod;struct pci_dev *pdev;unsigned long flags; -u32 size, opcode; +u32 bsize, opcode;u16 cookie, cbit;u8 *preq;
@@ -145,15 +145,14 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,return -EBUSY ; } - size = msg->req->cmd_size;/* change the cmd_size to the number of 16byte cmdq unit. * req->cmd_size is modified here */ -bnxt_qplib_set_cmd_slots (msg->req); + bsize =bnxt_qplib_set_cmd_slots (msg->req);memset (msg->resp,0 ,sizeof (*msg->resp)); crsqe->resp = (struct creq_qp_event *)msg->resp; - crsqe->resp->cookie = msg->req->cookie; + crsqe->resp->cookie =cpu_to_le16 (cookie); crsqe->req_size =__get_cmdq_base_cmd_size (msg->req, msg->req_sz);if (__get_cmdq_base_resp_size (msg->req, msg->req_sz) && msg->sb) {struct bnxt_qplib_rcfw_sbuf *sbuf = msg->sb;
@@ -174,11 +173,11 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, }/* Copy a segment of the req cmd to the cmdq */ memset (cmdqe,0 ,sizeof (*cmdqe)); -memcpy (cmdqe, preq,min_t (u32, size,sizeof (*cmdqe))); - preq +=min_t (u32, size,sizeof (*cmdqe)); - size -=min_t (u32, size,sizeof (*cmdqe)); +memcpy (cmdqe, preq,min_t (u32, bsize,sizeof (*cmdqe))); + preq +=min_t (u32, bsize,sizeof (*cmdqe)); + bsize -=min_t (u32, bsize,sizeof (*cmdqe)); hwq->prod++; - }while (size >0 ); + }while (bsize >0 ); cmdq->seq_num++; cmdq_prod = hwq->prod;
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +16 -4
@@ -39,6 +39,8 @@#ifndef __BNXT_QPLIB_RCFW_H__#define __BNXT_QPLIB_RCFW_H__ +#include "qplib_tlv.h" +#define RCFW_CMDQ_TRIG_VAL 1#define RCFW_COMM_PCI_BAR_REGION 0#define RCFW_COMM_CONS_PCI_BAR_REGION 2
@@ -87,11 +89,21 @@ static inline u32 bnxt_qplib_cmdqe_page_size(u32 depth)return (bnxt_qplib_cmdqe_npages (depth) *PAGE_SIZE ); } -/* Set the cmd_size to a factor of CMDQE unit */ -static inline void bnxt_qplib_set_cmd_slots (struct cmdq_base *req) +static inline u32 bnxt_qplib_set_cmd_slots (struct cmdq_base *req) { - req->cmd_size = (req->cmd_size +BNXT_QPLIB_CMDQE_UNITS -1 ) / -BNXT_QPLIB_CMDQE_UNITS ; +u32 cmd_byte =0 ; + +if (HAS_TLV_HEADER (req)) { +struct roce_tlv *tlv_req = (struct roce_tlv *)req; + + cmd_byte = tlv_req->total_size *BNXT_QPLIB_CMDQE_UNITS ; + }else { + cmd_byte = req->cmd_size; + req->cmd_size = (req->cmd_size +BNXT_QPLIB_CMDQE_UNITS -1 ) / +BNXT_QPLIB_CMDQE_UNITS ; + } + +return cmd_byte; }#define RCFW_MAX_COOKIE_VALUE 0x7FFF
drivers/infiniband/hw/bnxt_re/qplib_sp.c +109 -0
118 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_sp.h +67 -0
78 lines not on this page · raw message
Signature · 1 line
2.5.5
Leon Romanovsky
AppliedQuoted 11 lines · Selvin Xavier
This series includes the code reorgnization in the driver control path. HW interface header file is updated to the latest version. Also, adds support for a new command format which is required for enabling RoCE congestion control.
This series is prepared on top of the
resize_cq
(https://lore.kernel.org/all/[email protected]/)
patch which is under review.[...]
Applied, thanks!
[1/7] RDMA/bnxt_re: Update HW interface headers
https://git.kernel.org/rdma/rdma/c/a9a457f338e771 [2/7] RDMA/bnxt_re: Remove HW queue mapping from RoCE Driver https://git.kernel.org/rdma/rdma/c/b400acee0622d5 [3/7] RDMA/bnxt_re: Convert RCFW_CMD_PREP macro to static inline function https://git.kernel.org/rdma/rdma/c/e576adf583b525 [4/7] RDMA/bnxt_re: Reduce number of argumets to control path command APIs https://git.kernel.org/rdma/rdma/c/ff015bcd213b5d [5/7] RDMA/bnxt_re: RoCE slow path TLV support https://git.kernel.org/rdma/rdma/c/0722f1f7bf85c8 [6/7] RDAM/bnxt_re: Use tlv apis while processing the slow path commands https://git.kernel.org/rdma/rdma/c/c682c6eda08140 [7/7] RDMA/bnxt_re: Enable congestion control by default https://git.kernel.org/rdma/rdma/c/f13bcef04ba046
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>