RDMA/bnxt_re: Bug fixes
Subsystems (2)
Selvin Xavier
maintainercover RDMA/bnxt_re: Bug fixes
Includes some of the generic bug fixes in bnxt_re driver. Please review and apply.
Thanks,
Selvin Xavier
Kalesh AP (9):
RDMA/bnxt_re: Fix a possible memory leak RDMA/bnxt_re: Fix to remove unnecessary return labels RDMA/bnxt_re: Use unique names while registering interrupts RDMA/bnxt_re: Remove a redundant check inside bnxt_re_update_gid RDMA/bnxt_re: Fix return value of bnxt_re_process_raw_qp_pkt_rx RDMA/bnxt_re: Fix to remove an unnecessary log RDMA/bnxt_re: Do not enable congestion control on VFs RDMA/bnxt_re: Return directly without goto jumps RDMA/bnxt_re: Remove unnecessary checks
Selvin Xavier (1):
RDMA/bnxt_re: Disable/kill tasklet only if it is enabled
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- drivers/infiniband/hw/bnxt_re/main.c | 24 ++++--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 111 ++++++++++++++--------------- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 29 ++++++-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 8 --- 7 files changed, 91 insertions(+), 86 deletions(-)
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 1/10 RDMA/bnxt_re: Fix a possible memory leak
From: Kalesh AP <[email protected]>
Inside bnxt_qplib_create_cq(), when the check for NULL DPI fails, driver returns directly without freeing the memory allocated inside bnxt_qplib_alloc_init_hwq() routine.
Fixed this by moving the check for NULL DPI before invoking bnxt_qplib_alloc_init_hwq().
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +6 -5
@@ -2056,6 +2056,12 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)u32 pg_sz_lvl;int rc; +if (!cq->dpi) { +dev_err (&rcfw->pdev->dev, +"FP: CREATE_CQ failed due to NULL DPI\n" ); +return -EINVAL ; + } + hwq_attr.res = res; hwq_attr.depth = cq->max_wqe; hwq_attr.stride =sizeof (struct cq_base );
@@ -2069,11 +2075,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)CMDQ_BASE_OPCODE_CREATE_CQ , sizeof(req)); -if (!cq->dpi) { -dev_err (&rcfw->pdev->dev, -"FP: CREATE_CQ failed due to NULL DPI\n" ); -return -EINVAL ; - } req.dpi =cpu_to_le32 (cq->dpi->dpi); req.cq_handle =cpu_to_le64 (cq->cq_handle); req.cq_size =cpu_to_le32 (cq->hwq.max_elements);
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 2/10 RDMA/bnxt_re: Fix to remove unnecessary return labels
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
If there is no cleanup needed then just return directly. This cleans up the code and improve readability.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +2 -5
@@ -1614,7 +1614,7 @@ static int bnxt_qplib_put_inline(struct bnxt_qplib_qp *qp, il_src = (void *)wqe->sg_list[indx].addr; t_len += len;if (t_len > qp->max_inline_data) - goto bad; +return -ENOMEM ;while (len) {if (pull_dst) { pull_dst = false;
@@ -1638,8 +1638,6 @@ static int bnxt_qplib_put_inline(struct bnxt_qplib_qp *qp, }return t_len; -bad: -return -ENOMEM ; } static u32 bnxt_qplib_put_sges(struct bnxt_qplib_hwq *hwq,
@@ -2069,7 +2067,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) hwq_attr.sginfo = &cq->sg_info; rc =bnxt_qplib_alloc_init_hwq (&cq->hwq, &hwq_attr);if (rc) - goto exit; +return rc; bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req, CMDQ_BASE_OPCODE_CREATE_CQ,
@@ -2112,7 +2110,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) fail:bnxt_qplib_free_hwq (res, &cq->hwq); -exit:return rc; }
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 3/10 RDMA/bnxt_re: Disable/kill tasklet only if it is enabled
In reply to Selvin XavierWhen the ulp hook to start the IRQ fails because the rings are not available, tasklets are not enabled. In this case when the driver is unloaded, driver calls CREQ tasklet_kill. This causes an indefinite hang as the tasklet is not enabled.
Driver shouldn't call tasklet_kill if it is not enabled. So using the creq->requested and nq->requested flags to identify if both tasklets/irqs are registered. Checking this flag while scheduling the tasklet from ISR. Also, added a cleanup for disabling tasklet, in case request_irq fails during start_irq.
Check for return value for bnxt_qplib_rcfw_start_irq and in case the bnxt_qplib_rcfw_start_irq fails, return bnxt_re_start_irq without attempting to start NQ IRQs.
--- drivers/infiniband/hw/bnxt_re/main.c | 12 +++++++++--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 16 ++++++++++------ drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 14 +++++++++----- 3 files changed, 28 insertions(+), 14 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +9 -3
@@ -283,15 +283,21 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)for (indx =0 ; indx < rdev->num_msix; indx++) rdev->en_dev->msix_entries[indx].vector = ent[indx].vector; -bnxt_qplib_rcfw_start_irq (rcfw, msix_ent[BNXT_RE_AEQ_IDX ].vector, - false); + rc =bnxt_qplib_rcfw_start_irq (rcfw, msix_ent[BNXT_RE_AEQ_IDX ].vector, + false); +if (rc) { +ibdev_warn (&rdev->ibdev,"Failed to reinit CREQ\n" ); +return ; + }for (indx =BNXT_RE_NQ_IDX ; indx < rdev->num_msix; indx++) { nq = &rdev->nq[indx -1 ]; rc =bnxt_qplib_nq_start_irq (nq, indx -1 , msix_ent[indx].vector, false); -if (rc) +if (rc) {ibdev_warn (&rdev->ibdev,"Failed to reinit NQ index %d\n" , indx -1 ); +return ; + } } }
drivers/infiniband/hw/bnxt_re/qplib_fp.c +10 -6
@@ -399,6 +399,9 @@ static irqreturn_t bnxt_qplib_nq_irq(int irq, void *dev_instance)void bnxt_qplib_nq_stop_irq (struct bnxt_qplib_nq *nq,bool kill) { +if (!nq->requested) +return ; +tasklet_disable (&nq->nq_tasklet);/* Mask h/w interrupt */ bnxt_qplib_ring_nq_db (&nq->nq_db.dbinfo, nq->res->cctx, false);
@@ -406,11 +409,10 @@ void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill)synchronize_irq (nq->msix_vec);if (kill)tasklet_kill (&nq->nq_tasklet); -if (nq->requested) { -irq_set_affinity_hint (nq->msix_vec,NULL ); -free_irq (nq->msix_vec, nq); - nq->requested = false; - } + +irq_set_affinity_hint (nq->msix_vec,NULL ); +free_irq (nq->msix_vec, nq); + nq->requested = false; }void bnxt_qplib_disable_nq (struct bnxt_qplib_nq *nq)
@@ -449,8 +451,10 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,snprintf (nq->name,sizeof (nq->name),"bnxt_qplib_nq-%d" , nq_indx); rc =request_irq (nq->msix_vec, bnxt_qplib_nq_irq,0 , nq->name, nq); -if (rc) +if (rc) { +tasklet_disable (&nq->nq_tasklet);return rc; + }cpumask_clear (&nq->mask);cpumask_set_cpu (nq_indx, &nq->mask);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +9 -5
@@ -636,6 +636,10 @@ void bnxt_qplib_rcfw_stop_irq(struct bnxt_qplib_rcfw *rcfw, bool kill)struct bnxt_qplib_creq_ctx *creq; creq = &rcfw->creq; + +if (!creq->requested) +return ; +tasklet_disable (&creq->creq_tasklet);/* Mask h/w interrupts */ bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, rcfw->res->cctx, false);
@@ -644,10 +648,8 @@ void bnxt_qplib_rcfw_stop_irq(struct bnxt_qplib_rcfw *rcfw, bool kill)if (kill)tasklet_kill (&creq->creq_tasklet); -if (creq->requested) { -free_irq (creq->msix_vec, rcfw); - creq->requested = false; - } +free_irq (creq->msix_vec, rcfw); + creq->requested = false; }void bnxt_qplib_disable_rcfw_channel (struct bnxt_qplib_rcfw *rcfw)
@@ -693,8 +695,10 @@ int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,tasklet_enable (&creq->creq_tasklet); rc =request_irq (creq->msix_vec, bnxt_qplib_creq_irq,0 ,"bnxt_qplib_creq" , rcfw); -if (rc) +if (rc) { +tasklet_disable (&creq->creq_tasklet);return rc; + } creq->requested = true;bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, rcfw->res->cctx, true);
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 4/10 RDMA/bnxt_re: Use unique names while registering interrupts
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
bnxt_re currently uses the names "bnxt_qplib_creq" and "bnxt_qplib_nq-0" while registering IRQs. There is no way to distinguish the IRQs of different device ports when there are multiple IB devices registered. This could make the scenarios worse where one want to pin IRQs of a device port to certain CPUs.
Fixed the code to use unique names which has PCI BDF information while registering interrupts like: "bnxt_re-nq-0@pci:0000:65:00.0" and "bnxt_re-creq@pci:0000:65:00.1".
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 12 ++++++++++-- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 15 +++++++++++++-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + 4 files changed, 25 insertions(+), 5 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +10 -2
@@ -412,6 +412,8 @@ void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill)irq_set_affinity_hint (nq->msix_vec,NULL );free_irq (nq->msix_vec, nq); +kfree (nq->name); + nq->name =NULL ; nq->requested = false; }
@@ -438,6 +440,7 @@ void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)int bnxt_qplib_nq_start_irq (struct bnxt_qplib_nq *nq,int nq_indx,int msix_vector,bool need_init) { +struct bnxt_qplib_res *res = nq->res;int rc;if (nq->requested)
@@ -449,9 +452,14 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,else tasklet_enable (&nq->nq_tasklet); -snprintf (nq->name,sizeof (nq->name),"bnxt_qplib_nq-%d" , nq_indx); + nq->name =kasprintf (GFP_KERNEL ,"bnxt_re-nq-%d@pci:%s" , + nq_indx,pci_name (res->pdev)); +if (!nq->name) +return -ENOMEM ; rc =request_irq (nq->msix_vec, bnxt_qplib_nq_irq,0 , nq->name, nq);if (rc) { +kfree (nq->name); + nq->name =NULL ;tasklet_disable (&nq->nq_tasklet);return rc; }
@@ -465,7 +473,7 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx, nq->msix_vec, nq_indx); } nq->requested = true; -bnxt_qplib_ring_nq_db (&nq->nq_db.dbinfo, nq->res->cctx, true); +bnxt_qplib_ring_nq_db (&nq->nq_db.dbinfo, res->cctx, true);return rc; }
drivers/infiniband/hw/bnxt_re/qplib_fp.h +1 -1
@@ -472,7 +472,7 @@ typedef int (*srqn_handler_t)(struct bnxt_qplib_nq *nq,struct bnxt_qplib_nq {struct pci_dev *pdev;struct bnxt_qplib_res *res; -char name[32 ]; +char *name;struct bnxt_qplib_hwq hwq;struct bnxt_qplib_nq_db nq_db;u16 ring_id;
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +13 -2
@@ -649,6 +649,8 @@ void bnxt_qplib_rcfw_stop_irq(struct bnxt_qplib_rcfw *rcfw, bool kill)tasklet_kill (&creq->creq_tasklet);free_irq (creq->msix_vec, rcfw); +kfree (creq->irq_name); + creq->irq_name =NULL ; creq->requested = false; }
@@ -681,9 +683,11 @@ int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector, bool need_init) {struct bnxt_qplib_creq_ctx *creq; +struct bnxt_qplib_res *res;int rc; creq = &rcfw->creq; + res = rcfw->res;if (creq->requested)return -EFAULT ;
@@ -693,15 +697,22 @@ int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,tasklet_setup (&creq->creq_tasklet, bnxt_qplib_service_creq); else tasklet_enable(&creq->creq_tasklet); + + creq->irq_name =kasprintf (GFP_KERNEL ,"bnxt_re-creq@pci:%s" , +pci_name (res->pdev)); +if (!creq->irq_name) +return -ENOMEM ; rc =request_irq (creq->msix_vec, bnxt_qplib_creq_irq,0 , -"bnxt_qplib_creq" , rcfw); + creq->irq_name, rcfw);if (rc) { +kfree (creq->irq_name); + creq->irq_name =NULL ;tasklet_disable (&creq->creq_tasklet);return rc; } creq->requested = true; -bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, rcfw->res->cctx, true); +bnxt_qplib_ring_nq_db (&creq->creq_db.dbinfo, res->cctx, true);return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +1 -0
@@ -186,6 +186,7 @@ struct bnxt_qplib_creq_ctx {u16 ring_id;int msix_vec;bool requested;/*irq handler installed */ +char *irq_name; };/* RCFW Communication Channels */
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 5/10 RDMA/bnxt_re: Remove a redundant check inside bnxt_re_update_gid
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
The NULL check inside bnxt_re_update_gid() always return false. If sgid_tbl->tbl is not allocated, then dev_init would have failed.
--- drivers/infiniband/hw/bnxt_re/main.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +1 -7
@@ -969,12 +969,6 @@ static int bnxt_re_update_gid(struct bnxt_re_dev *rdev)if (!ib_device_try_get (&rdev->ibdev))return 0 ; -if (!sgid_tbl) { -ibdev_err (&rdev->ibdev,"QPLIB: SGID table not allocated" ); - rc = -EINVAL ; - goto out; - } -for (index =0 ; index < sgid_tbl->active; index++) { gid_idx = sgid_tbl->hw_id[index];
@@ -992,7 +986,7 @@ static int bnxt_re_update_gid(struct bnxt_re_dev *rdev) rc =bnxt_qplib_update_sgid (sgid_tbl, &gid, gid_idx, rdev->qplib_res.netdev->dev_addr); } -out: +ib_device_put (&rdev->ibdev);return rc; }
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 6/10 RDMA/bnxt_re: Fix return value of bnxt_re_process_raw_qp_pkt_rx
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
bnxt_re_process_raw_qp_pkt_rx() always return 0 and ignores the return value of bnxt_re_post_send_shadow_qp().
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -1
@@ -3343,7 +3343,7 @@ static int bnxt_re_process_raw_qp_pkt_rx(struct bnxt_re_qp *gsi_qp,/* post data received in the send queue */ rc =bnxt_re_post_send_shadow_qp (rdev, gsi_sqp, swr); -return 0 ; +return rc; } static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc,
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 7/10 RDMA/bnxt_re: Fix to remove an unnecessary log
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
During destroy_qp, driver sets the qp handle in the existing CQEs belonging to the QP being destroyed to NULL. As a result, a poll_cq after destroy_qp can report unnecessary messages.
Remove this noise from system logs.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 -4
@@ -2799,11 +2799,8 @@ static int bnxt_qplib_cq_process_terminal(struct bnxt_qplib_cq *cq, qp = (struct bnxt_qplib_qp *)((unsigned long )le64_to_cpu (hwcqe->qp_handle)); -if (!qp) { -dev_err (&cq->hwq.pdev->dev, -"FP: CQ Process terminal qp is NULL\n" ); +if (!qp)return -EINVAL ; - }/* Must block new posting of SQ and RQ */ qp->state =CMDQ_MODIFY_QP_NEW_STATE_ERR ;
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 8/10 RDMA/bnxt_re: Do not enable congestion control on VFs
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
Congestion control needs to be enabled only on the PFs. FW fails the command if issued on VFs. Avoid sending the command on VFs.
--- drivers/infiniband/hw/bnxt_re/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/bnxt_re/main.c +4 -0
@@ -1336,6 +1336,10 @@ static void bnxt_re_setup_cc(struct bnxt_re_dev *rdev, bool enable) {struct bnxt_qplib_cc_param cc_param = {}; +/* Do not enable congestion control on VFs */ +if (rdev->is_virtfn) +return ; +/* Currently enabling only for GenP5 adapters */ if (!bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx))return ;
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 9/10 RDMA/bnxt_re: Return directly without goto jumps
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
When there is no cleanup to be done, return directly. This will help eliminating unnecessary local variables and goto labels.
This patch fixes such occurrences in qplib_fp.c file.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 60 ++++++++++++-------------------- 1 file changed, 23 insertions(+), 37 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +23 -37
@@ -483,7 +483,6 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt)resource_size_t reg_base;struct bnxt_qplib_nq_db *nq_db;struct pci_dev *pdev; -int rc =0 ; pdev = nq->pdev; nq_db = &nq->nq_db;
@@ -493,8 +492,7 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt)if (!nq_db->reg.bar_base) {dev_err (&pdev->dev,"QPLIB: NQ BAR region %d resc start is 0!" , nq_db->reg.bar_id); - rc = -ENOMEM ; - goto fail; +return -ENOMEM ; } reg_base = nq_db->reg.bar_base + reg_offt;
@@ -504,15 +502,14 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt)if (!nq_db->reg.bar_reg) {dev_err (&pdev->dev,"QPLIB: NQ BAR region %d mapping failed" , nq_db->reg.bar_id); - rc = -ENOMEM ; - goto fail; +return -ENOMEM ; } nq_db->dbinfo.db = nq_db->reg.bar_reg; nq_db->dbinfo.hwq = &nq->hwq; nq_db->dbinfo.xid = nq->ring_id; -fail: -return rc; + +return 0 ; } int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
@@ -626,7 +623,7 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, hwq_attr.type =HWQ_TYPE_QUEUE ; rc =bnxt_qplib_alloc_init_hwq (&srq->hwq, &hwq_attr);if (rc) - goto exit; +return rc; srq->swq =kcalloc (srq->hwq.max_elements,sizeof (*srq->swq),GFP_KERNEL );
@@ -680,7 +677,7 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, fail:bnxt_qplib_free_hwq (res, &srq->hwq);kfree (srq->swq); -exit: +return rc; }
@@ -744,15 +741,14 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq,struct rq_wqe *srqe;struct sq_sge *hw_sge;u32 sw_prod, sw_cons, count =0 ; -int i, rc =0 , next; +int i, next;spin_lock (&srq_hwq->lock);if (srq->start_idx == srq->last_idx) {dev_err (&srq_hwq->pdev->dev,"FP: SRQ (0x%x) is full!\n" , srq->id); - rc = -EINVAL ;spin_unlock (&srq_hwq->lock); - goto done; +return -EINVAL ; } next = srq->start_idx; srq->start_idx = srq->swq[next].next_idx;
@@ -793,22 +789,19 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq, srq->arm_req = false;bnxt_qplib_srq_arm_db (&srq->dbinfo, srq->threshold); } -done: -return rc; + +return 0 ; }/* QP */ static int bnxt_qplib_alloc_init_swq (struct bnxt_qplib_q *que) { -int rc =0 ;int indx; que->swq =kcalloc (que->max_wqe,sizeof (*que->swq),GFP_KERNEL ); -if (!que->swq) { - rc = -ENOMEM ; - goto out; - } +if (!que->swq) +return -ENOMEM ; que->swq_start =0 ; que->swq_last = que->max_wqe -1 ;
@@ -816,8 +809,8 @@ static int bnxt_qplib_alloc_init_swq(struct bnxt_qplib_q *que) que->swq[indx].next_idx = indx +1 ; que->swq[que->swq_last].next_idx =0 ;/* Make it circular */ que->swq_last =0 ; -out: -return rc; + +return 0 ; }int bnxt_qplib_create_qp1 (struct bnxt_qplib_res *res,struct bnxt_qplib_qp *qp)
@@ -851,7 +844,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) hwq_attr.type =HWQ_TYPE_QUEUE ; rc =bnxt_qplib_alloc_init_hwq (&sq->hwq, &hwq_attr);if (rc) - goto exit; +return rc; rc =bnxt_qplib_alloc_init_swq (sq);if (rc)
@@ -939,7 +932,6 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)kfree (sq->swq); fail_sq:bnxt_qplib_free_hwq (res, &sq->hwq); -exit:return rc; }
@@ -1004,7 +996,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) hwq_attr.type =HWQ_TYPE_QUEUE ; rc =bnxt_qplib_alloc_init_hwq (&sq->hwq, &hwq_attr);if (rc) - goto exit; +return rc; rc =bnxt_qplib_alloc_init_swq (sq);if (rc)
@@ -1152,7 +1144,6 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)kfree (sq->swq); fail_sq:bnxt_qplib_free_hwq (res, &sq->hwq); -exit:return rc; }
@@ -2514,7 +2505,6 @@ static int bnxt_qplib_cq_process_res_rc(struct bnxt_qplib_cq *cq,struct bnxt_qplib_qp *qp;struct bnxt_qplib_q *rq;u32 wr_id_idx; -int rc =0 ; qp = (struct bnxt_qplib_qp *)((unsigned long )le64_to_cpu (hwcqe->qp_handle));
@@ -2525,7 +2515,7 @@ static int bnxt_qplib_cq_process_res_rc(struct bnxt_qplib_cq *cq,if (qp->rq.flushed) {dev_dbg (&cq->hwq.pdev->dev,"%s: QP in Flush QP = %p\n" , __func__, qp); - goto done; +return 0 ; } cqe = *pcqe;
@@ -2581,8 +2571,7 @@ static int bnxt_qplib_cq_process_res_rc(struct bnxt_qplib_cq *cq, } } -done: -return rc; +return 0 ; } static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq,
@@ -2595,7 +2584,6 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq,struct bnxt_qplib_qp *qp;struct bnxt_qplib_q *rq;u32 wr_id_idx; -int rc =0 ; qp = (struct bnxt_qplib_qp *)((unsigned long )le64_to_cpu (hwcqe->qp_handle));
@@ -2606,7 +2594,7 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq,if (qp->rq.flushed) {dev_dbg (&cq->hwq.pdev->dev,"%s: QP in Flush QP = %p\n" , __func__, qp); - goto done; +return 0 ; } cqe = *pcqe; cqe->opcode = hwcqe->cqe_type_toggle &CQ_BASE_CQE_TYPE_MASK ;
@@ -2668,8 +2656,8 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq,bnxt_qplib_add_flush_qp (qp); } } -done: -return rc; + +return 0 ; }bool bnxt_qplib_is_cq_empty (struct bnxt_qplib_cq *cq)
@@ -2696,7 +2684,6 @@ static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq,struct bnxt_qplib_srq *srq;struct bnxt_qplib_cqe *cqe;u32 wr_id_idx; -int rc =0 ; qp = (struct bnxt_qplib_qp *)((unsigned long )le64_to_cpu (hwcqe->qp_handle));
@@ -2707,7 +2694,7 @@ static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq,if (qp->rq.flushed) {dev_dbg (&cq->hwq.pdev->dev,"%s: QP in Flush QP = %p\n" , __func__, qp); - goto done; +return 0 ; } cqe = *pcqe; cqe->opcode = hwcqe->cqe_type_toggle &CQ_BASE_CQE_TYPE_MASK ;
@@ -2776,8 +2763,7 @@ static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, } } -done: -return rc; +return 0 ; } static int bnxt_qplib_cq_process_terminal(struct bnxt_qplib_cq *cq,
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 10/10 RDMA/bnxt_re: Remove unnecessary checks
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
The NULL check inside bnxt_qplib_del_sgid() and bnxt_qplib_add_sgid() always return false as the "sgid_tbl" inside "rdev->qplib_res" is a static memory.
--- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_sp.c +0 -8
@@ -233,10 +233,6 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,struct bnxt_qplib_rcfw *rcfw = res->rcfw;int index; -if (!sgid_tbl) { -dev_err (&res->pdev->dev,"SGID table not allocated\n" ); -return -EINVAL ; - }/* Do we need a sgid_lock here? */ if (!sgid_tbl->active) {dev_err (&res->pdev->dev,"SGID table has no active entries\n" );
@@ -297,10 +293,6 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,struct bnxt_qplib_rcfw *rcfw = res->rcfw;int i, free_idx; -if (!sgid_tbl) { -dev_err (&res->pdev->dev,"SGID table not allocated\n" ); -return -EINVAL ; - }/* Do we need a sgid_lock here? */ if (sgid_tbl->active == sgid_tbl->max) {dev_err (&res->pdev->dev,"SGID table is full\n" );
Signature · 1 line
2.5.5
Jason Gunthorpe
maintainerQuoted 17 lines · Selvin Xavier
Includes some of the generic bug fixes in
bnxt_redriver. Please review and apply.Thanks,
Selvin XavierKalesh AP (9):
RDMA/bnxt_re: Fix a possible memory leak RDMA/bnxt_re: Fix to remove unnecessary return labels RDMA/bnxt_re: Use unique names while registering interrupts RDMA/bnxt_re: Remove a redundant check insidebnxt_re_update_gidRDMA/bnxt_re: Fix return value ofbnxt_re_process_raw_qp_pkt_rxRDMA/bnxt_re: Fix to remove an unnecessary log RDMA/bnxt_re: Do not enable congestion control on VFs RDMA/bnxt_re: Return directly without goto jumps RDMA/bnxt_re: Remove unnecessary checks
Quoted 2 lines
Selvin Xavier (1):
RDMA/bnxt_re: Disable/kill tasklet only if it is enabled
A lot of this is not for-rc material, please split it up properly
Jason
Selvin Xavier
maintainerQuoted 19 lines · Jason Gunthorpe
Quoted 17 lines · Selvin Xavier
Includes some of the generic bug fixes in
bnxt_redriver. Please review and apply.Thanks,
Selvin XavierKalesh AP (9):
RDMA/bnxt_re: Fix a possible memory leak RDMA/bnxt_re: Fix to remove unnecessary return labels RDMA/bnxt_re: Use unique names while registering interrupts RDMA/bnxt_re: Remove a redundant check insidebnxt_re_update_gidRDMA/bnxt_re: Fix return value ofbnxt_re_process_raw_qp_pkt_rxRDMA/bnxt_re: Fix to remove an unnecessary log RDMA/bnxt_re: Do not enable congestion control on VFs RDMA/bnxt_re: Return directly without goto jumps RDMA/bnxt_re: Remove unnecessary checks
Quoted 4 lines
Quoted 2 lines
Selvin Xavier (1):
RDMA/bnxt_re: Disable/kill tasklet only if it is enabledA lot of this is not for-rc material, please split it up properly
sure. will post it as two series.
-Selvin
Quoted 2 lines
Jason