mac80211: revamp virtual interface handling
This patch revamps the virtual interface handling and makes the code much easier to follow. Fewer functions, better names, less spaghetti code. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
3e122be089
commit
75636525fb
@@ -971,7 +971,6 @@ static const struct header_ops ieee80211_header_ops = {
|
||||
.cache_update = eth_header_cache_update,
|
||||
};
|
||||
|
||||
/* Must not be called for mdev */
|
||||
void ieee80211_if_setup(struct net_device *dev)
|
||||
{
|
||||
ether_setup(dev);
|
||||
@@ -981,7 +980,7 @@ void ieee80211_if_setup(struct net_device *dev)
|
||||
dev->change_mtu = ieee80211_change_mtu;
|
||||
dev->open = ieee80211_open;
|
||||
dev->stop = ieee80211_stop;
|
||||
dev->destructor = ieee80211_if_free;
|
||||
dev->destructor = free_netdev;
|
||||
}
|
||||
|
||||
/* everything else */
|
||||
@@ -1776,7 +1775,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
|
||||
printk(KERN_WARNING "%s: Failed to add default virtual iface\n",
|
||||
wiphy_name(local->hw.wiphy));
|
||||
|
||||
local->reg_state = IEEE80211_DEV_REGISTERED;
|
||||
rtnl_unlock();
|
||||
|
||||
ieee80211_led_init(local);
|
||||
@@ -1806,30 +1804,20 @@ EXPORT_SYMBOL(ieee80211_register_hw);
|
||||
void ieee80211_unregister_hw(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct ieee80211_local *local = hw_to_local(hw);
|
||||
struct ieee80211_sub_if_data *sdata, *tmp;
|
||||
|
||||
tasklet_kill(&local->tx_pending_tasklet);
|
||||
tasklet_kill(&local->tasklet);
|
||||
|
||||
rtnl_lock();
|
||||
|
||||
BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED);
|
||||
|
||||
local->reg_state = IEEE80211_DEV_UNREGISTERED;
|
||||
|
||||
/*
|
||||
* At this point, interface list manipulations are fine
|
||||
* because the driver cannot be handing us frames any
|
||||
* more and the tasklet is killed.
|
||||
*/
|
||||
|
||||
/*
|
||||
* First, we remove all virtual interfaces.
|
||||
*/
|
||||
list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
|
||||
list_del(&sdata->list);
|
||||
__ieee80211_if_del(local, sdata);
|
||||
}
|
||||
/* First, we remove all virtual interfaces. */
|
||||
ieee80211_remove_interfaces(local);
|
||||
|
||||
/* then, finally, remove the master interface */
|
||||
unregister_netdevice(local->mdev);
|
||||
|
Reference in New Issue
Block a user