hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/infiniband/hw/qib/qib_sdma.c
....@@ -62,7 +62,7 @@
6262 static void sdma_put(struct qib_sdma_state *);
6363 static void sdma_set_state(struct qib_pportdata *, enum qib_sdma_states);
6464 static void sdma_start_sw_clean_up(struct qib_pportdata *);
65
-static void sdma_sw_clean_up_task(unsigned long);
65
+static void sdma_sw_clean_up_task(struct tasklet_struct *);
6666 static void unmap_desc(struct qib_pportdata *, unsigned);
6767
6868 static void sdma_get(struct qib_sdma_state *ss)
....@@ -119,9 +119,10 @@
119119 }
120120 }
121121
122
-static void sdma_sw_clean_up_task(unsigned long opaque)
122
+static void sdma_sw_clean_up_task(struct tasklet_struct *t)
123123 {
124
- struct qib_pportdata *ppd = (struct qib_pportdata *) opaque;
124
+ struct qib_pportdata *ppd = from_tasklet(ppd, t,
125
+ sdma_sw_clean_up_task);
125126 unsigned long flags;
126127
127128 spin_lock_irqsave(&ppd->sdma_lock, flags);
....@@ -436,8 +437,7 @@
436437
437438 INIT_LIST_HEAD(&ppd->sdma_activelist);
438439
439
- tasklet_init(&ppd->sdma_sw_clean_up_task, sdma_sw_clean_up_task,
440
- (unsigned long)ppd);
440
+ tasklet_setup(&ppd->sdma_sw_clean_up_task, sdma_sw_clean_up_task);
441441
442442 ret = dd->f_init_sdma_regs(ppd);
443443 if (ret)
....@@ -565,14 +565,8 @@
565565 sge = &ss->sge;
566566 while (dwords) {
567567 u32 dw;
568
- u32 len;
568
+ u32 len = rvt_get_sge_length(sge, dwords << 2);
569569
570
- len = dwords << 2;
571
- if (len > sge->length)
572
- len = sge->length;
573
- if (len > sge->sge_length)
574
- len = sge->sge_length;
575
- BUG_ON(len == 0);
576570 dw = (len + 3) >> 2;
577571 addr = dma_map_single(&ppd->dd->pcidev->dev, sge->vaddr,
578572 dw << 2, DMA_TO_DEVICE);
....@@ -595,24 +589,7 @@
595589 descqp = &ppd->sdma_descq[0].qw[0];
596590 ++ppd->sdma_generation;
597591 }
598
- sge->vaddr += len;
599
- sge->length -= len;
600
- sge->sge_length -= len;
601
- if (sge->sge_length == 0) {
602
- if (--ss->num_sge)
603
- *sge = *ss->sg_list++;
604
- } else if (sge->length == 0 && sge->mr->lkey) {
605
- if (++sge->n >= RVT_SEGSZ) {
606
- if (++sge->m >= sge->mr->mapsz)
607
- break;
608
- sge->n = 0;
609
- }
610
- sge->vaddr =
611
- sge->mr->map[sge->m]->segs[sge->n].vaddr;
612
- sge->length =
613
- sge->mr->map[sge->m]->segs[sge->n].length;
614
- }
615
-
592
+ rvt_update_sge(ss, len, false);
616593 dwoffset += dw;
617594 dwords -= dw;
618595 }
....@@ -653,7 +630,7 @@
653630 if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK)
654631 rvt_error_qp(qp, IB_WC_GENERAL_ERR);
655632 } else if (qp->s_wqe)
656
- qib_send_complete(qp, qp->s_wqe, IB_WC_GENERAL_ERR);
633
+ rvt_send_complete(qp, qp->s_wqe, IB_WC_GENERAL_ERR);
657634 spin_unlock(&qp->s_lock);
658635 spin_unlock(&qp->r_lock);
659636 /* return zero to process the next send work request */
....@@ -786,7 +763,7 @@
786763 * bringing the link up with traffic active on
787764 * 7220, e.g. */
788765 ss->go_s99_running = 1;
789
- /* fall through -- and start dma engine */
766
+ fallthrough; /* and start dma engine */
790767 case qib_sdma_event_e10_go_hw_start:
791768 /* This reference means the state machine is started */
792769 sdma_get(&ppd->sdma_state);