diff mbox series

[net-next,v4,5/8] net: rds: convert tasklets to use new tasklet_setup() API

Message ID 20201103091823.586717-6-allen.lkml@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series net: convert tasklets to use new tasklet_setup API | expand

Commit Message

Allen Nov. 3, 2020, 9:18 a.m. UTC
From: Allen Pais <apais@linux.microsoft.com>

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>
---
 net/rds/ib_cm.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Comments

Jakub Kicinski Nov. 6, 2020, 12:47 a.m. UTC | #1
On Tue,  3 Nov 2020 14:48:20 +0530 Allen Pais wrote:
> From: Allen Pais <apais@linux.microsoft.com>
> 
> 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>

Santosh, ack/nack for this going into net-next?

> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
> index b36b60668b1d..d06398be4b80 100644
> --- a/net/rds/ib_cm.c
> +++ b/net/rds/ib_cm.c
> @@ -314,9 +314,9 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
>  	}
>  }
>  
> -static void rds_ib_tasklet_fn_send(unsigned long data)
> +static void rds_ib_tasklet_fn_send(struct tasklet_struct *t)
>  {
> -	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
> +	struct rds_ib_connection *ic = from_tasklet(ic, t, i_send_tasklet);
>  	struct rds_connection *conn = ic->conn;
>  
>  	rds_ib_stats_inc(s_ib_tasklet_call);
> @@ -354,9 +354,9 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
>  	}
>  }
>  
> -static void rds_ib_tasklet_fn_recv(unsigned long data)
> +static void rds_ib_tasklet_fn_recv(struct tasklet_struct *t)
>  {
> -	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
> +	struct rds_ib_connection *ic = from_tasklet(ic, t, i_recv_tasklet);
>  	struct rds_connection *conn = ic->conn;
>  	struct rds_ib_device *rds_ibdev = ic->rds_ibdev;
>  	struct rds_ib_ack_state state;
> @@ -1219,10 +1219,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
>  	}
>  
>  	INIT_LIST_HEAD(&ic->ib_node);
> -	tasklet_init(&ic->i_send_tasklet, rds_ib_tasklet_fn_send,
> -		     (unsigned long)ic);
> -	tasklet_init(&ic->i_recv_tasklet, rds_ib_tasklet_fn_recv,
> -		     (unsigned long)ic);
> +	tasklet_setup(&ic->i_send_tasklet, rds_ib_tasklet_fn_send);
> +	tasklet_setup(&ic->i_recv_tasklet, rds_ib_tasklet_fn_recv);
>  	mutex_init(&ic->i_recv_mutex);
>  #ifndef KERNEL_HAS_ATOMIC64
>  	spin_lock_init(&ic->i_ack_lock);
diff mbox series

Patch

diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index b36b60668b1d..d06398be4b80 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -314,9 +314,9 @@  static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
 	}
 }
 
-static void rds_ib_tasklet_fn_send(unsigned long data)
+static void rds_ib_tasklet_fn_send(struct tasklet_struct *t)
 {
-	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
+	struct rds_ib_connection *ic = from_tasklet(ic, t, i_send_tasklet);
 	struct rds_connection *conn = ic->conn;
 
 	rds_ib_stats_inc(s_ib_tasklet_call);
@@ -354,9 +354,9 @@  static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
 	}
 }
 
-static void rds_ib_tasklet_fn_recv(unsigned long data)
+static void rds_ib_tasklet_fn_recv(struct tasklet_struct *t)
 {
-	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
+	struct rds_ib_connection *ic = from_tasklet(ic, t, i_recv_tasklet);
 	struct rds_connection *conn = ic->conn;
 	struct rds_ib_device *rds_ibdev = ic->rds_ibdev;
 	struct rds_ib_ack_state state;
@@ -1219,10 +1219,8 @@  int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
 	}
 
 	INIT_LIST_HEAD(&ic->ib_node);
-	tasklet_init(&ic->i_send_tasklet, rds_ib_tasklet_fn_send,
-		     (unsigned long)ic);
-	tasklet_init(&ic->i_recv_tasklet, rds_ib_tasklet_fn_recv,
-		     (unsigned long)ic);
+	tasklet_setup(&ic->i_send_tasklet, rds_ib_tasklet_fn_send);
+	tasklet_setup(&ic->i_recv_tasklet, rds_ib_tasklet_fn_recv);
 	mutex_init(&ic->i_recv_mutex);
 #ifndef KERNEL_HAS_ATOMIC64
 	spin_lock_init(&ic->i_ack_lock);