ifb: RCU locking avoids touching dev refcount

Avoids touching dev refcount in hotpath

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2009-11-01 19:45:16 +00:00 committed by David S. Miller
parent 3710becf8a
commit 05e8689c9a
1 changed files with 4 additions and 2 deletions

View 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) {