[BRIDGE]: forwarding remove unneeded preempt and bh diasables
Optimize the forwarding and transmit paths. Both places are called with bottom half/no preempt so there is no need to use spin_lock_bh or rcu_read_lock. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fdeabdefb2
commit
f8ae737dee
|
@ -27,6 +27,7 @@ static struct net_device_stats *br_dev_get_stats(struct net_device *dev)
|
||||||
return &br->statistics;
|
return &br->statistics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* net device transmit always called with no BH (preempt_disabled) */
|
||||||
int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct net_bridge *br = netdev_priv(dev);
|
struct net_bridge *br = netdev_priv(dev);
|
||||||
|
@ -39,7 +40,6 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
skb->mac.raw = skb->data;
|
skb->mac.raw = skb->data;
|
||||||
skb_pull(skb, ETH_HLEN);
|
skb_pull(skb, ETH_HLEN);
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
if (dest[0] & 1)
|
if (dest[0] & 1)
|
||||||
br_flood_deliver(br, skb, 0);
|
br_flood_deliver(br, skb, 0);
|
||||||
else if ((dst = __br_fdb_get(br, dest)) != NULL)
|
else if ((dst = __br_fdb_get(br, dest)) != NULL)
|
||||||
|
@ -47,7 +47,6 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
else
|
else
|
||||||
br_flood_deliver(br, skb, 0);
|
br_flood_deliver(br, skb, 0);
|
||||||
|
|
||||||
rcu_read_unlock();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,6 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
|
||||||
if (hold_time(br) == 0)
|
if (hold_time(br) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
fdb = fdb_find(head, addr);
|
fdb = fdb_find(head, addr);
|
||||||
if (likely(fdb)) {
|
if (likely(fdb)) {
|
||||||
/* attempt to update an entry for a local interface */
|
/* attempt to update an entry for a local interface */
|
||||||
|
@ -356,13 +355,12 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
|
||||||
fdb->ageing_timer = jiffies;
|
fdb->ageing_timer = jiffies;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spin_lock_bh(&br->hash_lock);
|
spin_lock(&br->hash_lock);
|
||||||
if (!fdb_find(head, addr))
|
if (!fdb_find(head, addr))
|
||||||
fdb_create(head, source, addr, 0);
|
fdb_create(head, source, addr, 0);
|
||||||
/* else we lose race and someone else inserts
|
/* else we lose race and someone else inserts
|
||||||
* it first, don't bother updating
|
* it first, don't bother updating
|
||||||
*/
|
*/
|
||||||
spin_unlock_bh(&br->hash_lock);
|
spin_unlock(&br->hash_lock);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue