RDMA/bnxt_re: Bug fixes
Subsystems (2)
v3 cover RDMA/bnxt_re: Bug fixes
The patch series has some bug fixes for bnxt_re driver. This series includes implementation of some of the workarounds required for the HW and FW and removes the FMR verb support from the driver. The driver version is also updated in this series. I have addressed all the review comments from Leon and Dennis in this series.
Doug,
Please review and apply these changes to your repository.
Thanks,
Selvin Xavier
v2 -> v3:
- Updates the commit log for the module version change patch
- Removes temp variables from one of the patches
- Fixes memory leak in one of the patches.
- Removes the FMR verbs support
v1 -> v2:
- Changes suggested by Leon in one of the patches
- Updates commit message with more description
- Disables FMR support using a config option
Devesh Sharma (3):
RDMA/bnxt_re: Fixing the Control path command and response handling RDMA/bnxt_re: Free doorbell page index (DPI) during dealloc ucontext RDMA/bnxt_re: Fix RQE posting logic
Eddie Wai (2):
RDMA/bnxt_re: HW workarounds for handling specific conditions RDMA/bnxt_re: Fixed the max_rd_atomic support for initiator and
destination QP
Kalesh AP (1):
RDMA/bnxt_re: Add vlan tag for untagged RoCE traffic when PFC is
configured
Selvin Xavier (5):
RDMA/bnxt_re: Dereg MR in FW before freeing the fast_reg_page_list RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails RDMA/bnxt_re: Report supported value to IB stack in query_device RDMA/bnxt_re: Sync up the module version to internal release version RDMA/bnxt_re: Remove FMR support
Somnath Kotur (4):
RDMA/bnxt_re: Fix race between netdev register and unregister events RDMA/bnxt_re: Add HW workaround for avoiding stall for UD QPs RDMA/bnxt_re: Fix WQE Size posted to HW to prevent it from throwing
error
RDMA/bnxt_re: Specify RDMA component when allocating stats context
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 21 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 593 ++++++++++++++++++++--------- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 25 +- drivers/infiniband/hw/bnxt_re/main.c | 97 ++++- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 393 ++++++++++--------- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 18 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 314 +++++++-------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 61 +-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 10 + drivers/infiniband/hw/bnxt_re/qplib_res.h | 6 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 412 +++++++------------- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 4 + drivers/infiniband/hw/bnxt_re/roce_hsi.h | 4 +- 13 files changed, 1105 insertions(+), 853 deletions(-)
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1495169074-12641-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]
PATCH v3 1/15 RDMA/bnxt_re: Fixing the Control path command and response handling
From: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]>
Fixing a concurrency issue with creq handling. Each caller was given a globally managed crsq element, which was accessed outside a lock. This could result in corruption, if lot of applications are simultaneously issuing Control Path commands. Now, each caller will provide its own response buffer and the responses will be copied under a lock.
Also, Fixing the queue full condition check for the CMDQ.
As a part of these changes, the control path code is refactored to remove the code replication in the response status checking.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 215 +++++-------------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 314 ++++++++++++++------------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 61 ++---- drivers/infiniband/hw/bnxt_re/qplib_res.h | 5 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 328 +++++++---------------------- 5 files changed, 318 insertions(+), 605 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +51 -164
@@ -284,7 +284,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) {struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct cmdq_create_qp1 req; -struct creq_create_qp1_resp *resp; +struct creq_create_qp1_resp resp;struct bnxt_qplib_pbl *pbl;struct bnxt_qplib_q *sq = &qp->sq;struct bnxt_qplib_q *rq = &qp->rq;
@@ -394,31 +394,12 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) req.pd_id =cpu_to_le32 (qp->pd->id); - resp = (struct creq_create_qp1_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, -NULL ,0 ); -if (!resp) { -dev_err (&res->pdev->dev,"QPLIB: FP: CREATE_QP1 send failed" ); - rc = -EINVAL ; - goto fail; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_QP1 timed out" ); - rc = -ETIMEDOUT ; - goto fail; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_QP1 failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); - rc = -EINVAL ; + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, + (void *)&resp,NULL ,0 ); +if (rc) goto fail; - } - qp->id =le32_to_cpu (resp->xid); + + qp->id =le32_to_cpu (resp.xid); qp->cur_qp_state =CMDQ_MODIFY_QP_NEW_STATE_RESET ; sq->flush_in_progress = false; rq->flush_in_progress = false;
@@ -442,7 +423,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct sq_send *hw_sq_send_hdr, **hw_sq_send_ptr;struct cmdq_create_qp req; -struct creq_create_qp_resp *resp; +struct creq_create_qp_resp resp;struct bnxt_qplib_pbl *pbl;struct sq_psn_search **psn_search_ptr;unsigned long int psn_search, poff =0 ;
@@ -627,31 +608,12 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) } req.pd_id =cpu_to_le32 (qp->pd->id); - resp = (struct creq_create_qp_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, -NULL ,0 ); -if (!resp) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_QP send failed" ); - rc = -EINVAL ; - goto fail; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_QP timed out" ); - rc = -ETIMEDOUT ; - goto fail; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_QP failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); - rc = -EINVAL ; + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, + (void *)&resp,NULL ,0 ); +if (rc) goto fail; - } - qp->id =le32_to_cpu (resp->xid); + + qp->id =le32_to_cpu (resp.xid); qp->cur_qp_state =CMDQ_MODIFY_QP_NEW_STATE_RESET ; sq->flush_in_progress = false; rq->flush_in_progress = false;
@@ -769,10 +731,11 @@ 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;u16 cmd_flags =0 , pkey;u32 temp32[4 ];u32 bmask; +int rc;RCFW_CMD_PREP (req,MODIFY_QP , cmd_flags);
@@ -862,27 +825,10 @@ 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); - resp = (struct creq_modify_qp_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, -NULL ,0 ); -if (!resp) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: MODIFY_QP send failed" ); -return -EINVAL ; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: MODIFY_QP timed out" ); -return -ETIMEDOUT ; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: MODIFY_QP failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); -return -EINVAL ; - } + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, + (void *)&resp,NULL ,0 ); +if (rc) +return rc; qp->cur_qp_state = qp->state;return 0 ; }
@@ -891,37 +837,26 @@ 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_rcfw_sbuf *sbuf;struct creq_query_qp_resp_sb *sb;u16 cmd_flags =0 ;u32 temp32[4 ]; -int i; +int i, rc =0 ;RCFW_CMD_PREP (req,QUERY_QP , cmd_flags); + sbuf =bnxt_qplib_rcfw_alloc_sbuf (rcfw,sizeof (*sb)); +if (!sbuf) +return -ENOMEM ; + sb = sbuf->sb; + req.qp_cid =cpu_to_le32 (qp->id); req.resp_size =sizeof (*sb) /BNXT_QPLIB_CMDQE_UNITS ; - resp = (struct creq_query_qp_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, - (void **)&sb,0 ); -if (!resp) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: QUERY_QP send failed" ); -return -EINVAL ; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: QUERY_QP timed out" ); -return -ETIMEDOUT ; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: QUERY_QP failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); -return -EINVAL ; - } + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, + (void *)sbuf,0 ); +if (rc) + goto bail;/* Extract the context from the side buffer */ qp->state = sb->en_sqd_async_notify_state &CREQ_QUERY_QP_RESP_SB_STATE_MASK ;
@@ -976,7 +911,9 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) qp->dest_qpn =le32_to_cpu (sb->dest_qp_id);memcpy (qp->smac, sb->src_mac,6 ); qp->vlan_id =le16_to_cpu (sb->vlan_pcp_vlan_dei_vlan_id); -return 0 ; +bail: +bnxt_qplib_rcfw_free_sbuf (rcfw, sbuf); +return rc; }static void __clean_cq (struct bnxt_qplib_cq *cq,u64 qp)
@@ -1021,34 +958,18 @@ 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; +struct creq_destroy_qp_resp resp;unsigned long flags;u16 cmd_flags =0 ; +int rc;RCFW_CMD_PREP (req,DESTROY_QP , cmd_flags); req.qp_cid =cpu_to_le32 (qp->id); - resp = (struct creq_destroy_qp_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, -NULL ,0 ); -if (!resp) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: DESTROY_QP send failed" ); -return -EINVAL ; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: DESTROY_QP timed out" ); -return -ETIMEDOUT ; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: DESTROY_QP failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); -return -EINVAL ; - } + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, + (void *)&resp,NULL ,0 ); +if (rc) +return rc;/* Must walk the associated CQs to nullified the QP ptr */ spin_lock_irqsave (&qp->scq->hwq.lock, flags);
@@ -1483,7 +1404,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) {struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct cmdq_create_cq req; -struct creq_create_cq_resp *resp; +struct creq_create_cq_resp resp;struct bnxt_qplib_pbl *pbl;u16 cmd_flags =0 ;int rc;
@@ -1525,30 +1446,12 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) (cq->cnq_hw_ring_id &CMDQ_CREATE_CQ_CNQ_ID_MASK ) << CMDQ_CREATE_CQ_CNQ_ID_SFT); - resp = (struct creq_create_cq_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, -NULL ,0 ); -if (!resp) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_CQ send failed" ); -return -EINVAL ; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_CQ timed out" ); - rc = -ETIMEDOUT ; - goto fail; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: CREATE_CQ failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); - rc = -EINVAL ; + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, + (void *)&resp,NULL ,0 ); +if (rc) goto fail; - } - cq->id =le32_to_cpu (resp->xid); + + cq->id =le32_to_cpu (resp.xid); cq->dbr_base = res->dpi_tbl.dbr_bar_reg_iomem; cq->period =BNXT_QPLIB_QUEUE_START_PERIOD ;init_waitqueue_head (&cq->waitq);
@@ -1566,33 +1469,17 @@ 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;u16 cmd_flags =0 ; +int rc;RCFW_CMD_PREP (req,DESTROY_CQ , cmd_flags); req.cq_cid =cpu_to_le32 (cq->id); - resp = (struct creq_destroy_cq_resp *) -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, -NULL ,0 ); -if (!resp) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: DESTROY_CQ send failed" ); -return -EINVAL ; - } -if (!bnxt_qplib_rcfw_wait_for_resp (rcfw,le16_to_cpu (req.cookie))) { -/* Cmd timed out */ -dev_err (&rcfw->pdev->dev,"QPLIB: FP: DESTROY_CQ timed out" ); -return -ETIMEDOUT ; - } -if (resp->status || -le16_to_cpu (resp->cookie) !=le16_to_cpu (req.cookie)) { -dev_err (&rcfw->pdev->dev,"QPLIB: FP: DESTROY_CQ failed " ); -dev_err (&rcfw->pdev->dev, -"QPLIB: with status 0x%x cmdq 0x%x resp 0x%x" , - resp->status,le16_to_cpu (req.cookie), -le16_to_cpu (resp->cookie)); -return -EINVAL ; - } + rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, + (void *)&resp,NULL ,0 ); +if (rc) +return rc;bnxt_qplib_free_hwq (res->pdev, &cq->hwq);return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +164 -150
511 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +20 -41
101 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_res.h +5 -0
@@ -48,6 +48,11 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;#define HWQ_CMP (idx, hwq) ((idx) & ((hwq)->max_elements - 1)) +#define HWQ_FREE_SLOTS (hwq) (hwq->max_elements - \ + ((HWQ_CMP(hwq->prod, hwq)\ + - HWQ_CMP(hwq->cons, hwq))\ + & (hwq->max_elements - 1))) +enum bnxt_qplib_hwq_type {HWQ_TYPE_CTX ,HWQ_TYPE_QUEUE ,
drivers/infiniband/hw/bnxt_re/qplib_sp.c +78 -250
484 lines not on this page · raw message
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/15 RDMA/bnxt_re: HW workarounds for handling specific conditions
In reply to a message not in the archiveFrom: Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]>
This patch implements the following HW workarounds
1. The SQ depth needs to be augmented by 128 + 1 to avoid running into an Out of order CQE issue
2. Workaround to handle the problem where the HW fast path engine continues to access DMA memory in retranmission mode even after the WQE has already been completed. If the HW reports this condition, driver detects it and posts a Fence WQE. The driver stops reporting the completions to stack until it receives completion for Fence WQE.
---
v2 -> v3 :
- Fixes the memory leak pointed out by Leon
v1 -> v2 :
- Small Correction in the commit message
- Fixes q_full_delta for SQ by setting it to 128
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 373 ++++++++++++++++++++++++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 15 ++ drivers/infiniband/hw/bnxt_re/qplib_fp.c | 165 +++++++++++-- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 17 +- drivers/infiniband/hw/bnxt_re/qplib_res.h | 1 - drivers/infiniband/hw/bnxt_re/qplib_sp.c | 5 + drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 + 7 files changed, 508 insertions(+), 70 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +326 -47
@@ -61,6 +61,48 @@#include "ib_verbs.h" #include <rdma/bnxt_re-abi.h> +static int __from_ib_access_flags (int iflags) +{ +int qflags =0 ; + +if (iflags &IB_ACCESS_LOCAL_WRITE ) + qflags |=BNXT_QPLIB_ACCESS_LOCAL_WRITE ; +if (iflags &IB_ACCESS_REMOTE_READ ) + qflags |=BNXT_QPLIB_ACCESS_REMOTE_READ ; +if (iflags &IB_ACCESS_REMOTE_WRITE ) + qflags |=BNXT_QPLIB_ACCESS_REMOTE_WRITE ; +if (iflags &IB_ACCESS_REMOTE_ATOMIC ) + qflags |=BNXT_QPLIB_ACCESS_REMOTE_ATOMIC ; +if (iflags &IB_ACCESS_MW_BIND ) + qflags |=BNXT_QPLIB_ACCESS_MW_BIND ; +if (iflags &IB_ZERO_BASED ) + qflags |=BNXT_QPLIB_ACCESS_ZERO_BASED ; +if (iflags &IB_ACCESS_ON_DEMAND ) + qflags |=BNXT_QPLIB_ACCESS_ON_DEMAND ; +return qflags; +}; + +static enum ib_access_flags __to_ib_access_flags (int qflags) +{ +enum ib_access_flags iflags =0 ; + +if (qflags &BNXT_QPLIB_ACCESS_LOCAL_WRITE ) + iflags |=IB_ACCESS_LOCAL_WRITE ; +if (qflags &BNXT_QPLIB_ACCESS_REMOTE_WRITE ) + iflags |=IB_ACCESS_REMOTE_WRITE ; +if (qflags &BNXT_QPLIB_ACCESS_REMOTE_READ ) + iflags |=IB_ACCESS_REMOTE_READ ; +if (qflags &BNXT_QPLIB_ACCESS_REMOTE_ATOMIC ) + iflags |=IB_ACCESS_REMOTE_ATOMIC ; +if (qflags &BNXT_QPLIB_ACCESS_MW_BIND ) + iflags |=IB_ACCESS_MW_BIND ; +if (qflags &BNXT_QPLIB_ACCESS_ZERO_BASED ) + iflags |=IB_ZERO_BASED ; +if (qflags &BNXT_QPLIB_ACCESS_ON_DEMAND ) + iflags |=IB_ACCESS_ON_DEMAND ; +return iflags; +}; +static int bnxt_re_build_sgl (struct ib_sge *ib_sg_list,struct bnxt_qplib_sge *sg_list,int num) {
@@ -410,6 +452,158 @@ enum rdma_link_layer bnxt_re_get_link_layer(struct ib_device *ibdev,return IB_LINK_LAYER_ETHERNET ; } +#define BNXT_RE_FENCE_PBL_SIZE DIV_ROUND_UP(BNXT_RE_FENCE_BYTES, PAGE_SIZE) + +static void bnxt_re_create_fence_wqe (struct bnxt_re_pd *pd) +{ +struct bnxt_re_fence_data *fence = &pd->fence; +struct ib_mr *ib_mr = &fence->mr->ib_mr; +struct bnxt_qplib_swqe *wqe = &fence->bind_wqe; + +memset (wqe,0 ,sizeof (*wqe)); + wqe->type =BNXT_QPLIB_SWQE_TYPE_BIND_MW ; + wqe->wr_id =BNXT_QPLIB_FENCE_WRID ; + wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP ; + wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_UC_FENCE ; + wqe->bind.zero_based = false; + wqe->bind.parent_l_key = ib_mr->lkey; + wqe->bind.va = (u64 )fence->va; + wqe->bind.length = fence->size; + wqe->bind.access_cntl =__from_ib_access_flags (IB_ACCESS_REMOTE_READ ); + wqe->bind.mw_type =SQ_BIND_MW_TYPE_TYPE1 ; + +/* Save the initial rkey in fence structure for now; +* wqe->bind.r_key will be set at (re)bind time. +*/ + fence->bind_rkey =ib_inc_rkey (fence->mw->rkey); +} + +static int bnxt_re_bind_fence_mw (struct bnxt_qplib_qp *qplib_qp) +{ + struct bnxt_re_qp *qp = container_of(qplib_qp, struct bnxt_re_qp, + qplib_qp); +struct ib_pd *ib_pd = qp->ib_qp.pd; + struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd); +struct bnxt_re_fence_data *fence = &pd->fence; +struct bnxt_qplib_swqe *fence_wqe = &fence->bind_wqe; +struct bnxt_qplib_swqe wqe; +int rc; + +memcpy (&wqe, fence_wqe,sizeof (wqe)); + wqe.bind.r_key = fence->bind_rkey; + fence->bind_rkey =ib_inc_rkey (fence->bind_rkey); + +dev_dbg (rdev_to_dev (qp->rdev), +"Posting bind fence-WQE: rkey: %#x QP: %d PD: %p\n" , + wqe.bind.r_key, qp->qplib_qp.id, pd); + rc =bnxt_qplib_post_send (&qp->qplib_qp, &wqe); +if (rc) { +dev_err (rdev_to_dev (qp->rdev),"Failed to bind fence-WQE\n" ); +return rc; + } +bnxt_qplib_post_send_db (&qp->qplib_qp); + +return rc; +} + +static void bnxt_re_destroy_fence_mr (struct bnxt_re_pd *pd) +{ +struct bnxt_re_fence_data *fence = &pd->fence; +struct bnxt_re_dev *rdev = pd->rdev; +struct device *dev = &rdev->en_dev->pdev->dev; +struct bnxt_re_mr *mr = fence->mr; + +if (fence->mw) { +bnxt_re_dealloc_mw (fence->mw); + fence->mw =NULL ; + } +if (mr) { +if (mr->ib_mr.rkey) +bnxt_qplib_dereg_mrw (&rdev->qplib_res, &mr->qplib_mr, + true); +if (mr->ib_mr.lkey) +bnxt_qplib_free_mrw (&rdev->qplib_res, &mr->qplib_mr); +kfree (mr); + fence->mr =NULL ; + } +if (fence->dma_addr) { +dma_unmap_single (dev, fence->dma_addr,BNXT_RE_FENCE_BYTES , +DMA_BIDIRECTIONAL ); + fence->dma_addr =0 ; + } +} + +static int bnxt_re_create_fence_mr (struct bnxt_re_pd *pd) +{ +int mr_access_flags =IB_ACCESS_LOCAL_WRITE |IB_ACCESS_MW_BIND ; +struct bnxt_re_fence_data *fence = &pd->fence; +struct bnxt_re_dev *rdev = pd->rdev; +struct device *dev = &rdev->en_dev->pdev->dev; +struct bnxt_re_mr *mr =NULL ; +dma_addr_t dma_addr =0 ; +struct ib_mw *mw; +u64 pbl_tbl; +int rc; + + dma_addr =dma_map_single (dev, fence->va,BNXT_RE_FENCE_BYTES , +DMA_BIDIRECTIONAL ); + rc =dma_mapping_error (dev, dma_addr); +if (rc) { +dev_err (rdev_to_dev (rdev),"Failed to dma-map fence-MR-mem\n" ); + rc = -EIO ; + fence->dma_addr =0 ; + goto fail; + } + fence->dma_addr = dma_addr; + +/* Allocate a MR */ + mr =kzalloc (sizeof (*mr),GFP_KERNEL ); +if (!mr) { + rc = -ENOMEM ; + goto fail; + } + fence->mr = mr; + mr->rdev = rdev; + mr->qplib_mr.pd = &pd->qplib_pd; + mr->qplib_mr.type =CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR ; + mr->qplib_mr.flags =__from_ib_access_flags (mr_access_flags); + rc =bnxt_qplib_alloc_mrw (&rdev->qplib_res, &mr->qplib_mr); +if (rc) { +dev_err (rdev_to_dev (rdev),"Failed to alloc fence-HW-MR\n" ); + goto fail; + } + +/* Register MR */ + mr->ib_mr.lkey = mr->qplib_mr.lkey; + mr->qplib_mr.va = (u64 )fence->va; + mr->qplib_mr.total_size =BNXT_RE_FENCE_BYTES ; + pbl_tbl = dma_addr; + rc =bnxt_qplib_reg_mr (&rdev->qplib_res, &mr->qplib_mr, &pbl_tbl, +BNXT_RE_FENCE_PBL_SIZE , false); +if (rc) { +dev_err (rdev_to_dev (rdev),"Failed to register fence-MR\n" ); + goto fail; + } + mr->ib_mr.rkey = mr->qplib_mr.rkey; + +/* Create a fence MW only for kernel consumers */ + mw =bnxt_re_alloc_mw (&pd->ib_pd,IB_MW_TYPE_1 ,NULL ); +if (!mw) { +dev_err (rdev_to_dev (rdev), +"Failed to create fence-MW for PD: %p\n" , pd); + rc = -EINVAL ; + goto fail; + } + fence->mw = mw; + +bnxt_re_create_fence_wqe (pd); +return 0 ; + +fail: +bnxt_re_destroy_fence_mr (pd); +return rc; +} +/* Protection Domains */ int bnxt_re_dealloc_pd (struct ib_pd *ib_pd) {
@@ -417,6 +611,7 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd)struct bnxt_re_dev *rdev = pd->rdev;int rc; +bnxt_re_destroy_fence_mr (pd);if (ib_pd->uobject && pd->dpi.dbr) {struct ib_ucontext *ib_uctx = ib_pd->uobject->context;struct bnxt_re_ucontext *ucntx;
@@ -498,6 +693,10 @@ struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev, } } +if (!udata) +if (bnxt_re_create_fence_mr (pd)) +dev_warn (rdev_to_dev (rdev), +"Failed to create Fence-MR\n" );return &pd->ib_pd; dbfail: (void)bnxt_qplib_dealloc_pd(&rdev->qplib_res, &rdev->qplib_res.pd_tbl,
@@ -848,12 +1047,16 @@ static struct bnxt_re_qp *bnxt_re_create_shadow_qp/* Shadow QP SQ depth should be same as QP1 RQ depth */ qp->qplib_qp.sq.max_wqe = qp1_qp->rq.max_wqe; qp->qplib_qp.sq.max_sge =2 ; +/* Q full delta can be 1 since it is internal QP */ + qp->qplib_qp.sq.q_full_delta =1 ; qp->qplib_qp.scq = qp1_qp->scq; qp->qplib_qp.rcq = qp1_qp->rcq; qp->qplib_qp.rq.max_wqe = qp1_qp->rq.max_wqe; qp->qplib_qp.rq.max_sge = qp1_qp->rq.max_sge; +/* Q full delta can be 1 since it is internal QP */ + qp->qplib_qp.rq.q_full_delta =1 ; qp->qplib_qp.mtu = qp1_qp->mtu;
@@ -916,10 +1119,6 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, qp->qplib_qp.sig_type = ((qp_init_attr->sq_sig_type ==IB_SIGNAL_ALL_WR ) ? true : false); - entries =roundup_pow_of_two (qp_init_attr->cap.max_send_wr +1 ); - qp->qplib_qp.sq.max_wqe =min_t (u32, entries, - dev_attr->max_qp_wqes +1 ); - qp->qplib_qp.sq.max_sge = qp_init_attr->cap.max_send_sge;if (qp->qplib_qp.sq.max_sge > dev_attr->max_qp_sges) qp->qplib_qp.sq.max_sge = dev_attr->max_qp_sges;
@@ -958,6 +1157,9 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, qp->qplib_qp.rq.max_wqe =min_t (u32, entries, dev_attr->max_qp_wqes +1 ); + qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe - + qp_init_attr->cap.max_recv_wr; + qp->qplib_qp.rq.max_sge = qp_init_attr->cap.max_recv_sge;if (qp->qplib_qp.rq.max_sge > dev_attr->max_qp_sges) qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges;
@@ -966,6 +1168,12 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, qp->qplib_qp.mtu =ib_mtu_enum_to_int (iboe_get_mtu (rdev->netdev->mtu));if (qp_init_attr->qp_type ==IB_QPT_GSI ) { +/* Allocate 1 more than what's provided */ + entries =roundup_pow_of_two (qp_init_attr->cap.max_send_wr +1 ); + qp->qplib_qp.sq.max_wqe =min_t (u32, entries, + dev_attr->max_qp_wqes +1 ); + qp->qplib_qp.sq.q_full_delta = qp->qplib_qp.sq.max_wqe - + qp_init_attr->cap.max_send_wr; qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges;if (qp->qplib_qp.rq.max_sge > dev_attr->max_qp_sges) qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges;
@@ -1005,6 +1213,22 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, } }else { +/* Allocate 128 + 1 more than what's provided */ + entries =roundup_pow_of_two (qp_init_attr->cap.max_send_wr + +BNXT_QPLIB_RESERVED_QP_WRS +1 ); + qp->qplib_qp.sq.max_wqe =min_t (u32, entries, + dev_attr->max_qp_wqes + +BNXT_QPLIB_RESERVED_QP_WRS +1 ); + qp->qplib_qp.sq.q_full_delta =BNXT_QPLIB_RESERVED_QP_WRS +1 ; + +/* +* Reserving one slot for Phantom WQE. Application can +* post one extra entry in this case. But allowing this to avoid +* unexpected Queue full condition +*/ + + qp->qplib_qp.sq.q_full_delta -=1 ; + qp->qplib_qp.max_rd_atomic = dev_attr->max_qp_rd_atom; qp->qplib_qp.max_dest_rd_atomic = dev_attr->max_qp_init_rd_atom;if (udata) {
@@ -1128,48 +1352,6 @@ static enum ib_mtu __to_ib_mtu(u32 mtu) } } -static int __from_ib_access_flags (int iflags) -{ -int qflags =0 ; - -if (iflags &IB_ACCESS_LOCAL_WRITE ) - qflags |=BNXT_QPLIB_ACCESS_LOCAL_WRITE ; -if (iflags &IB_ACCESS_REMOTE_READ ) - qflags |=BNXT_QPLIB_ACCESS_REMOTE_READ ; -if (iflags &IB_ACCESS_REMOTE_WRITE ) - qflags |=BNXT_QPLIB_ACCESS_REMOTE_WRITE ; -if (iflags &IB_ACCESS_REMOTE_ATOMIC ) - qflags |=BNXT_QPLIB_ACCESS_REMOTE_ATOMIC ; -if (iflags &IB_ACCESS_MW_BIND ) - qflags |=BNXT_QPLIB_ACCESS_MW_BIND ; -if (iflags &IB_ZERO_BASED ) - qflags |=BNXT_QPLIB_ACCESS_ZERO_BASED ; -if (iflags &IB_ACCESS_ON_DEMAND ) - qflags |=BNXT_QPLIB_ACCESS_ON_DEMAND ; -return qflags; -}; - -static enum ib_access_flags __to_ib_access_flags (int qflags) -{ -enum ib_access_flags iflags =0 ; - -if (qflags &BNXT_QPLIB_ACCESS_LOCAL_WRITE ) - iflags |=IB_ACCESS_LOCAL_WRITE ; -if (qflags &BNXT_QPLIB_ACCESS_REMOTE_WRITE ) - iflags |=IB_ACCESS_REMOTE_WRITE ; -if (qflags &BNXT_QPLIB_ACCESS_REMOTE_READ ) - iflags |=IB_ACCESS_REMOTE_READ ; -if (qflags &BNXT_QPLIB_ACCESS_REMOTE_ATOMIC ) - iflags |=IB_ACCESS_REMOTE_ATOMIC ; -if (qflags &BNXT_QPLIB_ACCESS_MW_BIND ) - iflags |=IB_ACCESS_MW_BIND ; -if (qflags &BNXT_QPLIB_ACCESS_ZERO_BASED ) - iflags |=IB_ZERO_BASED ; -if (qflags &BNXT_QPLIB_ACCESS_ON_DEMAND ) - iflags |=IB_ACCESS_ON_DEMAND ; -return iflags; -}; -static int bnxt_re_modify_shadow_qp (struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp1_qp,int qp_attr_mask)
@@ -1376,11 +1558,21 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, entries =roundup_pow_of_two (qp_attr->cap.max_send_wr); qp->qplib_qp.sq.max_wqe =min_t (u32, entries, dev_attr->max_qp_wqes +1 ); + qp->qplib_qp.sq.q_full_delta = qp->qplib_qp.sq.max_wqe - + qp_attr->cap.max_send_wr; +/* +* Reserving one slot for Phantom WQE. Some application can +* post one extra entry in this case. Allowing this to avoid +* unexpected Queue full condition +*/ + qp->qplib_qp.sq.q_full_delta -=1 ; qp->qplib_qp.sq.max_sge = qp_attr->cap.max_send_sge;if (qp->qplib_qp.rq.max_wqe) { entries =roundup_pow_of_two (qp_attr->cap.max_recv_wr); qp->qplib_qp.rq.max_wqe =min_t (u32, entries, dev_attr->max_qp_wqes +1 ); + qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe - + qp_attr->cap.max_recv_wr; qp->qplib_qp.rq.max_sge = qp_attr->cap.max_recv_sge; }else {/* SRQ was used prior, just ignore the RQ caps */
@@ -2641,12 +2833,36 @@ static void bnxt_re_process_res_ud_wc(struct ib_wc *wc, wc->opcode =IB_WC_RECV_RDMA_WITH_IMM ; } +static int send_phantom_wqe (struct bnxt_re_qp *qp) +{ +struct bnxt_qplib_qp *lib_qp = &qp->qplib_qp; +unsigned long flags; +int rc =0 ; + +spin_lock_irqsave (&qp->sq_lock, flags); + + rc =bnxt_re_bind_fence_mw (lib_qp); +if (!rc) { + lib_qp->sq.phantom_wqe_cnt++; +dev_dbg (&lib_qp->sq.hwq.pdev->dev, +"qp %#x sq->prod %#x sw_prod %#x phantom_wqe_cnt %d\n" , + lib_qp->id, lib_qp->sq.hwq.prod, +HWQ_CMP (lib_qp->sq.hwq.prod, &lib_qp->sq.hwq), + lib_qp->sq.phantom_wqe_cnt); + } + +spin_unlock_irqrestore (&qp->sq_lock, flags); +return rc; +} +int bnxt_re_poll_cq (struct ib_cq *ib_cq,int num_entries,struct ib_wc *wc) { struct bnxt_re_cq *cq = container_of(ib_cq, struct bnxt_re_cq, ib_cq);struct bnxt_re_qp *qp;struct bnxt_qplib_cqe *cqe;int i, ncqe, budget; +struct bnxt_qplib_q *sq; +struct bnxt_qplib_qp *lib_qp;u32 tbl_idx;struct bnxt_re_sqp_entries *sqp_entry =NULL ;unsigned long flags;
@@ -2659,7 +2875,21 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) } cqe = &cq->cql[0 ];while (budget) { - ncqe =bnxt_qplib_poll_cq (&cq->qplib_cq, cqe, budget); + lib_qp =NULL ; + ncqe =bnxt_qplib_poll_cq (&cq->qplib_cq, cqe, budget, &lib_qp); +if (lib_qp) { + sq = &lib_qp->sq; +if (sq->send_phantom) { + qp =container_of (lib_qp, + struct bnxt_re_qp, qplib_qp); +if (send_phantom_wqe (qp) == -ENOMEM ) +dev_err (rdev_to_dev (cq->rdev), +"Phantom failed! Scheduled to send again\n" ); +else + sq->send_phantom = false; + } + } +if (!ncqe)break ;
@@ -2912,6 +3142,55 @@ struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type type,return ERR_PTR (rc); } +struct ib_mw *bnxt_re_alloc_mw (struct ib_pd *ib_pd,enum ib_mw_type type, +struct ib_udata *udata) +{ + struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd); +struct bnxt_re_dev *rdev = pd->rdev; +struct bnxt_re_mw *mw; +int rc; + + mw =kzalloc (sizeof (*mw),GFP_KERNEL ); +if (!mw) +return ERR_PTR (-ENOMEM ); + mw->rdev = rdev; + mw->qplib_mw.pd = &pd->qplib_pd; + + mw->qplib_mw.type = (type ==IB_MW_TYPE_1 ? +CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1 : +CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B ); + rc =bnxt_qplib_alloc_mrw (&rdev->qplib_res, &mw->qplib_mw); +if (rc) { +dev_err (rdev_to_dev (rdev),"Allocate MW failed!" ); + goto fail; + } + mw->ib_mw.rkey = mw->qplib_mw.rkey; + +atomic_inc (&rdev->mw_count); +return &mw->ib_mw; + +fail: +kfree (mw); +return ERR_PTR (rc); +} + +int bnxt_re_dealloc_mw (struct ib_mw *ib_mw) +{ + struct bnxt_re_mw *mw = container_of(ib_mw, struct bnxt_re_mw, ib_mw); +struct bnxt_re_dev *rdev = mw->rdev; +int rc; + + rc =bnxt_qplib_free_mrw (&rdev->qplib_res, &mw->qplib_mw); +if (rc) { +dev_err (rdev_to_dev (rdev),"Free MW failed: %#x\n" , rc); +return rc; + } + +kfree (mw); +atomic_dec (&rdev->mw_count); +return rc; +} +/* Fast Memory Regions */ struct ib_fmr *bnxt_re_alloc_fmr (struct ib_pd *ib_pd,int mr_access_flags,struct ib_fmr_attr *fmr_attr)
drivers/infiniband/hw/bnxt_re/ib_verbs.h +15 -0
@@ -44,11 +44,23 @@ struct bnxt_re_gid_ctx {u32 refcnt; }; +#define BNXT_RE_FENCE_BYTES 64 +struct bnxt_re_fence_data { +u32 size; +u8 va[BNXT_RE_FENCE_BYTES ]; +dma_addr_t dma_addr; +struct bnxt_re_mr *mr; +struct ib_mw *mw; +struct bnxt_qplib_swqe bind_wqe; +u32 bind_rkey; +}; +struct bnxt_re_pd {struct bnxt_re_dev *rdev;struct ib_pd ib_pd;struct bnxt_qplib_pd qplib_pd;struct bnxt_qplib_dpi dpi; +struct bnxt_re_fence_data fence; };struct bnxt_re_ah {
@@ -181,6 +193,9 @@ int bnxt_re_map_mr_sg(struct ib_mr *ib_mr, struct scatterlist *sg, int sg_nents,struct ib_mr *bnxt_re_alloc_mr (struct ib_pd *ib_pd,enum ib_mr_type mr_type,u32 max_num_sg);int bnxt_re_dereg_mr (struct ib_mr *mr); +struct ib_mw *bnxt_re_alloc_mw (struct ib_pd *ib_pd,enum ib_mw_type type, +struct ib_udata *udata); +int bnxt_re_dealloc_mw (struct ib_mw *mw);struct ib_fmr *bnxt_re_alloc_fmr (struct ib_pd *pd,int mr_access_flags,struct ib_fmr_attr *fmr_attr); int bnxt_re_map_phys_fmr(struct ib_fmr *fmr, u64 *page_list, int list_len,
drivers/infiniband/hw/bnxt_re/qplib_fp.c +144 -21
254 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_fp.h +16 -1
@@ -88,6 +88,7 @@ struct bnxt_qplib_swq {struct bnxt_qplib_swqe {/* General */ +#define BNXT_QPLIB_FENCE_WRID 0x46454E43/* "FENC" */ u64 wr_id;u8 reqs_type;u8 type;
@@ -216,9 +217,16 @@ struct bnxt_qplib_q {struct scatterlist *sglist;u32 nmap;u32 max_wqe; +u16 q_full_delta;u16 max_sge;u32 psn;bool flush_in_progress; +bool condition; +bool single; +bool send_phantom; +u32 phantom_wqe_cnt; +u32 phantom_cqe_cnt; +u32 next_cq_cons; };struct bnxt_qplib_qp {
@@ -301,6 +309,13 @@ struct bnxt_qplib_qp { (!!((hdr)->cqe_type_toggle &CQ_BASE_TOGGLE ) == \ !((raw_cons) & (cp_bit))) +static inline bool bnxt_qplib_queue_full (struct bnxt_qplib_q *qplib_q) +{ +return HWQ_CMP ((qplib_q->hwq.prod + qplib_q->q_full_delta), + &qplib_q->hwq) ==HWQ_CMP (qplib_q->hwq.cons, + &qplib_q->hwq); +} +struct bnxt_qplib_cqe {u8 status;u8 type;
@@ -432,7 +447,7 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,int bnxt_qplib_create_cq (struct bnxt_qplib_res *res,struct bnxt_qplib_cq *cq);int bnxt_qplib_destroy_cq (struct bnxt_qplib_res *res,struct bnxt_qplib_cq *cq);int bnxt_qplib_poll_cq (struct bnxt_qplib_cq *cq,struct bnxt_qplib_cqe *cqe, -int num); +int num,struct bnxt_qplib_qp **qp);void bnxt_qplib_req_notify_cq (struct bnxt_qplib_cq *cq,u32 arm_type);void bnxt_qplib_free_nq (struct bnxt_qplib_nq *nq);int bnxt_qplib_alloc_nq (struct pci_dev *pdev,struct bnxt_qplib_nq *nq);
drivers/infiniband/hw/bnxt_re/qplib_res.h +0 -1
@@ -52,7 +52,6 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero; ((HWQ_CMP(hwq->prod, hwq)\ - HWQ_CMP(hwq->cons, hwq))\ & (hwq->max_elements - 1))) - enum bnxt_qplib_hwq_type { HWQ_TYPE_CTX, HWQ_TYPE_QUEUE,
drivers/infiniband/hw/bnxt_re/qplib_sp.c +5 -0
@@ -88,6 +88,11 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, sb->max_qp_init_rd_atom >BNXT_QPLIB_MAX_OUT_RD_ATOM ?BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom; attr->max_qp_wqes =le16_to_cpu (sb->max_qp_wr); +/* +* 128 WQEs needs to be reserved for the HW (8916). Prevent +* reporting the max number +*/ + attr->max_qp_wqes -=BNXT_QPLIB_RESERVED_QP_WRS ; attr->max_qp_sges = sb->max_sge; attr->max_cq =le32_to_cpu (sb->max_cq); attr->max_cq_wqes =le32_to_cpu (sb->max_cqe);
drivers/infiniband/hw/bnxt_re/qplib_sp.h +2 -0
@@ -40,6 +40,8 @@ #ifndef __BNXT_QPLIB_SP_H__ #define __BNXT_QPLIB_SP_H__ +#define BNXT_QPLIB_RESERVED_QP_WRS 128 + struct bnxt_qplib_dev_attr { char fw_ver[32]; u16 max_sgid;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 3/15 RDMA/bnxt_re: Fix race between netdev register and unregister events
In reply to a message not in the archiveFrom: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
Upon receipt of the NETDEV_REGISTER event from the netdev notifier chain, the IB stack registration is spawned off to a workqueue since that also requires an rtnl lock.
There could be 2 kinds of races between the NETDEV_REGISTER and the NETDEV_UNREGISTER event handling.
a)The NETDEV_UNREGISTER event is received in rapid succession after the NETDEV_REGISTER event even before the work queue got a chance to run
b)The NETDEV_UNREGISTER event is received while the workqueue that handles registration with the IB stack is still in progress. Handle both the races with a bit flag that is set as part of the NETDEV_REGISTER event just before the work item is queued and cleared in the workqueue after the registration with the IB stack is complete. Use a barrier to ensure the bit is cleared only after the IB stack registration code is completed.
Removes the link speed query from the query_port as it causes deadlock while trying to acquire rtnl_lock. Now querying the speed from the nedev event itself.
Also, added a code to wait for resources(like CQ) to be freed by the ULPs, during driver unload
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 13 +++++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 21 +++-------------- drivers/infiniband/hw/bnxt_re/main.c | 39 ++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 23 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +8 -5
@@ -80,11 +80,13 @@ struct bnxt_re_dev {struct ib_device ibdev;struct list_head list;unsigned long flags; -#define BNXT_RE_FLAG_NETDEV_REGISTERED 0 -#define BNXT_RE_FLAG_IBDEV_REGISTERED 1 -#define BNXT_RE_FLAG_GOT_MSIX 2 -#define BNXT_RE_FLAG_RCFW_CHANNEL_EN 8 -#define BNXT_RE_FLAG_QOS_WORK_REG 16 +#define BNXT_RE_FLAG_NETDEV_REGISTERED 0 +#define BNXT_RE_FLAG_IBDEV_REGISTERED 1 +#define BNXT_RE_FLAG_GOT_MSIX 2 +#define BNXT_RE_FLAG_RCFW_CHANNEL_EN 4 +#define BNXT_RE_FLAG_QOS_WORK_REG 5 +#define BNXT_RE_FLAG_NETDEV_REG_IN_PROG 6 +struct net_device *netdev;unsigned int version, major, minor;struct bnxt_en_dev *en_dev;
@@ -127,6 +129,7 @@ struct bnxt_re_dev {struct bnxt_re_qp *qp1_sqp;struct bnxt_re_ah *sqp_ah;struct bnxt_re_sqp_entries sqp_tbl[1024 ]; +u32 espeed; };#define to_bnxt_re_dev (ptr, member) \
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 -18
@@ -223,20 +223,8 @@ int bnxt_re_modify_device(struct ib_device *ibdev,return 0 ; } -static void __to_ib_speed_width (struct net_device *netdev,u8 *speed,u8 *width) +static void __to_ib_speed_width (u32 espeed,u8 *speed,u8 *width) { -struct ethtool_link_ksettings lksettings; -u32 espeed; - -if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { -memset (&lksettings,0 ,sizeof (lksettings)); -rtnl_lock (); - netdev->ethtool_ops->get_link_ksettings (netdev, &lksettings); -rtnl_unlock (); - espeed = lksettings.base.speed; - }else { - espeed =SPEED_UNKNOWN ; - }switch (espeed) {case SPEED_1000 : *speed =IB_SPEED_SDR ;
@@ -303,12 +291,9 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, port_attr->sm_sl =0 ; port_attr->subnet_timeout =0 ; port_attr->init_type_reply =0 ; -/* call the underlying netdev's ethtool hooks to query speed settings -* for which we acquire rtnl_lock _only_ if it's registered with -* IB stack to avoid race in the NETDEV_UNREG path -*/ +if (test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) -__to_ib_speed_width (rdev->netdev, &port_attr->active_speed, +__to_ib_speed_width (rdev->espeed, &port_attr->active_speed, &port_attr->active_width);return 0 ; }
drivers/infiniband/hw/bnxt_re/main.c +39 -0
@@ -48,6 +48,8 @@#include <net/ipv6.h> #include <net/addrconf.h> #include <linux/if_ether.h> +#include <linux/atomic.h> +#include <asm/barrier.h> #include <rdma/ib_verbs.h> #include <rdma/ib_user_verbs.h>
@@ -926,6 +928,10 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait)if (test_and_clear_bit (BNXT_RE_FLAG_QOS_WORK_REG , &rdev->flags))cancel_delayed_work (&rdev->worker); +/* Wait for ULPs to release references */ +while (atomic_read (&rdev->cq_count)) +usleep_range (500 ,1000 ); +bnxt_re_cleanup_res (rdev);bnxt_re_free_res (rdev, lock_wait);
@@ -1152,6 +1158,22 @@ static void bnxt_re_remove_one(struct bnxt_re_dev *rdev)pci_dev_put (rdev->en_dev->pdev); } +static void bnxt_re_get_link_speed (struct bnxt_re_dev *rdev) +{ +struct ethtool_link_ksettings lksettings; +struct net_device *netdev = rdev->netdev; + +if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { +memset (&lksettings,0 ,sizeof (lksettings)); +if (rtnl_trylock ()) { + netdev->ethtool_ops->get_link_ksettings (netdev, + &lksettings); + rdev->espeed = lksettings.base.speed; +rtnl_unlock (); + } + } +} +/* Handle all deferred netevents tasks */ static void bnxt_re_task (struct work_struct *work) {
@@ -1169,6 +1191,10 @@ static void bnxt_re_task(struct work_struct *work)switch (re_work->event) {case NETDEV_REGISTER : rc =bnxt_re_ib_reg (rdev); +/* Use memory barrier to sync the rdev->flags */ +smp_mb (); +clear_bit (BNXT_RE_FLAG_NETDEV_REG_IN_PROG , + &rdev->flags);if (rc)dev_err (rdev_to_dev (rdev),"Failed to register with IB: %#x" , rc);
@@ -1186,6 +1212,7 @@ static void bnxt_re_task(struct work_struct *work)else if (netif_carrier_ok (rdev->netdev))bnxt_re_dispatch_event (&rdev->ibdev,NULL ,1 ,IB_EVENT_PORT_ACTIVE ); +bnxt_re_get_link_speed (rdev);break ;default :break ;
@@ -1244,10 +1271,22 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier,break ; }bnxt_re_init_one (rdev); +/* +* Query the link speed at the time of registration. +* Already in rtnl_lock context +*/ +bnxt_re_get_link_speed (rdev); + +set_bit (BNXT_RE_FLAG_NETDEV_REG_IN_PROG , &rdev->flags); sch_work = true;break ;case NETDEV_UNREGISTER : +/* netdev notifier will call NETDEV_UNREGISTER again later since +* we are still holding the reference to the netdev +*/ +if (test_bit (BNXT_RE_FLAG_NETDEV_REG_IN_PROG , &rdev->flags)) + goto exit;bnxt_re_ib_unreg (rdev, false);bnxt_re_remove_one (rdev);bnxt_re_dev_unreg (rdev);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 4/15 RDMA/bnxt_re: Dereg MR in FW before freeing the fast_reg_page_list
In reply to a message not in the archiveIf the host buffers are freed before destroying MR in HW, HW could try accessing these buffers. This could cause a host crash. Fixing the code to avoid this condition.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +6 -2
@@ -3035,6 +3035,12 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr)struct bnxt_re_dev *rdev = mr->rdev;int rc =0 ; + rc =bnxt_qplib_free_mrw (&rdev->qplib_res, &mr->qplib_mr); +if (rc) { +dev_err (rdev_to_dev (rdev),"Dereg MR failed: %#x\n" , rc); +return rc; + } +if (mr->npages && mr->pages) { rc =bnxt_qplib_free_fast_reg_page_list (&rdev->qplib_res, &mr->qplib_frpl);
@@ -3042,8 +3048,6 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) mr->npages =0 ; mr->pages =NULL ; } - rc =bnxt_qplib_free_mrw (&rdev->qplib_res, &mr->qplib_mr); -if (!IS_ERR (mr->ib_umem) && mr->ib_umem)ib_umem_release (mr->ib_umem);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 5/15 RDMA/bnxt_re: Free doorbell page index (DPI) during dealloc ucontext
In reply to a message not in the archiveFrom: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]>
The driver must free the DPI during the dealloc_ucontext instead of freeing it during dealloc_pd. However, the DPI allocation scheme remains unchanged.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 58 ++++++++++++++++---------------- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 3 +- 2 files changed, 30 insertions(+), 31 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +29 -29
@@ -597,30 +597,13 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd)int rc;bnxt_re_destroy_fence_mr (pd); -if (ib_pd->uobject && pd->dpi.dbr) { -struct ib_ucontext *ib_uctx = ib_pd->uobject->context; -struct bnxt_re_ucontext *ucntx; -/* Free DPI only if this is the first PD allocated by the -* application and mark the context dpi as NULL -*/ - ucntx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx); - - rc =bnxt_qplib_dealloc_dpi (&rdev->qplib_res, - &rdev->qplib_res.dpi_tbl, - &pd->dpi); +if (pd->qplib_pd.id) { + rc =bnxt_qplib_dealloc_pd (&rdev->qplib_res, + &rdev->qplib_res.pd_tbl, + &pd->qplib_pd);if (rc) -dev_err (rdev_to_dev (rdev),"Failed to deallocate HW DPI" ); -/* Don't fail, continue*/ - ucntx->dpi =NULL ; - } - - rc =bnxt_qplib_dealloc_pd (&rdev->qplib_res, - &rdev->qplib_res.pd_tbl, - &pd->qplib_pd); -if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to deallocate HW PD" ); -return rc; +dev_err (rdev_to_dev (rdev),"Failed to deallocate HW PD" ); }kfree (pd);
@@ -652,23 +635,22 @@ struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev,if (udata) {struct bnxt_re_pd_resp resp; -if (!ucntx->dpi) { +if (!ucntx->dpi.dbr) {/* Allocate DPI in alloc_pd to avoid failing of * ibv_devinfo and family of application when DPIs * are depleted. */ if (bnxt_qplib_alloc_dpi (&rdev->qplib_res.dpi_tbl, - &pd->dpi, ucntx)) { + &ucntx->dpi, ucntx)) { rc = -ENOMEM ; goto dbfail; } - ucntx->dpi = &pd->dpi; } resp.pdid = pd->qplib_pd.id;/* Still allow mapping this DBR to the new user PD. */ - resp.dpi = ucntx->dpi->dpi; - resp.dbr = (u64 )ucntx->dpi->umdbr; + resp.dpi = ucntx->dpi.dpi; + resp.dbr = (u64 )ucntx->dpi.umdbr; rc =ib_copy_to_udata (udata, &resp,sizeof (resp));if (rc) {
@@ -944,7 +926,7 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, qplib_qp->rq.nmap = umem->nmap; } - qplib_qp->dpi = cntx->dpi; + qplib_qp->dpi = &cntx->dpi;return 0 ; rqfail:ib_umem_release (qp->sumem);
@@ -2352,7 +2334,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev, } cq->qplib_cq.sghead = cq->umem->sg_head.sgl; cq->qplib_cq.nmap = cq->umem->nmap; - cq->qplib_cq.dpi = uctx->dpi; + cq->qplib_cq.dpi = &uctx->dpi; }else { cq->max_cql =min_t (u32, entries,MAX_CQL_PER_POLL ); cq->cql = kcalloc(cq->max_cql, sizeof(struct bnxt_qplib_cqe),
@@ -3431,8 +3413,26 @@ int bnxt_re_dealloc_ucontext(struct ib_ucontext *ib_uctx)struct bnxt_re_ucontext *uctx =container_of (ib_uctx, struct bnxt_re_ucontext, ib_uctx); + +struct bnxt_re_dev *rdev = uctx->rdev; +int rc =0 ; +if (uctx->shpg)free_page ((unsigned long )uctx->shpg); + +if (uctx->dpi.dbr) { +/* Free DPI only if this is the first PD allocated by the +* application and mark the context dpi as NULL +*/ + rc =bnxt_qplib_dealloc_dpi (&rdev->qplib_res, + &rdev->qplib_res.dpi_tbl, + &uctx->dpi); +if (rc) +dev_err (rdev_to_dev (rdev),"Deallocte HW DPI failed!" ); +/* Don't fail, continue*/ + uctx->dpi.dbr =NULL ; + } +kfree (uctx);return 0 ; }
drivers/infiniband/hw/bnxt_re/ib_verbs.h +1 -2
@@ -59,7 +59,6 @@ struct bnxt_re_pd {struct bnxt_re_dev *rdev;struct ib_pd ib_pd;struct bnxt_qplib_pd qplib_pd; -struct bnxt_qplib_dpi dpi;struct bnxt_re_fence_data fence; };
@@ -126,7 +125,7 @@ struct bnxt_re_mw {struct bnxt_re_ucontext {struct bnxt_re_dev *rdev;struct ib_ucontext ib_uctx; -struct bnxt_qplib_dpi *dpi; +struct bnxt_qplib_dpi dpi;void *shpg;spinlock_t sh_lock;/* protect shpg */ };
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 6/15 RDMA/bnxt_re: Add HW workaround for avoiding stall for UD QPs
In reply to a message not in the archiveFrom: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
HW stalls out after 0x800000 WQEs are posted for UD QPs.
To workaround this problem, driver will send a modify_qp cmd to the HW at around the halfway mark(0x400000) so that FW can accordingly modify the QP context in the HW to prevent this stall.
This workaround needs to be done for UD, QP1 and Raw Ethertype packets. Added a counter to keep track of WQEs posted during post_send.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 ++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 18 ++++++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_fp.c | 3 +++ drivers/infiniband/hw/bnxt_re/qplib_fp.h | 1 + 4 files changed, 24 insertions(+)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -56,6 +56,8 @@#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)#define BNXT_RE_MAX_CQ_COUNT (64 * 1024) +#define BNXT_RE_UD_QP_HW_STALL 0x400000 +struct bnxt_re_work {struct work_struct work;unsigned long event;
drivers/infiniband/hw/bnxt_re/ib_verbs.c +18 -0
@@ -2040,6 +2040,22 @@ static int bnxt_re_copy_wr_payload(struct bnxt_re_dev *rdev,return payload_sz; } +static void bnxt_ud_qp_hw_stall_workaround (struct bnxt_re_qp *qp) +{ +if ((qp->ib_qp.qp_type ==IB_QPT_UD || + qp->ib_qp.qp_type ==IB_QPT_GSI || + qp->ib_qp.qp_type ==IB_QPT_RAW_ETHERTYPE ) && + qp->qplib_qp.wqe_cnt ==BNXT_RE_UD_QP_HW_STALL ) { +int qp_attr_mask; +struct ib_qp_attr qp_attr; + + qp_attr_mask =IB_QP_STATE ; + qp_attr.qp_state =IB_QPS_RTS ; +bnxt_re_modify_qp (&qp->ib_qp, &qp_attr, qp_attr_mask,NULL ); + qp->qplib_qp.wqe_cnt =0 ; + } +} +static int bnxt_re_post_send_shadow_qp (struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp,struct ib_send_wr *wr)
@@ -2085,6 +2101,7 @@ static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev, wr = wr->next; }bnxt_qplib_post_send_db (&qp->qplib_qp); +bnxt_ud_qp_hw_stall_workaround (qp);spin_unlock_irqrestore (&qp->sq_lock, flags);return rc; }
@@ -2181,6 +2198,7 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, struct ib_send_wr *wr, wr = wr->next; }bnxt_qplib_post_send_db (&qp->qplib_qp); +bnxt_ud_qp_hw_stall_workaround (qp);spin_unlock_irqrestore (&qp->sq_lock, flags);return rc;
drivers/infiniband/hw/bnxt_re/qplib_fp.c +3 -0
@@ -1298,6 +1298,9 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, } sq->hwq.prod++; + + qp->wqe_cnt++; + done:return rc; }
drivers/infiniband/hw/bnxt_re/qplib_fp.h +1 -0
@@ -250,6 +250,7 @@ struct bnxt_qplib_qp {u8 timeout;u8 retry_cnt;u8 rnr_retry; +u64 wqe_cnt;u32 min_rnr_timer;u32 max_rd_atomic;u32 max_dest_rd_atomic;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 7/15 RDMA/bnxt_re: Fix WQE Size posted to HW to prevent it from throwing error
In reply to a message not in the archiveFrom: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
Posting WQE size of 2 results in a WQE_FORMAT_ERROR thrown by the HW as it requires host to supply WQE Size with room for atleast one SGE so that the resulting WQE size be atleast 3.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +10 -0
@@ -1128,6 +1128,11 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, }/* Each SGE entry = 1 WQE size16 */ wqe_size16 = wqe->num_sge; +/* HW requires wqe size has room for atleast one SGE even if +* none was supplied by ULP +*/ +if (!wqe->num_sge) + wqe_size16++; }/* Specifics */
@@ -1364,6 +1369,11 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, rqe->flags = wqe->flags; rqe->wqe_size = wqe->num_sge + ((offsetof(typeof(*rqe), data) + 15) >> 4); +/* HW requires wqe size has room for atleast one SGE even if none +* was supplied by ULP +*/ +if (!wqe->num_sge) + rqe->wqe_size++;/* Supply the rqe->wr_id index to the wr_id_tbl for now */ rqe->wr_id[0 ] =cpu_to_le32 (sw_prod);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 8/15 RDMA/bnxt_re: Add vlan tag for untagged RoCE traffic when PFC is configured
In reply to a message not in the archiveFrom: Kalesh AP <kalesh-anakkur.purayil-dY08KVG/lbpWk0Htik3J/[email protected]>
Current implementation does not program vlan header insertion in RoCE packet if no vlan is configured. Firmware does not add prority when there is no vlan tag in the packet. Modify the code to insert vlan header when PFC is enabled on the interface.
---
v2 -> v3:
Avoid temp variables while populating smac and gid
v1 -> v2:
Avoid unnecessary memcpy while populating smac and gid
drivers/infiniband/hw/bnxt_re/main.c | 53 ++++++++++++++++++--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 10 ++++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 2 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 77 ++++++++++++++++++++++++------- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 + drivers/infiniband/hw/bnxt_re/roce_hsi.h | 4 +- 6 files changed, 124 insertions(+), 24 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +47 -6
@@ -840,6 +840,42 @@ static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev)mutex_unlock (&rdev->qp_lock); } +static int bnxt_re_update_gid (struct bnxt_re_dev *rdev) +{ +struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl; +struct bnxt_qplib_gid gid; +u16 gid_idx, index; +int rc =0 ; + +if (!test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) +return 0 ; + +if (!sgid_tbl) { +dev_err (rdev_to_dev (rdev),"QPLIB: SGID table not allocated" ); +return -EINVAL ; + } + +for (index =0 ; index < sgid_tbl->active; index++) { + gid_idx = sgid_tbl->hw_id[index]; + +if (!memcmp (&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero, +sizeof (bnxt_qplib_gid_zero))) +continue ; +/* need to modify the VLAN enable setting of non VLAN GID only +* as setting is done for VLAN GID while adding GID +*/ +if (sgid_tbl->vlan[index]) +continue ; + +memcpy (&gid, &sgid_tbl->tbl[index],sizeof (gid)); + + rc =bnxt_qplib_update_sgid (sgid_tbl, &gid, gid_idx, + rdev->qplib_res.netdev->dev_addr); + } + +return rc; +} +static u32 bnxt_re_get_priority_mask (struct bnxt_re_dev *rdev) {u32 prio_map =0 , tmp_map =0 ;
@@ -859,8 +895,6 @@ static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev) tmp_map =dcb_ieee_getapp_mask (netdev, &app); prio_map |= tmp_map; -if (!prio_map) - prio_map = -EFAULT ;return prio_map; }
@@ -886,10 +920,7 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)int rc;/* Get priority for roce */ - rc =bnxt_re_get_priority_mask (rdev); -if (rc <0 ) -return rc; - prio_map = (u8 )rc; + prio_map =bnxt_re_get_priority_mask (rdev);if (prio_map == rdev->cur_prio_map)return 0 ;
@@ -911,6 +942,16 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)return rc; } +/* Actual priorities are not programmed as they are already +* done by L2 driver; just enable or disable priority vlan tagging +*/ +if ((prio_map ==0 && rdev->qplib_res.prio) || + (prio_map !=0 && !rdev->qplib_res.prio)) { + rdev->qplib_res.prio = prio_map ? true : false; + +bnxt_re_update_gid (rdev); + } +return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_res.c +10 -0
@@ -468,9 +468,11 @@ static void bnxt_qplib_free_sgid_tbl(struct bnxt_qplib_res *res,kfree (sgid_tbl->tbl);kfree (sgid_tbl->hw_id);kfree (sgid_tbl->ctx); +kfree (sgid_tbl->vlan); sgid_tbl->tbl =NULL ; sgid_tbl->hw_id =NULL ; sgid_tbl->ctx =NULL ; + sgid_tbl->vlan =NULL ; sgid_tbl->max =0 ; sgid_tbl->active =0 ; }
@@ -491,8 +493,15 @@ static int bnxt_qplib_alloc_sgid_tbl(struct bnxt_qplib_res *res,if (!sgid_tbl->ctx) goto out_free2; + sgid_tbl->vlan =kcalloc (max,sizeof (u8),GFP_KERNEL ); +if (!sgid_tbl->vlan) + goto out_free3; + sgid_tbl->max = max;return 0 ; +out_free3: +kfree (sgid_tbl->ctx); + sgid_tbl->ctx =NULL ; out_free2:kfree (sgid_tbl->hw_id); sgid_tbl->hw_id =NULL ;
@@ -514,6 +523,7 @@ static void bnxt_qplib_cleanup_sgid_tbl(struct bnxt_qplib_res *res, }memset (sgid_tbl->tbl,0 ,sizeof (struct bnxt_qplib_gid ) * sgid_tbl->max);memset (sgid_tbl->hw_id,-1 ,sizeof (u16) * sgid_tbl->max); +memset (sgid_tbl->vlan,0 ,sizeof (u8) * sgid_tbl->max); sgid_tbl->active =0 ; }
drivers/infiniband/hw/bnxt_re/qplib_res.h +2 -0
@@ -116,6 +116,7 @@ struct bnxt_qplib_sgid_tbl {u16 max;u16 active;void *ctx; +u8 *vlan; };struct bnxt_qplib_pkey_tbl {
@@ -188,6 +189,7 @@ struct bnxt_qplib_res {struct bnxt_qplib_sgid_tbl sgid_tbl;struct bnxt_qplib_pkey_tbl pkey_tbl;struct bnxt_qplib_dpi_tbl dpi_tbl; +bool prio; };#define to_bnxt_qplib (ptr, type, member) \
drivers/infiniband/hw/bnxt_re/qplib_sp.c +61 -16
107 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_sp.h +2 -0
@@ -132,6 +132,8 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,int bnxt_qplib_add_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl,struct bnxt_qplib_gid *gid,u8 *mac,u16 vlan_id,bool update,u32 *index); +int bnxt_qplib_update_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl, +struct bnxt_qplib_gid *gid,u16 gid_idx,u8 *smac);int bnxt_qplib_get_pkey (struct bnxt_qplib_res *res,struct bnxt_qplib_pkey_tbl *pkey_tbl,u16 index,u16 *pkey);
drivers/infiniband/hw/bnxt_re/roce_hsi.h +2 -2
@@ -1473,8 +1473,8 @@ struct cmdq_modify_gid {u8 resp_size;u8 reserved8;__le64 resp_addr; -__le32 gid[4 ]; -__le16 src_mac[3 ]; +__be32 gid[4 ]; +__be16 src_mac[3 ];__le16 vlan;#define CMDQ_MODIFY_GID_VLAN_VLAN_ID_MASK 0xfffUL#define CMDQ_MODIFY_GID_VLAN_VLAN_ID_SFT 0
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 9/15 RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails
In reply to a message not in the archiveThis fix is added only to avoid system crash in some a specific scenario. When bnxt_re driver is loaded and if user tries to change interface mac address, delete GID fails because QP1 is still associated with existing MAC (default GID). If the above command fails GID tables are not modified in the h/w or driver, but the GID context memory is freed. Now, if the user changes the mac back to the original value, another add_gid comes to the driver where the driver reports that the GID is already present in its table and tries to access the context which was already freed.
So, in this case, in order to avoid NULL pointer de-reference, this patch removes the context memory free if delete_gid fails and the same context memory is re-used in new add_gid. Memory cleanup will be taken care during driver unload, while deleting the GID table.
---
v1 -> v2 : Adds the bug description in commit message
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +9 -7
@@ -375,15 +375,17 @@ int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num,return -EINVAL ; ctx->refcnt--;if (!ctx->refcnt) { - rc =bnxt_qplib_del_sgid - (sgid_tbl, - &sgid_tbl->tbl[ctx->idx], true); -if (rc) + rc =bnxt_qplib_del_sgid (sgid_tbl, + &sgid_tbl->tbl[ctx->idx], + true); +if (rc) {dev_err (rdev_to_dev (rdev),"Failed to remove GID: %#x" , rc); - ctx_tbl = sgid_tbl->ctx; - ctx_tbl[ctx->idx] =NULL ; -kfree (ctx); + }else { + ctx_tbl = sgid_tbl->ctx; + ctx_tbl[ctx->idx] =NULL ; +kfree (ctx); + } } }else {return -EINVAL ;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 10/15 RDMA/bnxt_re: Fix RQE posting logic
In reply to a message not in the archiveFrom: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]>
This patch adds code to ring RQ Doorbell aggressively so that the adapter can DMA RQ buffers sooner, instead of DMA all WQEs in the post_recv WR list together at the end of the post_recv verb.
Also use spinlock to serialize RQ posting
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 ++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 18 +++++++++++++++++- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -58,6 +58,8 @@#define BNXT_RE_UD_QP_HW_STALL 0x400000 +#define BNXT_RE_RQ_WQE_THRESHOLD 32 +struct bnxt_re_work {struct work_struct work;unsigned long event;
drivers/infiniband/hw/bnxt_re/ib_verbs.c +17 -1
@@ -1217,6 +1217,7 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, qp->ib_qp.qp_num = qp->qplib_qp.id;spin_lock_init (&qp->sq_lock); +spin_lock_init (&qp->rq_lock);if (udata) {struct bnxt_re_qp_resp resp;
@@ -2248,7 +2249,10 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, struct ib_recv_wr *wr, struct bnxt_re_qp *qp = container_of(ib_qp, struct bnxt_re_qp, ib_qp);struct bnxt_qplib_swqe wqe;int rc =0 , payload_sz =0 ; +unsigned long flags; +u32 count =0 ; +spin_lock_irqsave (&qp->rq_lock, flags);while (wr) {/* House keeping */ memset (&wqe,0 ,sizeof (wqe));
@@ -2277,9 +2281,21 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, struct ib_recv_wr *wr, *bad_wr = wr;break ; } + +/* Ring DB if the RQEs posted reaches a threshold value */ +if (++count >=BNXT_RE_RQ_WQE_THRESHOLD ) { +bnxt_qplib_post_recv_db (&qp->qplib_qp); + count =0 ; + } + wr = wr->next; } -bnxt_qplib_post_recv_db (&qp->qplib_qp); + +if (count) +bnxt_qplib_post_recv_db (&qp->qplib_qp); + +spin_unlock_irqrestore (&qp->rq_lock, flags); +return rc; }
drivers/infiniband/hw/bnxt_re/ib_verbs.h +1 -0
@@ -73,6 +73,7 @@ struct bnxt_re_qp {struct bnxt_re_dev *rdev;struct ib_qp ib_qp;spinlock_t sq_lock;/* protect sq */ +spinlock_t rq_lock;/* protect rq */ struct bnxt_qplib_qp qplib_qp;struct ib_umem *sumem;struct ib_umem *rumem;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 11/15 RDMA/bnxt_re: Report supported value to IB stack in query_device
In reply to a message not in the archive - Report supported value for max_mr_size to IB stack in query_device. Also, check and log if MR size requested by application in reg_user_mr() is greater than value currently supported by driver.
- Report only 4K page size support for now
- Fix Max_QP value returned by ibv_devinfo -vv.
In case of PF, FW reserves 129 QPs for creating QP1s of VFs and PF. So the max_qp value reported by FW for PF doesn'tt include the QP1. Fixing this issue by adding 1 with the value reported by FW.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 ++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 12 ++++++++---- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -51,6 +51,8 @@#define BNXT_RE_PAGE_SIZE_8M BIT(23)#define BNXT_RE_PAGE_SIZE_1G BIT(30) +#define BNXT_RE_MAX_MR_SIZE BIT(30) +#define BNXT_RE_MAX_QPC_COUNT (64 * 1024)#define BNXT_RE_MAX_MRW_COUNT (64 * 1024)#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +8 -4
@@ -145,10 +145,8 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->fw_ver = (u64 )(unsigned long )(dev_attr->fw_ver);bnxt_qplib_get_guid (rdev->netdev->dev_addr, (u8 *)&ib_attr->sys_image_guid); - ib_attr->max_mr_size = ~0ull ; - ib_attr->page_size_cap =BNXT_RE_PAGE_SIZE_4K |BNXT_RE_PAGE_SIZE_8K | -BNXT_RE_PAGE_SIZE_64K |BNXT_RE_PAGE_SIZE_2M | -BNXT_RE_PAGE_SIZE_8M |BNXT_RE_PAGE_SIZE_1G ; + ib_attr->max_mr_size =BNXT_RE_MAX_MR_SIZE ; + ib_attr->page_size_cap =BNXT_RE_PAGE_SIZE_4K ; ib_attr->vendor_id = rdev->en_dev->pdev->vendor; ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
@@ -3306,6 +3304,12 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,struct scatterlist *sg;int entry; +if (length >BNXT_RE_MAX_MR_SIZE ) { +dev_err (rdev_to_dev (rdev),"MR Size: %lld > Max supported:%ld\n" , + length,BNXT_RE_MAX_MR_SIZE ); +return ERR_PTR (-ENOMEM ); + } + mr =kzalloc (sizeof (*mr),GFP_KERNEL );if (!mr)return ERR_PTR (-ENOMEM );
drivers/infiniband/hw/bnxt_re/qplib_sp.c +2 -0
@@ -81,6 +81,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,/* Extract the context from the side buffer */ attr->max_qp =le32_to_cpu (sb->max_qp); +/* max_qp value reported by FW for PF doesn't include the QP1 for PF */ + attr->max_qp +=1 ; attr->max_qp_rd_atom = sb->max_qp_rd_atom >BNXT_QPLIB_MAX_OUT_RD_ATOM ?BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 12/15 RDMA/bnxt_re: Fixed the max_rd_atomic support for initiator and destination QP
In reply to a message not in the archiveFrom: Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]>
There's a couple of bugs in the support of max_rd_atomic and max_dest_rd_atomic. In the modify_qp, if the requested max_rd_atomic, which is the ORRQ size, is greater than what the chip can support, then we have to cap the request to chip max as we can't have the HW overflow the ORRQ. Capping the max_rd_atomic support internally is okay to do as the remaining read/atomic WRs will still be sitting in the SQ. However, for the max_dest_rd_atomic, the driver has to error out as this dictates the IRRQ size and we can't control what the remote side sends.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +13 -2
@@ -172,7 +172,7 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->max_mr = dev_attr->max_mr; ib_attr->max_pd = dev_attr->max_pd; ib_attr->max_qp_rd_atom = dev_attr->max_qp_rd_atom; - ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_rd_atom; + ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom; ib_attr->atomic_cap =IB_ATOMIC_HCA ; ib_attr->masked_atomic_cap =IB_ATOMIC_HCA ;
@@ -1495,13 +1495,24 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,if (qp_attr_mask &IB_QP_MAX_QP_RD_ATOMIC ) { qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_MAX_RD_ATOMIC ; - qp->qplib_qp.max_rd_atomic = qp_attr->max_rd_atomic; +/* Cap the max_rd_atomic to device max */ + qp->qplib_qp.max_rd_atomic =min_t (u32, qp_attr->max_rd_atomic, + dev_attr->max_qp_rd_atom); }if (qp_attr_mask &IB_QP_SQ_PSN ) { qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_SQ_PSN ; qp->qplib_qp.sq.psn = qp_attr->sq_psn; }if (qp_attr_mask &IB_QP_MAX_DEST_RD_ATOMIC ) { +if (qp_attr->max_dest_rd_atomic > + dev_attr->max_qp_init_rd_atom) { +dev_err (rdev_to_dev (rdev), +"max_dest_rd_atomic requested%d is > dev_max%d" , + qp_attr->max_dest_rd_atomic, + dev_attr->max_qp_init_rd_atom); +return -EINVAL ; + } + qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_MAX_DEST_RD_ATOMIC ; qp->qplib_qp.max_dest_rd_atomic = qp_attr->max_dest_rd_atomic;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 13/15 RDMA/bnxt_re: Specify RDMA component when allocating stats context
In reply to a message not in the archiveFrom: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
Starting FW version 20.6.47, firmware is keeping separate statistics for L2 and RDMA. However, driver needs to specify RDMA or not when allocating stat_ctx.
--- drivers/infiniband/hw/bnxt_re/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/main.c +1 -0
@@ -335,6 +335,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,bnxt_re_init_hwrm_hdr (rdev, (void *)&req,HWRM_STAT_CTX_ALLOC ,-1 ,-1 ); req.update_period_ms =cpu_to_le32 (1000 ); req.stats_dma_addr =cpu_to_le64 (dma_map); + req.stat_ctx_flags =STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE ;bnxt_re_fill_fw_msg (&fw_msg, (void *)&req,sizeof (req), (void *)&resp,sizeof (resp),DFLT_HWRM_CMD_TIMEOUT ); rc = en_dev->en_ops->bnxt_send_fw_msg (en_dev,BNXT_ROCE_ULP , &fw_msg);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 14/15 RDMA/bnxt_re: Sync up the module version to internal release version
In reply to a message not in the archiveUpdates the module version. The new version number will enable us to map the upstream driver to the level of supported features in the internal code base.
---
v2 -> v3:
- Modified the commit message
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +1 -1
@@ -40,7 +40,7 @@#ifndef __BNXT_RE_H__#define __BNXT_RE_H__#define ROCE_DRV_MODULE_NAME "bnxt_re" -#define ROCE_DRV_MODULE_VERSION "1.0.0" +#define ROCE_DRV_MODULE_VERSION "20.6.1.0u"#define BNXT_RE_DESC "Broadcom NetXtreme-C/E RoCE Driver"
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1495169074-12641-15-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]
Re: [PATCH V3 for-next 14/15] RDMA/bnxt_re: Sync up the module version to internal release version
Quoted 3 lines · Selvin Xavier
Updates the module version. The new version number will enable us to map the upstream driver to the level of supported features in the internal code base.
Your internal code base doesn't mean anything at all to the kernel. If you don't have a valid reason why the kernel needs this version number get rid of this patch please.
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 7f6e879e-175b-d126-17c3-e1314025ae33-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH V3 for-next 14/15] RDMA/bnxt_re: Sync up the module version to internal release version
Hi Dennis,
I am dropping this patch from this series. Posting v4 without this patch.
Thanks,
Selvin Xavier
Quoted 7 lines · Dennis Dalessandro
Quoted 4 lines · Selvin Xavier
Updates the module version. The new version number will enable us to map the upstream driver to the level of supported features in the internal code base.
Quoted 6 lines
Your internal code base doesn't mean anything at all to the kernel. If you don't have a valid reason why the kernel needs this version number get rid of this patch please.
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 15/15 RDMA/bnxt_re: Remove FMR support
In reply to a message not in the archiveSome issues observed with FMR implementation
while running stress traffic. So removing the
FMR verbs support for now.
---
v2 -> v3:
- Removes the FMR verbs instead of the config option
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 98 +------------------------------- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 6 -- drivers/infiniband/hw/bnxt_re/main.c | 4 -- 3 files changed, 2 insertions(+), 106 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 -96
@@ -189,8 +189,8 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->max_total_mcast_qp_attach =0 ; ib_attr->max_ah = dev_attr->max_ah; - ib_attr->max_fmr = dev_attr->max_fmr; - ib_attr->max_map_per_fmr =1 ;/* ? */ + ib_attr->max_fmr =0 ; + ib_attr->max_map_per_fmr =0 ; ib_attr->max_srq = dev_attr->max_srq; ib_attr->max_srq_wr = dev_attr->max_srq_wqes;
@@ -3207,100 +3207,6 @@ int bnxt_re_dealloc_mw(struct ib_mw *ib_mw)return rc; } -/* Fast Memory Regions */ -struct ib_fmr *bnxt_re_alloc_fmr (struct ib_pd *ib_pd,int mr_access_flags, -struct ib_fmr_attr *fmr_attr) -{ - struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd); -struct bnxt_re_dev *rdev = pd->rdev; -struct bnxt_re_fmr *fmr; -int rc; - -if (fmr_attr->max_pages >MAX_PBL_LVL_2_PGS || - fmr_attr->max_maps > rdev->dev_attr.max_map_per_fmr) { -dev_err (rdev_to_dev (rdev),"Allocate FMR exceeded Max limit" ); -return ERR_PTR (-ENOMEM ); - } - fmr =kzalloc (sizeof (*fmr),GFP_KERNEL ); -if (!fmr) -return ERR_PTR (-ENOMEM ); - - fmr->rdev = rdev; - fmr->qplib_fmr.pd = &pd->qplib_pd; - fmr->qplib_fmr.type =CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR ; - - rc =bnxt_qplib_alloc_mrw (&rdev->qplib_res, &fmr->qplib_fmr); -if (rc) - goto fail; - - fmr->qplib_fmr.flags =__from_ib_access_flags (mr_access_flags); - fmr->ib_fmr.lkey = fmr->qplib_fmr.lkey; - fmr->ib_fmr.rkey = fmr->ib_fmr.lkey; - -atomic_inc (&rdev->mr_count); -return &fmr->ib_fmr; -fail: -kfree (fmr); -return ERR_PTR (rc); -} - -int bnxt_re_map_phys_fmr (struct ib_fmr *ib_fmr,u64 *page_list,int list_len, -u64 iova) -{ - struct bnxt_re_fmr *fmr = container_of(ib_fmr, struct bnxt_re_fmr, - ib_fmr); -struct bnxt_re_dev *rdev = fmr->rdev; -int rc; - - fmr->qplib_fmr.va = iova; - fmr->qplib_fmr.total_size = list_len *PAGE_SIZE ; - - rc =bnxt_qplib_reg_mr (&rdev->qplib_res, &fmr->qplib_fmr, page_list, - list_len, true); -if (rc) -dev_err (rdev_to_dev (rdev),"Failed to map FMR for lkey = 0x%x!" , - fmr->ib_fmr.lkey); -return rc; -} - -int bnxt_re_unmap_fmr (struct list_head *fmr_list) -{ -struct bnxt_re_dev *rdev; -struct bnxt_re_fmr *fmr; -struct ib_fmr *ib_fmr; -int rc =0 ; - -/* Validate each FMRs inside the fmr_list */ -list_for_each_entry (ib_fmr, fmr_list, list) { - fmr = container_of(ib_fmr, struct bnxt_re_fmr, ib_fmr); - rdev = fmr->rdev; - -if (rdev) { - rc =bnxt_qplib_dereg_mrw (&rdev->qplib_res, - &fmr->qplib_fmr, true); -if (rc) -break ; - } - } -return rc; -} - -int bnxt_re_dealloc_fmr (struct ib_fmr *ib_fmr) -{ - struct bnxt_re_fmr *fmr = container_of(ib_fmr, struct bnxt_re_fmr, - ib_fmr); -struct bnxt_re_dev *rdev = fmr->rdev; -int rc; - - rc =bnxt_qplib_free_mrw (&rdev->qplib_res, &fmr->qplib_fmr); -if (rc) -dev_err (rdev_to_dev (rdev),"Failed to free FMR" ); - -kfree (fmr); -atomic_dec (&rdev->mr_count); -return rc; -} -/* uverbs */ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, u64 virt_addr, int mr_access_flags,
drivers/infiniband/hw/bnxt_re/ib_verbs.h +0 -6
@@ -196,12 +196,6 @@ int bnxt_re_dereg_mr(struct ib_mr *mr);struct ib_mw *bnxt_re_alloc_mw (struct ib_pd *ib_pd,enum ib_mw_type type,struct ib_udata *udata);int bnxt_re_dealloc_mw (struct ib_mw *mw); -struct ib_fmr *bnxt_re_alloc_fmr (struct ib_pd *pd,int mr_access_flags, -struct ib_fmr_attr *fmr_attr); -int bnxt_re_map_phys_fmr (struct ib_fmr *fmr,u64 *page_list,int list_len, -u64 iova); -int bnxt_re_unmap_fmr (struct list_head *fmr_list); -int bnxt_re_dealloc_fmr (struct ib_fmr *fmr);struct ib_mr *bnxt_re_reg_user_mr (struct ib_pd *pd,u64 start,u64 length,u64 virt_addr,int mr_access_flags,struct ib_udata *udata);
drivers/infiniband/hw/bnxt_re/main.c +0 -4
@@ -510,10 +510,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) ibdev->dereg_mr = bnxt_re_dereg_mr; ibdev->alloc_mr = bnxt_re_alloc_mr; ibdev->map_mr_sg = bnxt_re_map_mr_sg; - ibdev->alloc_fmr = bnxt_re_alloc_fmr; - ibdev->map_phys_fmr = bnxt_re_map_phys_fmr; - ibdev->unmap_fmr = bnxt_re_unmap_fmr; - ibdev->dealloc_fmr = bnxt_re_dealloc_fmr; ibdev->reg_user_mr = bnxt_re_reg_user_mr; ibdev->alloc_ucontext = bnxt_re_alloc_ucontext;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1495169074-12641-16-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]
Christoph Hellwig
Acked-byRe: [PATCH V3 for-next 15/15] RDMA/bnxt_re: Remove FMR support
Quoted 3 lines · Selvin Xavier
Some issues observed with FMR implementation
while running stress traffic. So removing the
FMR verbs support for now.
Thanks! And place don't bring it back ever, we shouldn't add FMR support to new drivers..
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html