diff mbox series

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

Message ID 20201103091823.586717-8-allen.lkml@gmail.com
State Superseded
Headers show
Series [net-next,v4,1/8] net: dccp: convert tasklets to use new tasklet_setup() API | expand

Commit Message

Allen Pais 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/smc/smc_cdc.c |  6 +++---
 net/smc/smc_wr.c  | 14 ++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

Comments

Jakub Kicinski Nov. 6, 2020, 12:49 a.m. UTC | #1
On Tue,  3 Nov 2020 14:48:22 +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>


Ursula, Karsten - ack/nack for applying this to net-next?

> diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c

> index b1ce6ccbfaec..f23f558054a7 100644

> --- a/net/smc/smc_cdc.c

> +++ b/net/smc/smc_cdc.c

> @@ -389,9 +389,9 @@ static void smc_cdc_msg_recv(struct smc_sock *smc, struct smc_cdc_msg *cdc)

>   * Context:

>   * - tasklet context

>   */

> -static void smcd_cdc_rx_tsklet(unsigned long data)

> +static void smcd_cdc_rx_tsklet(struct tasklet_struct *t)

>  {

> -	struct smc_connection *conn = (struct smc_connection *)data;

> +	struct smc_connection *conn = from_tasklet(conn, t, rx_tsklet);

>  	struct smcd_cdc_msg *data_cdc;

>  	struct smcd_cdc_msg cdc;

>  	struct smc_sock *smc;

> @@ -411,7 +411,7 @@ static void smcd_cdc_rx_tsklet(unsigned long data)

>   */

>  void smcd_cdc_rx_init(struct smc_connection *conn)

>  {

> -	tasklet_init(&conn->rx_tsklet, smcd_cdc_rx_tsklet, (unsigned long)conn);

> +	tasklet_setup(&conn->rx_tsklet, smcd_cdc_rx_tsklet);

>  }

>  

>  /***************************** init, exit, misc ******************************/

> diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c

> index 1e23cdd41eb1..cbc73a7e4d59 100644

> --- a/net/smc/smc_wr.c

> +++ b/net/smc/smc_wr.c

> @@ -131,9 +131,9 @@ static inline void smc_wr_tx_process_cqe(struct ib_wc *wc)

>  	wake_up(&link->wr_tx_wait);

>  }

>  

> -static void smc_wr_tx_tasklet_fn(unsigned long data)

> +static void smc_wr_tx_tasklet_fn(struct tasklet_struct *t)

>  {

> -	struct smc_ib_device *dev = (struct smc_ib_device *)data;

> +	struct smc_ib_device *dev = from_tasklet(dev, t, send_tasklet);

>  	struct ib_wc wc[SMC_WR_MAX_POLL_CQE];

>  	int i = 0, rc;

>  	int polled = 0;

> @@ -435,9 +435,9 @@ static inline void smc_wr_rx_process_cqes(struct ib_wc wc[], int num)

>  	}

>  }

>  

> -static void smc_wr_rx_tasklet_fn(unsigned long data)

> +static void smc_wr_rx_tasklet_fn(struct tasklet_struct *t)

>  {

> -	struct smc_ib_device *dev = (struct smc_ib_device *)data;

> +	struct smc_ib_device *dev = from_tasklet(dev, t, recv_tasklet);

>  	struct ib_wc wc[SMC_WR_MAX_POLL_CQE];

>  	int polled = 0;

>  	int rc;

> @@ -698,10 +698,8 @@ void smc_wr_remove_dev(struct smc_ib_device *smcibdev)

>  

>  void smc_wr_add_dev(struct smc_ib_device *smcibdev)

>  {

> -	tasklet_init(&smcibdev->recv_tasklet, smc_wr_rx_tasklet_fn,

> -		     (unsigned long)smcibdev);

> -	tasklet_init(&smcibdev->send_tasklet, smc_wr_tx_tasklet_fn,

> -		     (unsigned long)smcibdev);

> +	tasklet_setup(&smcibdev->recv_tasklet, smc_wr_rx_tasklet_fn);

> +	tasklet_setup(&smcibdev->send_tasklet, smc_wr_tx_tasklet_fn);

>  }

>  

>  int smc_wr_create_link(struct smc_link *lnk)
Karsten Graul Nov. 6, 2020, 6:32 a.m. UTC | #2
On 03/11/2020 10:18, 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>
> ---

Acked-by: Karsten Graul <kgraul@linux.ibm.com>
diff mbox series

Patch

diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index b1ce6ccbfaec..f23f558054a7 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -389,9 +389,9 @@  static void smc_cdc_msg_recv(struct smc_sock *smc, struct smc_cdc_msg *cdc)
  * Context:
  * - tasklet context
  */
-static void smcd_cdc_rx_tsklet(unsigned long data)
+static void smcd_cdc_rx_tsklet(struct tasklet_struct *t)
 {
-	struct smc_connection *conn = (struct smc_connection *)data;
+	struct smc_connection *conn = from_tasklet(conn, t, rx_tsklet);
 	struct smcd_cdc_msg *data_cdc;
 	struct smcd_cdc_msg cdc;
 	struct smc_sock *smc;
@@ -411,7 +411,7 @@  static void smcd_cdc_rx_tsklet(unsigned long data)
  */
 void smcd_cdc_rx_init(struct smc_connection *conn)
 {
-	tasklet_init(&conn->rx_tsklet, smcd_cdc_rx_tsklet, (unsigned long)conn);
+	tasklet_setup(&conn->rx_tsklet, smcd_cdc_rx_tsklet);
 }
 
 /***************************** init, exit, misc ******************************/
diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
index 1e23cdd41eb1..cbc73a7e4d59 100644
--- a/net/smc/smc_wr.c
+++ b/net/smc/smc_wr.c
@@ -131,9 +131,9 @@  static inline void smc_wr_tx_process_cqe(struct ib_wc *wc)
 	wake_up(&link->wr_tx_wait);
 }
 
-static void smc_wr_tx_tasklet_fn(unsigned long data)
+static void smc_wr_tx_tasklet_fn(struct tasklet_struct *t)
 {
-	struct smc_ib_device *dev = (struct smc_ib_device *)data;
+	struct smc_ib_device *dev = from_tasklet(dev, t, send_tasklet);
 	struct ib_wc wc[SMC_WR_MAX_POLL_CQE];
 	int i = 0, rc;
 	int polled = 0;
@@ -435,9 +435,9 @@  static inline void smc_wr_rx_process_cqes(struct ib_wc wc[], int num)
 	}
 }
 
-static void smc_wr_rx_tasklet_fn(unsigned long data)
+static void smc_wr_rx_tasklet_fn(struct tasklet_struct *t)
 {
-	struct smc_ib_device *dev = (struct smc_ib_device *)data;
+	struct smc_ib_device *dev = from_tasklet(dev, t, recv_tasklet);
 	struct ib_wc wc[SMC_WR_MAX_POLL_CQE];
 	int polled = 0;
 	int rc;
@@ -698,10 +698,8 @@  void smc_wr_remove_dev(struct smc_ib_device *smcibdev)
 
 void smc_wr_add_dev(struct smc_ib_device *smcibdev)
 {
-	tasklet_init(&smcibdev->recv_tasklet, smc_wr_rx_tasklet_fn,
-		     (unsigned long)smcibdev);
-	tasklet_init(&smcibdev->send_tasklet, smc_wr_tx_tasklet_fn,
-		     (unsigned long)smcibdev);
+	tasklet_setup(&smcibdev->recv_tasklet, smc_wr_rx_tasklet_fn);
+	tasklet_setup(&smcibdev->send_tasklet, smc_wr_tx_tasklet_fn);
 }
 
 int smc_wr_create_link(struct smc_link *lnk)