]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
chelsio: convert tasklets to use new tasklet_setup() API
authorAllen Pais <apais@linux.microsoft.com>
Mon, 14 Sep 2020 07:29:25 +0000 (12:59 +0530)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Sep 2020 20:02:37 +0000 (13:02 -0700)
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb/sge.c
drivers/net/ethernet/chelsio/cxgb3/sge.c
drivers/net/ethernet/chelsio/cxgb4/sge.c

index 21016de20b2d8f39179f1ab7badd346c9b96a6a8..2d9c2b5a690a3badb6e0f3c6f7336d9f8edc3ebc 100644 (file)
@@ -239,8 +239,10 @@ struct sched {
        unsigned int    num;            /* num skbs in per port queues */
        struct sched_port p[MAX_NPORTS];
        struct tasklet_struct sched_tsk;/* tasklet used to run scheduler */
+       struct sge *sge;
 };
-static void restart_sched(unsigned long);
+
+static void restart_sched(struct tasklet_struct *t);
 
 
 /*
@@ -378,7 +380,8 @@ static int tx_sched_init(struct sge *sge)
                return -ENOMEM;
 
        pr_debug("tx_sched_init\n");
-       tasklet_init(&s->sched_tsk, restart_sched, (unsigned long) sge);
+       tasklet_setup(&s->sched_tsk, restart_sched);
+       s->sge = sge;
        sge->tx_sched = s;
 
        for (i = 0; i < MAX_NPORTS; i++) {
@@ -1305,9 +1308,10 @@ static inline void reclaim_completed_tx(struct sge *sge, struct cmdQ *q)
  * Called from tasklet. Checks the scheduler for any
  * pending skbs that can be sent.
  */
-static void restart_sched(unsigned long arg)
+static void restart_sched(struct tasklet_struct *t)
 {
-       struct sge *sge = (struct sge *) arg;
+       struct sched *s = from_tasklet(s, t, sched_tsk);
+       struct sge *sge = s->sge;
        struct adapter *adapter = sge->adapter;
        struct cmdQ *q = &sge->cmdQ[0];
        struct sk_buff *skb;
index ee6188dea7056109a0c1cf11227fe2a4e6228a18..a978a00acc1e389aa480cde1697874cb6266c1d0 100644 (file)
@@ -1516,14 +1516,14 @@ static int ctrl_xmit(struct adapter *adap, struct sge_txq *q,
 
 /**
  *     restart_ctrlq - restart a suspended control queue
- *     @qs: the queue set cotaining the control queue
+ *     @t: pointer to the tasklet associated with this handler
  *
  *     Resumes transmission on a suspended Tx control queue.
  */
-static void restart_ctrlq(unsigned long data)
+static void restart_ctrlq(struct tasklet_struct *t)
 {
        struct sk_buff *skb;
-       struct sge_qset *qs = (struct sge_qset *)data;
+       struct sge_qset *qs = from_tasklet(qs, t, txq[TXQ_CTRL].qresume_tsk);
        struct sge_txq *q = &qs->txq[TXQ_CTRL];
 
        spin_lock(&q->lock);
@@ -1733,14 +1733,14 @@ again:  reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);
 
 /**
  *     restart_offloadq - restart a suspended offload queue
- *     @qs: the queue set cotaining the offload queue
+ *     @t: pointer to the tasklet associated with this handler
  *
  *     Resumes transmission on a suspended Tx offload queue.
  */
-static void restart_offloadq(unsigned long data)
+static void restart_offloadq(struct tasklet_struct *t)
 {
        struct sk_buff *skb;
-       struct sge_qset *qs = (struct sge_qset *)data;
+       struct sge_qset *qs = from_tasklet(qs, t, txq[TXQ_OFLD].qresume_tsk);
        struct sge_txq *q = &qs->txq[TXQ_OFLD];
        const struct port_info *pi = netdev_priv(qs->netdev);
        struct adapter *adap = pi->adapter;
@@ -3081,10 +3081,8 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
                skb_queue_head_init(&q->txq[i].sendq);
        }
 
-       tasklet_init(&q->txq[TXQ_OFLD].qresume_tsk, restart_offloadq,
-                    (unsigned long)q);
-       tasklet_init(&q->txq[TXQ_CTRL].qresume_tsk, restart_ctrlq,
-                    (unsigned long)q);
+       tasklet_setup(&q->txq[TXQ_OFLD].qresume_tsk, restart_offloadq);
+       tasklet_setup(&q->txq[TXQ_CTRL].qresume_tsk, restart_ctrlq);
 
        q->fl[0].gen = q->fl[1].gen = 1;
        q->fl[0].size = p->fl_size;
index 437c054ef74976115b5f289bd37f9cba1f49f90d..2b942b4825d4000f7d890e05e22afa407de61917 100644 (file)
@@ -2660,15 +2660,15 @@ static int ctrl_xmit(struct sge_ctrl_txq *q, struct sk_buff *skb)
 
 /**
  *     restart_ctrlq - restart a suspended control queue
- *     @data: the control queue to restart
+ *     @t: pointer to the tasklet associated with this handler
  *
  *     Resumes transmission on a suspended Tx control queue.
  */
-static void restart_ctrlq(unsigned long data)
+static void restart_ctrlq(struct tasklet_struct *t)
 {
        struct sk_buff *skb;
        unsigned int written = 0;
-       struct sge_ctrl_txq *q = (struct sge_ctrl_txq *)data;
+       struct sge_ctrl_txq *q = from_tasklet(q, t, qresume_tsk);
 
        spin_lock(&q->sendq.lock);
        reclaim_completed_tx_imm(&q->q);
@@ -2961,13 +2961,13 @@ static int ofld_xmit(struct sge_uld_txq *q, struct sk_buff *skb)
 
 /**
  *     restart_ofldq - restart a suspended offload queue
- *     @data: the offload queue to restart
+ *     @t: pointer to the tasklet associated with this handler
  *
  *     Resumes transmission on a suspended Tx offload queue.
  */
-static void restart_ofldq(unsigned long data)
+static void restart_ofldq(struct tasklet_struct *t)
 {
-       struct sge_uld_txq *q = (struct sge_uld_txq *)data;
+       struct sge_uld_txq *q = from_tasklet(q, t, qresume_tsk);
 
        spin_lock(&q->sendq.lock);
        q->full = 0;            /* the queue actually is completely empty now */
@@ -4580,7 +4580,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
        init_txq(adap, &txq->q, FW_EQ_CTRL_CMD_EQID_G(ntohl(c.cmpliqid_eqid)));
        txq->adap = adap;
        skb_queue_head_init(&txq->sendq);
-       tasklet_init(&txq->qresume_tsk, restart_ctrlq, (unsigned long)txq);
+       tasklet_setup(&txq->qresume_tsk, restart_ctrlq);
        txq->full = 0;
        return 0;
 }
@@ -4670,7 +4670,7 @@ int t4_sge_alloc_uld_txq(struct adapter *adap, struct sge_uld_txq *txq,
        txq->q.q_type = CXGB4_TXQ_ULD;
        txq->adap = adap;
        skb_queue_head_init(&txq->sendq);
-       tasklet_init(&txq->qresume_tsk, restart_ofldq, (unsigned long)txq);
+       tasklet_setup(&txq->qresume_tsk, restart_ofldq);
        txq->full = 0;
        txq->mapping_err = 0;
        return 0;