hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/infiniband/hw/bnxt_re/qplib_fp.c
....@@ -404,6 +404,9 @@
404404
405405 void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill)
406406 {
407
+ if (!nq->requested)
408
+ return;
409
+
407410 tasklet_disable(&nq->nq_tasklet);
408411 /* Mask h/w interrupt */
409412 bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, false);
....@@ -411,11 +414,12 @@
411414 synchronize_irq(nq->msix_vec);
412415 if (kill)
413416 tasklet_kill(&nq->nq_tasklet);
414
- if (nq->requested) {
415
- irq_set_affinity_hint(nq->msix_vec, NULL);
416
- free_irq(nq->msix_vec, nq);
417
- nq->requested = false;
418
- }
417
+
418
+ irq_set_affinity_hint(nq->msix_vec, NULL);
419
+ free_irq(nq->msix_vec, nq);
420
+ kfree(nq->name);
421
+ nq->name = NULL;
422
+ nq->requested = false;
419423 }
420424
421425 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)
....@@ -441,6 +445,7 @@
441445 int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
442446 int msix_vector, bool need_init)
443447 {
448
+ struct bnxt_qplib_res *res = nq->res;
444449 int rc;
445450
446451 if (nq->requested)
....@@ -452,10 +457,17 @@
452457 else
453458 tasklet_enable(&nq->nq_tasklet);
454459
455
- snprintf(nq->name, sizeof(nq->name), "bnxt_qplib_nq-%d", nq_indx);
460
+ nq->name = kasprintf(GFP_KERNEL, "bnxt_re-nq-%d@pci:%s",
461
+ nq_indx, pci_name(res->pdev));
462
+ if (!nq->name)
463
+ return -ENOMEM;
456464 rc = request_irq(nq->msix_vec, bnxt_qplib_nq_irq, 0, nq->name, nq);
457
- if (rc)
465
+ if (rc) {
466
+ kfree(nq->name);
467
+ nq->name = NULL;
468
+ tasklet_disable(&nq->nq_tasklet);
458469 return rc;
470
+ }
459471
460472 cpumask_clear(&nq->mask);
461473 cpumask_set_cpu(nq_indx, &nq->mask);
....@@ -466,7 +478,7 @@
466478 nq->msix_vec, nq_indx);
467479 }
468480 nq->requested = true;
469
- bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, nq->res->cctx, true);
481
+ bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, res->cctx, true);
470482
471483 return rc;
472484 }
....@@ -1599,7 +1611,7 @@
15991611 il_src = (void *)wqe->sg_list[indx].addr;
16001612 t_len += len;
16011613 if (t_len > qp->max_inline_data)
1602
- goto bad;
1614
+ return -ENOMEM;
16031615 while (len) {
16041616 if (pull_dst) {
16051617 pull_dst = false;
....@@ -1623,8 +1635,6 @@
16231635 }
16241636
16251637 return t_len;
1626
-bad:
1627
- return -ENOMEM;
16281638 }
16291639
16301640 static u32 bnxt_qplib_put_sges(struct bnxt_qplib_hwq *hwq,
....@@ -2041,6 +2051,12 @@
20412051 u32 pg_sz_lvl;
20422052 int rc;
20432053
2054
+ if (!cq->dpi) {
2055
+ dev_err(&rcfw->pdev->dev,
2056
+ "FP: CREATE_CQ failed due to NULL DPI\n");
2057
+ return -EINVAL;
2058
+ }
2059
+
20442060 hwq_attr.res = res;
20452061 hwq_attr.depth = cq->max_wqe;
20462062 hwq_attr.stride = sizeof(struct cq_base);
....@@ -2048,15 +2064,10 @@
20482064 hwq_attr.sginfo = &cq->sg_info;
20492065 rc = bnxt_qplib_alloc_init_hwq(&cq->hwq, &hwq_attr);
20502066 if (rc)
2051
- goto exit;
2067
+ return rc;
20522068
20532069 RCFW_CMD_PREP(req, CREATE_CQ, cmd_flags);
20542070
2055
- if (!cq->dpi) {
2056
- dev_err(&rcfw->pdev->dev,
2057
- "FP: CREATE_CQ failed due to NULL DPI\n");
2058
- return -EINVAL;
2059
- }
20602071 req.dpi = cpu_to_le32(cq->dpi->dpi);
20612072 req.cq_handle = cpu_to_le64(cq->cq_handle);
20622073 req.cq_size = cpu_to_le32(cq->hwq.max_elements);
....@@ -2094,7 +2105,6 @@
20942105
20952106 fail:
20962107 bnxt_qplib_free_hwq(res, &cq->hwq);
2097
-exit:
20982108 return rc;
20992109 }
21002110
....@@ -2722,11 +2732,8 @@
27222732
27232733 qp = (struct bnxt_qplib_qp *)((unsigned long)
27242734 le64_to_cpu(hwcqe->qp_handle));
2725
- if (!qp) {
2726
- dev_err(&cq->hwq.pdev->dev,
2727
- "FP: CQ Process terminal qp is NULL\n");
2735
+ if (!qp)
27282736 return -EINVAL;
2729
- }
27302737
27312738 /* Must block new posting of SQ and RQ */
27322739 qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR;