b43: fix reloading config settings after channel changes or hostapd restart (#8033...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 860-b43_restart_config.patch
1 --- a/drivers/net/wireless/b43/main.c
2 +++ b/drivers/net/wireless/b43/main.c
3 @@ -325,6 +325,10 @@ static void b43_wireless_core_exit(struc
4 static int b43_wireless_core_init(struct b43_wldev *dev);
5 static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev);
6 static int b43_wireless_core_start(struct b43_wldev *dev);
7 +static void b43_op_bss_info_changed(struct ieee80211_hw *hw,
8 + struct ieee80211_vif *vif,
9 + struct ieee80211_bss_conf *conf,
10 + u32 changed);
11
12 static int b43_ratelimit(struct b43_wl *wl)
13 {
14 @@ -3602,14 +3606,24 @@ static int b43_op_config(struct ieee8021
15 struct ieee80211_conf *conf = &hw->conf;
16 int antenna;
17 int err = 0;
18 + bool reload_bss = false;
19
20 mutex_lock(&wl->mutex);
21
22 + dev = wl->current_dev;
23 +
24 /* Switch the band (if necessary). This might change the active core. */
25 err = b43_switch_band(wl, conf->channel);
26 if (err)
27 goto out_unlock_mutex;
28 - dev = wl->current_dev;
29 +
30 + /* Need to reload all settings if the core changed */
31 + if (dev != wl->current_dev) {
32 + dev = wl->current_dev;
33 + changed = ~0;
34 + reload_bss = true;
35 + }
36 +
37 phy = &dev->phy;
38
39 if (conf_is_ht(conf))
40 @@ -3670,6 +3684,9 @@ out_mac_enable:
41 out_unlock_mutex:
42 mutex_unlock(&wl->mutex);
43
44 + if (wl->vif && reload_bss)
45 + b43_op_bss_info_changed(hw, wl->vif, &wl->vif->bss_conf, ~0);
46 +
47 return err;
48 }
49
50 @@ -3758,7 +3775,8 @@ static void b43_op_bss_info_changed(stru
51 if (changed & BSS_CHANGED_BEACON_INT &&
52 (b43_is_mode(wl, NL80211_IFTYPE_AP) ||
53 b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) ||
54 - b43_is_mode(wl, NL80211_IFTYPE_ADHOC)))
55 + b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) &&
56 + conf->beacon_int)
57 b43_set_beacon_int(dev, conf->beacon_int);
58
59 if (changed & BSS_CHANGED_BASIC_RATES)
60 @@ -4566,6 +4584,12 @@ static int b43_op_start(struct ieee80211
61 out_mutex_unlock:
62 mutex_unlock(&wl->mutex);
63
64 + if (err == 0)
65 + b43_op_bss_info_changed(hw, vif, &vif->bss_conf, ~0);
66 +
67 + /* reload configuration */
68 + b43_op_config(hw, ~0);
69 +
70 return err;
71 }
72
73 @@ -4722,10 +4746,18 @@ out:
74 if (err)
75 wl->current_dev = NULL; /* Failed to init the dev. */
76 mutex_unlock(&wl->mutex);
77 - if (err)
78 +
79 + if (err) {
80 b43err(wl, "Controller restart FAILED\n");
81 - else
82 - b43info(wl, "Controller restarted\n");
83 + return;
84 + }
85 +
86 + /* reload configuration */
87 + b43_op_config(wl->hw, ~0);
88 + if (wl->vif)
89 + b43_op_bss_info_changed(wl->hw, wl->vif, &wl->vif->bss_conf, ~0);
90 +
91 + b43info(wl, "Controller restarted\n");
92 }
93
94 static int b43_setup_bands(struct b43_wldev *dev,