diff mbox series

[net-next,2/8] can: Use netif_rx().

Message ID 20220305221252.3063812-3-bigeasy@linutronix.de (mailing list archive)
State Accepted
Commit 00f4a0afb7eafdf3dae764ec0c40fe6abfdf8254
Delegated to: Netdev Maintainers
Headers show
Series net: Convert user to netif_rx(), part 2. | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers warning 4 maintainers not CCed: mailhol.vincent@wanadoo.fr linux@rempel-privat.de andriy.shevchenko@linux.intel.com frieder.schrempf@kontron.de
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 80 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Sebastian Andrzej Siewior March 5, 2022, 10:12 p.m. UTC
Since commit
   baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.")

the function netif_rx() can be used in preemptible/thread context as
well as in interrupt context.

Use netif_rx().

Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-can@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/net/can/dev/dev.c     | 2 +-
 drivers/net/can/slcan.c       | 2 +-
 drivers/net/can/spi/hi311x.c  | 6 +++---
 drivers/net/can/spi/mcp251x.c | 4 ++--
 drivers/net/can/vcan.c        | 2 +-
 drivers/net/can/vxcan.c       | 2 +-
 net/can/af_can.c              | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

Comments

Oliver Hartkopp March 6, 2022, 9:47 a.m. UTC | #1
On 05.03.22 23:12, Sebastian Andrzej Siewior wrote:
> Since commit
>     baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.")
> 
> the function netif_rx() can be used in preemptible/thread context as
> well as in interrupt context.
> 
> Use netif_rx().
> 
> Cc: Marc Kleine-Budde <mkl@pengutronix.de>
> Cc: Oliver Hartkopp <socketcan@hartkopp.net>

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Thanks for the effort Sebastian!

So git blame would not find me anymore for introducing netif_rx_ni() in 
commit 481a8199142c0 from 2009 ;-)

Best regards,
Oliver

> Cc: Wolfgang Grandegger <wg@grandegger.com>
> Cc: linux-can@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>   drivers/net/can/dev/dev.c     | 2 +-
>   drivers/net/can/slcan.c       | 2 +-
>   drivers/net/can/spi/hi311x.c  | 6 +++---
>   drivers/net/can/spi/mcp251x.c | 4 ++--
>   drivers/net/can/vcan.c        | 2 +-
>   drivers/net/can/vxcan.c       | 2 +-
>   net/can/af_can.c              | 2 +-
>   7 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c
> index c192f25f96956..e7ab45f1c43b2 100644
> --- a/drivers/net/can/dev/dev.c
> +++ b/drivers/net/can/dev/dev.c
> @@ -154,7 +154,7 @@ static void can_restart(struct net_device *dev)
>   
>   	cf->can_id |= CAN_ERR_RESTARTED;
>   
> -	netif_rx_ni(skb);
> +	netif_rx(skb);
>   
>   restart:
>   	netdev_dbg(dev, "restarted\n");
> diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
> index 27783fbf011fc..ec294d0c5722c 100644
> --- a/drivers/net/can/slcan.c
> +++ b/drivers/net/can/slcan.c
> @@ -221,7 +221,7 @@ static void slc_bump(struct slcan *sl)
>   	if (!(cf.can_id & CAN_RTR_FLAG))
>   		sl->dev->stats.rx_bytes += cf.len;
>   
> -	netif_rx_ni(skb);
> +	netif_rx(skb);
>   }
>   
>   /* parse tty input stream */
> diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
> index 664b8f14d7b05..a5b2952b8d0ff 100644
> --- a/drivers/net/can/spi/hi311x.c
> +++ b/drivers/net/can/spi/hi311x.c
> @@ -356,7 +356,7 @@ static void hi3110_hw_rx(struct spi_device *spi)
>   
>   	can_led_event(priv->net, CAN_LED_EVENT_RX);
>   
> -	netif_rx_ni(skb);
> +	netif_rx(skb);
>   }
>   
>   static void hi3110_hw_sleep(struct spi_device *spi)
> @@ -677,7 +677,7 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
>   			tx_state = txerr >= rxerr ? new_state : 0;
>   			rx_state = txerr <= rxerr ? new_state : 0;
>   			can_change_state(net, cf, tx_state, rx_state);
> -			netif_rx_ni(skb);
> +			netif_rx(skb);
>   
>   			if (new_state == CAN_STATE_BUS_OFF) {
>   				can_bus_off(net);
> @@ -718,7 +718,7 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
>   				cf->data[6] = hi3110_read(spi, HI3110_READ_TEC);
>   				cf->data[7] = hi3110_read(spi, HI3110_READ_REC);
>   				netdev_dbg(priv->net, "Bus Error\n");
> -				netif_rx_ni(skb);
> +				netif_rx(skb);
>   			}
>   		}
>   
> diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
> index d23edaf224204..fc747bff5eeb2 100644
> --- a/drivers/net/can/spi/mcp251x.c
> +++ b/drivers/net/can/spi/mcp251x.c
> @@ -740,7 +740,7 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx)
>   
>   	can_led_event(priv->net, CAN_LED_EVENT_RX);
>   
> -	netif_rx_ni(skb);
> +	netif_rx(skb);
>   }
>   
>   static void mcp251x_hw_sleep(struct spi_device *spi)
> @@ -987,7 +987,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
>   	if (skb) {
>   		frame->can_id |= can_id;
>   		frame->data[1] = data1;
> -		netif_rx_ni(skb);
> +		netif_rx(skb);
>   	} else {
>   		netdev_err(net, "cannot allocate error skb\n");
>   	}
> diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
> index c42f18845b02a..a15619d883ec2 100644
> --- a/drivers/net/can/vcan.c
> +++ b/drivers/net/can/vcan.c
> @@ -80,7 +80,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
>   	skb->dev       = dev;
>   	skb->ip_summed = CHECKSUM_UNNECESSARY;
>   
> -	netif_rx_ni(skb);
> +	netif_rx(skb);
>   }
>   
>   static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
> diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c
> index 47ccc15a3486b..556f1a12ec9a0 100644
> --- a/drivers/net/can/vxcan.c
> +++ b/drivers/net/can/vxcan.c
> @@ -63,7 +63,7 @@ static netdev_tx_t vxcan_xmit(struct sk_buff *skb, struct net_device *dev)
>   	skb->ip_summed  = CHECKSUM_UNNECESSARY;
>   
>   	len = cfd->can_id & CAN_RTR_FLAG ? 0 : cfd->len;
> -	if (netif_rx_ni(skb) == NET_RX_SUCCESS) {
> +	if (netif_rx(skb) == NET_RX_SUCCESS) {
>   		srcstats->tx_packets++;
>   		srcstats->tx_bytes += len;
>   		peerstats = &peer->stats;
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index cce2af10eb3ea..1fb49d51b25d6 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -284,7 +284,7 @@ int can_send(struct sk_buff *skb, int loop)
>   	}
>   
>   	if (newskb)
> -		netif_rx_ni(newskb);
> +		netif_rx(newskb);
>   
>   	/* update statistics */
>   	pkg_stats->tx_frames++;
Marc Kleine-Budde March 6, 2022, 10:31 a.m. UTC | #2
On 05.03.2022 23:12:46, Sebastian Andrzej Siewior wrote:
> Since commit
>    baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.")
> 
> the function netif_rx() can be used in preemptible/thread context as
> well as in interrupt context.
> 
> Use netif_rx().
> 
> Cc: Marc Kleine-Budde <mkl@pengutronix.de>
> Cc: Oliver Hartkopp <socketcan@hartkopp.net>
> Cc: Wolfgang Grandegger <wg@grandegger.com>
> Cc: linux-can@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>

regards,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c
index c192f25f96956..e7ab45f1c43b2 100644
--- a/drivers/net/can/dev/dev.c
+++ b/drivers/net/can/dev/dev.c
@@ -154,7 +154,7 @@  static void can_restart(struct net_device *dev)
 
 	cf->can_id |= CAN_ERR_RESTARTED;
 
-	netif_rx_ni(skb);
+	netif_rx(skb);
 
 restart:
 	netdev_dbg(dev, "restarted\n");
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 27783fbf011fc..ec294d0c5722c 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -221,7 +221,7 @@  static void slc_bump(struct slcan *sl)
 	if (!(cf.can_id & CAN_RTR_FLAG))
 		sl->dev->stats.rx_bytes += cf.len;
 
-	netif_rx_ni(skb);
+	netif_rx(skb);
 }
 
 /* parse tty input stream */
diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index 664b8f14d7b05..a5b2952b8d0ff 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c
@@ -356,7 +356,7 @@  static void hi3110_hw_rx(struct spi_device *spi)
 
 	can_led_event(priv->net, CAN_LED_EVENT_RX);
 
-	netif_rx_ni(skb);
+	netif_rx(skb);
 }
 
 static void hi3110_hw_sleep(struct spi_device *spi)
@@ -677,7 +677,7 @@  static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
 			tx_state = txerr >= rxerr ? new_state : 0;
 			rx_state = txerr <= rxerr ? new_state : 0;
 			can_change_state(net, cf, tx_state, rx_state);
-			netif_rx_ni(skb);
+			netif_rx(skb);
 
 			if (new_state == CAN_STATE_BUS_OFF) {
 				can_bus_off(net);
@@ -718,7 +718,7 @@  static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
 				cf->data[6] = hi3110_read(spi, HI3110_READ_TEC);
 				cf->data[7] = hi3110_read(spi, HI3110_READ_REC);
 				netdev_dbg(priv->net, "Bus Error\n");
-				netif_rx_ni(skb);
+				netif_rx(skb);
 			}
 		}
 
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index d23edaf224204..fc747bff5eeb2 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -740,7 +740,7 @@  static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx)
 
 	can_led_event(priv->net, CAN_LED_EVENT_RX);
 
-	netif_rx_ni(skb);
+	netif_rx(skb);
 }
 
 static void mcp251x_hw_sleep(struct spi_device *spi)
@@ -987,7 +987,7 @@  static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
 	if (skb) {
 		frame->can_id |= can_id;
 		frame->data[1] = data1;
-		netif_rx_ni(skb);
+		netif_rx(skb);
 	} else {
 		netdev_err(net, "cannot allocate error skb\n");
 	}
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index c42f18845b02a..a15619d883ec2 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -80,7 +80,7 @@  static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
 	skb->dev       = dev;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 
-	netif_rx_ni(skb);
+	netif_rx(skb);
 }
 
 static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c
index 47ccc15a3486b..556f1a12ec9a0 100644
--- a/drivers/net/can/vxcan.c
+++ b/drivers/net/can/vxcan.c
@@ -63,7 +63,7 @@  static netdev_tx_t vxcan_xmit(struct sk_buff *skb, struct net_device *dev)
 	skb->ip_summed  = CHECKSUM_UNNECESSARY;
 
 	len = cfd->can_id & CAN_RTR_FLAG ? 0 : cfd->len;
-	if (netif_rx_ni(skb) == NET_RX_SUCCESS) {
+	if (netif_rx(skb) == NET_RX_SUCCESS) {
 		srcstats->tx_packets++;
 		srcstats->tx_bytes += len;
 		peerstats = &peer->stats;
diff --git a/net/can/af_can.c b/net/can/af_can.c
index cce2af10eb3ea..1fb49d51b25d6 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -284,7 +284,7 @@  int can_send(struct sk_buff *skb, int loop)
 	}
 
 	if (newskb)
-		netif_rx_ni(newskb);
+		netif_rx(newskb);
 
 	/* update statistics */
 	pkg_stats->tx_frames++;