Commit a1be161a authored by Allen Pais's avatar Allen Pais Committed by David S. Miller

net: mlx: convert tasklets to use new tasklet_setup() API

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: default avatarRomain Perier <romain.perier@gmail.com>
Signed-off-by: default avatarAllen Pais <apais@linux.microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd002b54
...@@ -55,11 +55,11 @@ ...@@ -55,11 +55,11 @@
#define TASKLET_MAX_TIME 2 #define TASKLET_MAX_TIME 2
#define TASKLET_MAX_TIME_JIFFIES msecs_to_jiffies(TASKLET_MAX_TIME) #define TASKLET_MAX_TIME_JIFFIES msecs_to_jiffies(TASKLET_MAX_TIME)
void mlx4_cq_tasklet_cb(unsigned long data) void mlx4_cq_tasklet_cb(struct tasklet_struct *t)
{ {
unsigned long flags; unsigned long flags;
unsigned long end = jiffies + TASKLET_MAX_TIME_JIFFIES; unsigned long end = jiffies + TASKLET_MAX_TIME_JIFFIES;
struct mlx4_eq_tasklet *ctx = (struct mlx4_eq_tasklet *)data; struct mlx4_eq_tasklet *ctx = from_tasklet(ctx, t, task);
struct mlx4_cq *mcq, *temp; struct mlx4_cq *mcq, *temp;
spin_lock_irqsave(&ctx->lock, flags); spin_lock_irqsave(&ctx->lock, flags);
......
...@@ -1057,8 +1057,7 @@ static int mlx4_create_eq(struct mlx4_dev *dev, int nent, ...@@ -1057,8 +1057,7 @@ static int mlx4_create_eq(struct mlx4_dev *dev, int nent,
INIT_LIST_HEAD(&eq->tasklet_ctx.list); INIT_LIST_HEAD(&eq->tasklet_ctx.list);
INIT_LIST_HEAD(&eq->tasklet_ctx.process_list); INIT_LIST_HEAD(&eq->tasklet_ctx.process_list);
spin_lock_init(&eq->tasklet_ctx.lock); spin_lock_init(&eq->tasklet_ctx.lock);
tasklet_init(&eq->tasklet_ctx.task, mlx4_cq_tasklet_cb, tasklet_setup(&eq->tasklet_ctx.task, mlx4_cq_tasklet_cb);
(unsigned long)&eq->tasklet_ctx);
return err; return err;
......
...@@ -1217,7 +1217,7 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev); ...@@ -1217,7 +1217,7 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev);
int mlx4_comm_cmd(struct mlx4_dev *dev, u8 cmd, u16 param, int mlx4_comm_cmd(struct mlx4_dev *dev, u8 cmd, u16 param,
u16 op, unsigned long timeout); u16 op, unsigned long timeout);
void mlx4_cq_tasklet_cb(unsigned long data); void mlx4_cq_tasklet_cb(struct tasklet_struct *t);
void mlx4_cq_completion(struct mlx4_dev *dev, u32 cqn); void mlx4_cq_completion(struct mlx4_dev *dev, u32 cqn);
void mlx4_cq_event(struct mlx4_dev *dev, u32 cqn, int event_type); void mlx4_cq_event(struct mlx4_dev *dev, u32 cqn, int event_type);
......
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
#define TASKLET_MAX_TIME 2 #define TASKLET_MAX_TIME 2
#define TASKLET_MAX_TIME_JIFFIES msecs_to_jiffies(TASKLET_MAX_TIME) #define TASKLET_MAX_TIME_JIFFIES msecs_to_jiffies(TASKLET_MAX_TIME)
void mlx5_cq_tasklet_cb(unsigned long data) void mlx5_cq_tasklet_cb(struct tasklet_struct *t)
{ {
unsigned long flags; unsigned long flags;
unsigned long end = jiffies + TASKLET_MAX_TIME_JIFFIES; unsigned long end = jiffies + TASKLET_MAX_TIME_JIFFIES;
struct mlx5_eq_tasklet *ctx = (struct mlx5_eq_tasklet *)data; struct mlx5_eq_tasklet *ctx = from_tasklet(ctx, t, task);
struct mlx5_core_cq *mcq; struct mlx5_core_cq *mcq;
struct mlx5_core_cq *temp; struct mlx5_core_cq *temp;
......
...@@ -788,8 +788,7 @@ static int create_comp_eqs(struct mlx5_core_dev *dev) ...@@ -788,8 +788,7 @@ static int create_comp_eqs(struct mlx5_core_dev *dev)
INIT_LIST_HEAD(&eq->tasklet_ctx.list); INIT_LIST_HEAD(&eq->tasklet_ctx.list);
INIT_LIST_HEAD(&eq->tasklet_ctx.process_list); INIT_LIST_HEAD(&eq->tasklet_ctx.process_list);
spin_lock_init(&eq->tasklet_ctx.lock); spin_lock_init(&eq->tasklet_ctx.lock);
tasklet_init(&eq->tasklet_ctx.task, mlx5_cq_tasklet_cb, tasklet_setup(&eq->tasklet_ctx.task, mlx5_cq_tasklet_cb);
(unsigned long)&eq->tasklet_ctx);
eq->irq_nb.notifier_call = mlx5_eq_comp_int; eq->irq_nb.notifier_call = mlx5_eq_comp_int;
param = (struct mlx5_eq_param) { param = (struct mlx5_eq_param) {
......
...@@ -388,9 +388,9 @@ static inline void mlx5_fpga_conn_cqes(struct mlx5_fpga_conn *conn, ...@@ -388,9 +388,9 @@ static inline void mlx5_fpga_conn_cqes(struct mlx5_fpga_conn *conn,
mlx5_fpga_conn_arm_cq(conn); mlx5_fpga_conn_arm_cq(conn);
} }
static void mlx5_fpga_conn_cq_tasklet(unsigned long data) static void mlx5_fpga_conn_cq_tasklet(struct tasklet_struct *t)
{ {
struct mlx5_fpga_conn *conn = (void *)data; struct mlx5_fpga_conn *conn = from_tasklet(conn, t, cq.tasklet);
if (unlikely(!conn->qp.active)) if (unlikely(!conn->qp.active))
return; return;
...@@ -478,8 +478,7 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size) ...@@ -478,8 +478,7 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size)
conn->cq.mcq.comp = mlx5_fpga_conn_cq_complete; conn->cq.mcq.comp = mlx5_fpga_conn_cq_complete;
conn->cq.mcq.irqn = irqn; conn->cq.mcq.irqn = irqn;
conn->cq.mcq.uar = fdev->conn_res.uar; conn->cq.mcq.uar = fdev->conn_res.uar;
tasklet_init(&conn->cq.tasklet, mlx5_fpga_conn_cq_tasklet, tasklet_setup(&conn->cq.tasklet, mlx5_fpga_conn_cq_tasklet);
(unsigned long)conn);
mlx5_fpga_dbg(fdev, "Created CQ #0x%x\n", conn->cq.mcq.cqn); mlx5_fpga_dbg(fdev, "Created CQ #0x%x\n", conn->cq.mcq.cqn);
......
...@@ -77,7 +77,7 @@ int mlx5_eq_add_cq(struct mlx5_eq *eq, struct mlx5_core_cq *cq); ...@@ -77,7 +77,7 @@ int mlx5_eq_add_cq(struct mlx5_eq *eq, struct mlx5_core_cq *cq);
void mlx5_eq_del_cq(struct mlx5_eq *eq, struct mlx5_core_cq *cq); void mlx5_eq_del_cq(struct mlx5_eq *eq, struct mlx5_core_cq *cq);
struct mlx5_eq_comp *mlx5_eqn2comp_eq(struct mlx5_core_dev *dev, int eqn); struct mlx5_eq_comp *mlx5_eqn2comp_eq(struct mlx5_core_dev *dev, int eqn);
struct mlx5_eq *mlx5_get_async_eq(struct mlx5_core_dev *dev); struct mlx5_eq *mlx5_get_async_eq(struct mlx5_core_dev *dev);
void mlx5_cq_tasklet_cb(unsigned long data); void mlx5_cq_tasklet_cb(struct tasklet_struct *t);
struct cpumask *mlx5_eq_comp_cpumask(struct mlx5_core_dev *dev, int ix); struct cpumask *mlx5_eq_comp_cpumask(struct mlx5_core_dev *dev, int ix);
u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq_comp *eq); u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq_comp *eq);
......
...@@ -620,9 +620,9 @@ static char *mlxsw_pci_cq_sw_cqe_get(struct mlxsw_pci_queue *q) ...@@ -620,9 +620,9 @@ static char *mlxsw_pci_cq_sw_cqe_get(struct mlxsw_pci_queue *q)
return elem; return elem;
} }
static void mlxsw_pci_cq_tasklet(unsigned long data) static void mlxsw_pci_cq_tasklet(struct tasklet_struct *t)
{ {
struct mlxsw_pci_queue *q = (struct mlxsw_pci_queue *) data; struct mlxsw_pci_queue *q = from_tasklet(q, t, tasklet);
struct mlxsw_pci *mlxsw_pci = q->pci; struct mlxsw_pci *mlxsw_pci = q->pci;
char *cqe; char *cqe;
int items = 0; int items = 0;
...@@ -733,9 +733,9 @@ static char *mlxsw_pci_eq_sw_eqe_get(struct mlxsw_pci_queue *q) ...@@ -733,9 +733,9 @@ static char *mlxsw_pci_eq_sw_eqe_get(struct mlxsw_pci_queue *q)
return elem; return elem;
} }
static void mlxsw_pci_eq_tasklet(unsigned long data) static void mlxsw_pci_eq_tasklet(struct tasklet_struct *t)
{ {
struct mlxsw_pci_queue *q = (struct mlxsw_pci_queue *) data; struct mlxsw_pci_queue *q = from_tasklet(q, t, tasklet);
struct mlxsw_pci *mlxsw_pci = q->pci; struct mlxsw_pci *mlxsw_pci = q->pci;
u8 cq_count = mlxsw_pci_cq_count(mlxsw_pci); u8 cq_count = mlxsw_pci_cq_count(mlxsw_pci);
unsigned long active_cqns[BITS_TO_LONGS(MLXSW_PCI_CQS_MAX)]; unsigned long active_cqns[BITS_TO_LONGS(MLXSW_PCI_CQS_MAX)];
...@@ -792,7 +792,7 @@ struct mlxsw_pci_queue_ops { ...@@ -792,7 +792,7 @@ struct mlxsw_pci_queue_ops {
struct mlxsw_pci_queue *q); struct mlxsw_pci_queue *q);
void (*fini)(struct mlxsw_pci *mlxsw_pci, void (*fini)(struct mlxsw_pci *mlxsw_pci,
struct mlxsw_pci_queue *q); struct mlxsw_pci_queue *q);
void (*tasklet)(unsigned long data); void (*tasklet)(struct tasklet_struct *t);
u16 (*elem_count_f)(const struct mlxsw_pci_queue *q); u16 (*elem_count_f)(const struct mlxsw_pci_queue *q);
u8 (*elem_size_f)(const struct mlxsw_pci_queue *q); u8 (*elem_size_f)(const struct mlxsw_pci_queue *q);
u16 elem_count; u16 elem_count;
...@@ -855,7 +855,7 @@ static int mlxsw_pci_queue_init(struct mlxsw_pci *mlxsw_pci, char *mbox, ...@@ -855,7 +855,7 @@ static int mlxsw_pci_queue_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
q->pci = mlxsw_pci; q->pci = mlxsw_pci;
if (q_ops->tasklet) if (q_ops->tasklet)
tasklet_init(&q->tasklet, q_ops->tasklet, (unsigned long) q); tasklet_setup(&q->tasklet, q_ops->tasklet);
mem_item->size = MLXSW_PCI_AQ_SIZE; mem_item->size = MLXSW_PCI_AQ_SIZE;
mem_item->buf = pci_alloc_consistent(mlxsw_pci->pdev, mem_item->buf = pci_alloc_consistent(mlxsw_pci->pdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment