hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
....@@ -181,7 +181,7 @@
181181 } while (size > 0);
182182 cmdq->seq_num++;
183183
184
- cmdq_prod = hwq->prod;
184
+ cmdq_prod = hwq->prod & 0xFFFF;
185185 if (test_bit(FIRMWARE_FIRST_FLAG, &cmdq->flags)) {
186186 /* The very first doorbell write
187187 * is required to set this flag
....@@ -295,7 +295,8 @@
295295 }
296296
297297 static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
298
- struct creq_qp_event *qp_event)
298
+ struct creq_qp_event *qp_event,
299
+ u32 *num_wait)
299300 {
300301 struct creq_qp_error_notification *err_event;
301302 struct bnxt_qplib_hwq *hwq = &rcfw->cmdq.hwq;
....@@ -304,6 +305,7 @@
304305 u16 cbit, blocked = 0;
305306 struct pci_dev *pdev;
306307 unsigned long flags;
308
+ u32 wait_cmds = 0;
307309 __le16 mcookie;
308310 u16 cookie;
309311 int rc = 0;
....@@ -363,9 +365,10 @@
363365 crsqe->req_size = 0;
364366
365367 if (!blocked)
366
- wake_up(&rcfw->cmdq.waitq);
368
+ wait_cmds++;
367369 spin_unlock_irqrestore(&hwq->lock, flags);
368370 }
371
+ *num_wait += wait_cmds;
369372 return rc;
370373 }
371374
....@@ -379,6 +382,7 @@
379382 struct creq_base *creqe;
380383 u32 sw_cons, raw_cons;
381384 unsigned long flags;
385
+ u32 num_wakeup = 0;
382386
383387 /* Service the CREQ until budget is over */
384388 spin_lock_irqsave(&hwq->lock, flags);
....@@ -397,7 +401,8 @@
397401 switch (type) {
398402 case CREQ_BASE_TYPE_QP_EVENT:
399403 bnxt_qplib_process_qp_event
400
- (rcfw, (struct creq_qp_event *)creqe);
404
+ (rcfw, (struct creq_qp_event *)creqe,
405
+ &num_wakeup);
401406 creq->stats.creq_qp_event_processed++;
402407 break;
403408 case CREQ_BASE_TYPE_FUNC_EVENT:
....@@ -425,6 +430,8 @@
425430 rcfw->res->cctx, true);
426431 }
427432 spin_unlock_irqrestore(&hwq->lock, flags);
433
+ if (num_wakeup)
434
+ wake_up_nr(&rcfw->cmdq.waitq, num_wakeup);
428435 }
429436
430437 static irqreturn_t bnxt_qplib_creq_irq(int irq, void *dev_instance)
....@@ -595,7 +602,7 @@
595602 rcfw->cmdq_depth = BNXT_QPLIB_CMDQE_MAX_CNT_8192;
596603
597604 sginfo.pgsize = bnxt_qplib_cmdqe_page_size(rcfw->cmdq_depth);
598
- hwq_attr.depth = rcfw->cmdq_depth;
605
+ hwq_attr.depth = rcfw->cmdq_depth & 0x7FFFFFFF;
599606 hwq_attr.stride = BNXT_QPLIB_CMDQE_UNITS;
600607 hwq_attr.type = HWQ_TYPE_CTX;
601608 if (bnxt_qplib_alloc_init_hwq(&cmdq->hwq, &hwq_attr)) {
....@@ -633,6 +640,10 @@
633640 struct bnxt_qplib_creq_ctx *creq;
634641
635642 creq = &rcfw->creq;
643
+
644
+ if (!creq->requested)
645
+ return;
646
+
636647 tasklet_disable(&creq->creq_tasklet);
637648 /* Mask h/w interrupts */
638649 bnxt_qplib_ring_nq_db(&creq->creq_db.dbinfo, rcfw->res->cctx, false);
....@@ -641,10 +652,10 @@
641652 if (kill)
642653 tasklet_kill(&creq->creq_tasklet);
643654
644
- if (creq->requested) {
645
- free_irq(creq->msix_vec, rcfw);
646
- creq->requested = false;
647
- }
655
+ free_irq(creq->msix_vec, rcfw);
656
+ kfree(creq->irq_name);
657
+ creq->irq_name = NULL;
658
+ creq->requested = false;
648659 }
649660
650661 void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
....@@ -676,9 +687,11 @@
676687 bool need_init)
677688 {
678689 struct bnxt_qplib_creq_ctx *creq;
690
+ struct bnxt_qplib_res *res;
679691 int rc;
680692
681693 creq = &rcfw->creq;
694
+ res = rcfw->res;
682695
683696 if (creq->requested)
684697 return -EFAULT;
....@@ -688,13 +701,22 @@
688701 tasklet_setup(&creq->creq_tasklet, bnxt_qplib_service_creq);
689702 else
690703 tasklet_enable(&creq->creq_tasklet);
704
+
705
+ creq->irq_name = kasprintf(GFP_KERNEL, "bnxt_re-creq@pci:%s",
706
+ pci_name(res->pdev));
707
+ if (!creq->irq_name)
708
+ return -ENOMEM;
691709 rc = request_irq(creq->msix_vec, bnxt_qplib_creq_irq, 0,
692
- "bnxt_qplib_creq", rcfw);
693
- if (rc)
710
+ creq->irq_name, rcfw);
711
+ if (rc) {
712
+ kfree(creq->irq_name);
713
+ creq->irq_name = NULL;
714
+ tasklet_disable(&creq->creq_tasklet);
694715 return rc;
716
+ }
695717 creq->requested = true;
696718
697
- bnxt_qplib_ring_nq_db(&creq->creq_db.dbinfo, rcfw->res->cctx, true);
719
+ bnxt_qplib_ring_nq_db(&creq->creq_db.dbinfo, res->cctx, true);
698720
699721 return 0;
700722 }