netdev: Add netdev->addr_list_lock protection.

Add netif_addr_{lock,unlock}{,_bh}() helpers.

Use them to protect operations that operate on or read
the network device unicast and multicast address lists.

Also use them in cases where the code simply wants to
block calls into the driver's ->set_rx_mode() and
->set_multicast_list() methods.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller
2008-07-15 00:13:44 -07:00
parent f1f28aa351
commit e308a5d806
14 changed files with 94 additions and 0 deletions

View File

@@ -1568,10 +1568,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
}
netif_tx_lock_bh(bond_dev);
netif_addr_lock(bond_dev);
/* upload master's mc_list to new slave */
for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
}
netif_addr_unlock(bond_dev);
netif_tx_unlock_bh(bond_dev);
}
@@ -1937,7 +1939,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
/* flush master's mc_list from slave */
netif_tx_lock_bh(bond_dev);
netif_addr_lock(bond_dev);
bond_mc_list_flush(bond_dev, slave_dev);
netif_addr_unlock(bond_dev);
netif_tx_unlock_bh(bond_dev);
}
@@ -2060,7 +2064,9 @@ static int bond_release_all(struct net_device *bond_dev)
/* flush master's mc_list from slave */
netif_tx_lock_bh(bond_dev);
netif_addr_lock(bond_dev);
bond_mc_list_flush(bond_dev, slave_dev);
netif_addr_unlock(bond_dev);
netif_tx_unlock_bh(bond_dev);
}
@@ -4674,7 +4680,9 @@ static void bond_free_all(void)
bond_work_cancel_all(bond);
netif_tx_lock_bh(bond_dev);
netif_addr_lock(bond_dev);
bond_mc_list_destroy(bond);
netif_addr_unlock(bond_dev);
netif_tx_unlock_bh(bond_dev);
/* Release the bonded slaves */
bond_release_all(bond_dev);