Skip to content

Commit

Permalink
ifb: RCU locking avoids touching dev refcount
Browse files Browse the repository at this point in the history
Avoids touching dev refcount in hotpath

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 2, 2009
1 parent 3710bec commit 05e8689
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 05e8689

Please sign in to comment.