Commit 2d2080c3 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: set running state earlier

When an interface is brought up, the recent changes
to allow changing type-while-up only set the running
bit after everything was done. This broke a number
of things, including idle calculation for monitor
interfaces, and it also broke WDS station insertion
(although nobody noticed yet).

Thus, change the code to set the running bit earlier,
but keep it after the driver's add_interface was
called because otherwise drivers may iterate over
interfaces they haven't fully set up yet.
Reported-by: default avatarRajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 46a5ebaf
...@@ -280,6 +280,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) ...@@ -280,6 +280,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
netif_carrier_on(dev); netif_carrier_on(dev);
} }
set_bit(SDATA_STATE_RUNNING, &sdata->state);
if (sdata->vif.type == NL80211_IFTYPE_WDS) { if (sdata->vif.type == NL80211_IFTYPE_WDS) {
/* Create STA entry for the WDS peer */ /* Create STA entry for the WDS peer */
sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
...@@ -331,8 +333,6 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) ...@@ -331,8 +333,6 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
netif_tx_start_all_queues(dev); netif_tx_start_all_queues(dev);
set_bit(SDATA_STATE_RUNNING, &sdata->state);
return 0; return 0;
err_del_interface: err_del_interface:
drv_remove_interface(local, &sdata->vif); drv_remove_interface(local, &sdata->vif);
...@@ -343,6 +343,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) ...@@ -343,6 +343,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
sdata->bss = NULL; sdata->bss = NULL;
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
list_del(&sdata->u.vlan.list); list_del(&sdata->u.vlan.list);
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
return res; return res;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment