ifb: RCU locking avoids touching dev refcount
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 1 Nov 2009 19:45:16 +0000 (19:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Nov 2009 07:55:12 +0000 (23:55 -0800)
Avoids touching dev refcount in hotpath

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ifb.c

index 030913f8bd26ef40876170abad2fb93e7215e16e..69c25668dd63d1baad3bc0a6ee56525c42ff7602 100644 (file)
@@ -98,13 +98,15 @@ static void ri_tasklet(unsigned long dev)
                stats->tx_packets++;
                stats->tx_bytes +=skb->len;
 
-               skb->dev = dev_get_by_index(&init_net, skb->iif);
+               rcu_read_lock();
+               skb->dev = dev_get_by_index_rcu(&init_net, skb->iif);
                if (!skb->dev) {
+                       rcu_read_unlock();
                        dev_kfree_skb(skb);
                        stats->tx_dropped++;
                        break;
                }
-               dev_put(skb->dev);
+               rcu_read_unlock();
                skb->iif = _dev->ifindex;
 
                if (from & AT_EGRESS) {