[PRE-REVIEW PATCH 05/16] chelsio: Prepare to use the new tasklet API

Romain Perier
2019-09-29T16:31:53Z

The future tasklet API will no longer allow to pass an arbitrary
"unsigned long" data parameter. The tasklet data structure will need to
be embedded into a data structure that will be retrieved from the tasklet
handler. Currently, there are no ways to get the sge data structure from
a given "struct sched *". This commits adds a field to store the pointer
of "the parent sge" into the context of each sched, so future tasklet
handlers will retrieve the "struct sched *" of the corresponding tasklet
and its "struct sge *".

Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
drivers/net/ethernet/chelsio/cxgb/sge.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c
index 47b5c8e2104b..b6c656e15801 100644
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
@@ -239,6 +239,7 @@ 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);

@@ -379,6 +380,7 @@ static int tx_sched_init(struct sge *sge)

pr_debug("tx_sched_init\n");
tasklet_init(&s->sched_tsk, restart_sched, (unsigned long) sge);
+ s->sge = sge;
sge->tx_sched = s;

for (i = 0; i < MAX_NPORTS; i++) {
--
2.23.0