netdev: Do not use TX lock to protect address lists.
Now that we have a specific lock to protect the network device unicast and multicast lists, remove extraneous grabs of the TX lock in cases where the code only needs address list protection. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@ -2981,11 +2981,9 @@ void __dev_set_rx_mode(struct net_device *dev)
|
||||
|
||||
void dev_set_rx_mode(struct net_device *dev)
|
||||
{
|
||||
netif_tx_lock_bh(dev);
|
||||
netif_addr_lock(dev);
|
||||
netif_addr_lock_bh(dev);
|
||||
__dev_set_rx_mode(dev);
|
||||
netif_addr_unlock(dev);
|
||||
netif_tx_unlock_bh(dev);
|
||||
netif_addr_unlock_bh(dev);
|
||||
}
|
||||
|
||||
int __dev_addr_delete(struct dev_addr_list **list, int *count,
|
||||
@ -3063,13 +3061,11 @@ int dev_unicast_delete(struct net_device *dev, void *addr, int alen)
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
netif_tx_lock_bh(dev);
|
||||
netif_addr_lock(dev);
|
||||
netif_addr_lock_bh(dev);
|
||||
err = __dev_addr_delete(&dev->uc_list, &dev->uc_count, addr, alen, 0);
|
||||
if (!err)
|
||||
__dev_set_rx_mode(dev);
|
||||
netif_addr_unlock(dev);
|
||||
netif_tx_unlock_bh(dev);
|
||||
netif_addr_unlock_bh(dev);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_unicast_delete);
|
||||
@ -3091,13 +3087,11 @@ int dev_unicast_add(struct net_device *dev, void *addr, int alen)
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
netif_tx_lock_bh(dev);
|
||||
netif_addr_lock(dev);
|
||||
netif_addr_lock_bh(dev);
|
||||
err = __dev_addr_add(&dev->uc_list, &dev->uc_count, addr, alen, 0);
|
||||
if (!err)
|
||||
__dev_set_rx_mode(dev);
|
||||
netif_addr_unlock(dev);
|
||||
netif_tx_unlock_bh(dev);
|
||||
netif_addr_unlock_bh(dev);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_unicast_add);
|
||||
@ -3164,14 +3158,12 @@ int dev_unicast_sync(struct net_device *to, struct net_device *from)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
netif_tx_lock_bh(to);
|
||||
netif_addr_lock(to);
|
||||
netif_addr_lock_bh(to);
|
||||
err = __dev_addr_sync(&to->uc_list, &to->uc_count,
|
||||
&from->uc_list, &from->uc_count);
|
||||
if (!err)
|
||||
__dev_set_rx_mode(to);
|
||||
netif_addr_unlock(to);
|
||||
netif_tx_unlock_bh(to);
|
||||
netif_addr_unlock_bh(to);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_unicast_sync);
|
||||
@ -3187,9 +3179,7 @@ EXPORT_SYMBOL(dev_unicast_sync);
|
||||
*/
|
||||
void dev_unicast_unsync(struct net_device *to, struct net_device *from)
|
||||
{
|
||||
netif_tx_lock_bh(from);
|
||||
netif_addr_lock(from);
|
||||
netif_tx_lock_bh(to);
|
||||
netif_addr_lock_bh(from);
|
||||
netif_addr_lock(to);
|
||||
|
||||
__dev_addr_unsync(&to->uc_list, &to->uc_count,
|
||||
@ -3197,9 +3187,7 @@ void dev_unicast_unsync(struct net_device *to, struct net_device *from)
|
||||
__dev_set_rx_mode(to);
|
||||
|
||||
netif_addr_unlock(to);
|
||||
netif_tx_unlock_bh(to);
|
||||
netif_addr_unlock(from);
|
||||
netif_tx_unlock_bh(from);
|
||||
netif_addr_unlock_bh(from);
|
||||
}
|
||||
EXPORT_SYMBOL(dev_unicast_unsync);
|
||||
|
||||
@ -3219,8 +3207,7 @@ static void __dev_addr_discard(struct dev_addr_list **list)
|
||||
|
||||
static void dev_addr_discard(struct net_device *dev)
|
||||
{
|
||||
netif_tx_lock_bh(dev);
|
||||
netif_addr_lock(dev);
|
||||
netif_addr_lock_bh(dev);
|
||||
|
||||
__dev_addr_discard(&dev->uc_list);
|
||||
dev->uc_count = 0;
|
||||
@ -3228,8 +3215,7 @@ static void dev_addr_discard(struct net_device *dev)
|
||||
__dev_addr_discard(&dev->mc_list);
|
||||
dev->mc_count = 0;
|
||||
|
||||
netif_addr_unlock(dev);
|
||||
netif_tx_unlock_bh(dev);
|
||||
netif_addr_unlock_bh(dev);
|
||||
}
|
||||
|
||||
unsigned dev_get_flags(const struct net_device *dev)
|
||||
|
Reference in New Issue
Block a user