diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-07-09 08:40:35 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-07-14 14:30:07 -0400 |
commit | 75636525fbfa78fa33fd754c89785cfde750acd3 (patch) | |
tree | 2c614681382a53bec50248c621ba4c8bb07ce670 /net/mac80211/main.c | |
parent | 3e122be089e6fb8d3f322416da4cdbb80ce12927 (diff) |
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>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r-- | net/mac80211/main.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 863923964d21..0759ab2ca3ff 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -971,7 +971,6 @@ static const struct header_ops ieee80211_header_ops = { | |||
971 | .cache_update = eth_header_cache_update, | 971 | .cache_update = eth_header_cache_update, |
972 | }; | 972 | }; |
973 | 973 | ||
974 | /* Must not be called for mdev */ | ||
975 | void ieee80211_if_setup(struct net_device *dev) | 974 | void ieee80211_if_setup(struct net_device *dev) |
976 | { | 975 | { |
977 | ether_setup(dev); | 976 | ether_setup(dev); |
@@ -981,7 +980,7 @@ void ieee80211_if_setup(struct net_device *dev) | |||
981 | dev->change_mtu = ieee80211_change_mtu; | 980 | dev->change_mtu = ieee80211_change_mtu; |
982 | dev->open = ieee80211_open; | 981 | dev->open = ieee80211_open; |
983 | dev->stop = ieee80211_stop; | 982 | dev->stop = ieee80211_stop; |
984 | dev->destructor = ieee80211_if_free; | 983 | dev->destructor = free_netdev; |
985 | } | 984 | } |
986 | 985 | ||
987 | /* everything else */ | 986 | /* everything else */ |
@@ -1776,7 +1775,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
1776 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", | 1775 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", |
1777 | wiphy_name(local->hw.wiphy)); | 1776 | wiphy_name(local->hw.wiphy)); |
1778 | 1777 | ||
1779 | local->reg_state = IEEE80211_DEV_REGISTERED; | ||
1780 | rtnl_unlock(); | 1778 | rtnl_unlock(); |
1781 | 1779 | ||
1782 | ieee80211_led_init(local); | 1780 | ieee80211_led_init(local); |
@@ -1806,30 +1804,20 @@ EXPORT_SYMBOL(ieee80211_register_hw); | |||
1806 | void ieee80211_unregister_hw(struct ieee80211_hw *hw) | 1804 | void ieee80211_unregister_hw(struct ieee80211_hw *hw) |
1807 | { | 1805 | { |
1808 | struct ieee80211_local *local = hw_to_local(hw); | 1806 | struct ieee80211_local *local = hw_to_local(hw); |
1809 | struct ieee80211_sub_if_data *sdata, *tmp; | ||
1810 | 1807 | ||
1811 | tasklet_kill(&local->tx_pending_tasklet); | 1808 | tasklet_kill(&local->tx_pending_tasklet); |
1812 | tasklet_kill(&local->tasklet); | 1809 | tasklet_kill(&local->tasklet); |
1813 | 1810 | ||
1814 | rtnl_lock(); | 1811 | rtnl_lock(); |
1815 | 1812 | ||
1816 | BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED); | ||
1817 | |||
1818 | local->reg_state = IEEE80211_DEV_UNREGISTERED; | ||
1819 | |||
1820 | /* | 1813 | /* |
1821 | * At this point, interface list manipulations are fine | 1814 | * At this point, interface list manipulations are fine |
1822 | * because the driver cannot be handing us frames any | 1815 | * because the driver cannot be handing us frames any |
1823 | * more and the tasklet is killed. | 1816 | * more and the tasklet is killed. |
1824 | */ | 1817 | */ |
1825 | 1818 | ||
1826 | /* | 1819 | /* First, we remove all virtual interfaces. */ |
1827 | * First, we remove all virtual interfaces. | 1820 | ieee80211_remove_interfaces(local); |
1828 | */ | ||
1829 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { | ||
1830 | list_del(&sdata->list); | ||
1831 | __ieee80211_if_del(local, sdata); | ||
1832 | } | ||
1833 | 1821 | ||
1834 | /* then, finally, remove the master interface */ | 1822 | /* then, finally, remove the master interface */ |
1835 | unregister_netdevice(local->mdev); | 1823 | unregister_netdevice(local->mdev); |