Message ID | 1271321358.16881.2240.camel@edumazet-laptop |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Thu, 15 Apr 2010 10:49:18 +0200 > Maybe we should add a new function after all... > > int netif_rx_any(struct sk_buff *skb) > { > if (in_interrupt()) > return netif_rx(skb); > > return netif_rx_ni(skb); > } Ok, thanks for the analysis. Since we keep coming back to this issue why don't we simply solve it forever? Let's make netif_rx() work in all contexts and get rid of netif_rx_ni(). I think this is the thing to do because this whole netif_rx_ni() vs. netif_rx() thing was meant to be an optimization of sorts (this goes back to like 8+ years ago :-), and really I doubt it really matters on that level any more. What do you think? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Le jeudi 15 avril 2010 à 02:02 -0700, David Miller a écrit : > Since we keep coming back to this issue why don't we simply > solve it forever? Let's make netif_rx() work in all contexts > and get rid of netif_rx_ni(). > > I think this is the thing to do because this whole netif_rx_ni() > vs. netif_rx() thing was meant to be an optimization of sorts (this > goes back to like 8+ years ago :-), and really I doubt it really > matters on that level any more. > > What do you think? I was about to come to same idea indeed. netif_receive_skb() is supposed to be used for modern devices anyway, avoiding netif_rx() overhead... -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c index 6971f6c..80ac563 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(skb); + netif_rx_ni(skb); } static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) diff --git a/net/can/af_can.c b/net/can/af_can.c index ef1c43a..6068321 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -199,6 +199,8 @@ static int can_create(struct net *net, struct socket *sock, int protocol) * @skb: pointer to socket buffer with CAN frame in data section * @loop: loopback for listeners on local CAN sockets (recommended default!) * + * Due to the loopback this routine must not be called from hardirq context. + * * Return: * 0 on success * -ENETDOWN when the selected interface is down @@ -278,7 +280,7 @@ int can_send(struct sk_buff *skb, int loop) } if (newskb) - netif_rx(newskb); + netif_rx_ni(newskb); /* update statistics */ can_stats.tx_frames++; commit ae3e0fcf901e4b7df87aef7ab39093e142a8de8b Author: Holger Schurig <hs4233@mail.mn-solutions.de> Date: Wed Jan 16 15:48:44 2008 +0100 libertas cs/sdio: fix 'NOHZ: local_softirq_pending 08' message netif_rx should be called only from interrupt context. if_cs and if_sdio receive packets from other contexts, and thus should call netif_rx_ni. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Acked-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com> diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 6332fd4..149557a 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -247,7 +247,10 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) priv->stats.rx_packets++; skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); + if (in_interrupt()) + netif_rx(skb); + else + netif_rx_ni(skb); ret = 0;