]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
can: fix NOHZ local_softirq_pending 08 warning
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Tue, 15 Sep 2009 17:29:13 +0000 (17:29 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Tue, 15 Sep 2009 17:29:13 +0000 (17:29 +0000)
When using nanosleep() in an userspace application we get a ratelimit warning

NOHZ: local_softirq_pending 08

for 10 times.

The echo of CAN frames is done from process context and softirq context only.
Therefore the usage of netif_rx() was wrong (for years).

This patch replaces netif_rx() with netif_rx_ni() which has to be used from
process/softirq context. It also adds a missing comment that can_send() must
no be used from hardirq context.

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
Also in mainline.

git-svn-id: svn://svn.berlios.de//socketcan/trunk@1055 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.4/drivers/net/can/vcan.c
kernel/2.4/net/can/af_can.c
kernel/2.6/drivers/net/can/vcan.c
kernel/2.6/net/can/af_can.c

index 2faa851d886c18120ce87b62d2a7df8476d32b8b..8ed8aef9f91f839df5524426e01a8cdce50becbe 100644 (file)
@@ -98,7 +98,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);
 }
 
 #endif
index 9307e9764fda67944f08777481ca75e7524ace9e..5fb3b6d5f8a55a7bf65ee9848c319982d455a478 100644 (file)
@@ -189,6 +189,8 @@ static int can_create(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
@@ -271,7 +273,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++;
index 69cbeb9ddd6dd882dde5eeec5d0b51f1764ec6f4..4fdcaa3e1485b5adff2205072a97def02f53b73b 100644 (file)
@@ -116,7 +116,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 int vcan_tx(struct sk_buff *skb, struct net_device *dev)
index 80eff10206b2c27b3bf441d228d427515a3f09c7..b5513b375fedda704b9091d3941a1cbb04c11618 100644 (file)
@@ -262,6 +262,8 @@ static int can_create(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
@@ -355,7 +357,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++;