aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-05-10 06:32:47 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-05-24 18:02:16 -0400
commit8d61ffa5e01c5f676431d12caba17db164a48a86 (patch)
treec3df0dc13fdc8d2327712db10c1c654f428f11a3 /net/wireless
parent5fe231e873729fa2f57cdc417d5c1f80871e2d7d (diff)
cfg80211/mac80211: use cfg80211 wdev mutex in mac80211
Using separate locks in cfg80211 and mac80211 has always caused issues, for example having to unlock in places in mac80211 to call cfg80211, which even needed a framework to make cfg80211 calls after some functions returned etc. Additionally, I suspect some issues people have reported with the cfg80211 state getting confused could be due to such issues, when cfg80211 is asking mac80211 to change state but mac80211 is in the process of telling cfg80211 that the state changed (in another way.) Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/mlme.c48
-rw-r--r--net/wireless/trace.h4
2 files changed, 10 insertions, 42 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 68b40f21bc38..80ffb0138919 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -25,12 +25,9 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
25 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 25 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
26 26
27 trace_cfg80211_send_rx_auth(dev); 27 trace_cfg80211_send_rx_auth(dev);
28 wdev_lock(wdev);
29 28
30 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL); 29 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
31 cfg80211_sme_rx_auth(dev, buf, len); 30 cfg80211_sme_rx_auth(dev, buf, len);
32
33 wdev_unlock(wdev);
34} 31}
35EXPORT_SYMBOL(cfg80211_send_rx_auth); 32EXPORT_SYMBOL(cfg80211_send_rx_auth);
36 33
@@ -46,7 +43,6 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
46 int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); 43 int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
47 44
48 trace_cfg80211_send_rx_assoc(dev, bss); 45 trace_cfg80211_send_rx_assoc(dev, bss);
49 wdev_lock(wdev);
50 46
51 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 47 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
52 48
@@ -59,7 +55,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
59 if (status_code != WLAN_STATUS_SUCCESS && wdev->conn && 55 if (status_code != WLAN_STATUS_SUCCESS && wdev->conn &&
60 cfg80211_sme_failed_reassoc(wdev)) { 56 cfg80211_sme_failed_reassoc(wdev)) {
61 cfg80211_put_bss(wiphy, bss); 57 cfg80211_put_bss(wiphy, bss);
62 goto out; 58 return;
63 } 59 }
64 60
65 nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL); 61 nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL);
@@ -71,7 +67,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
71 * sme will schedule work that does it later. 67 * sme will schedule work that does it later.
72 */ 68 */
73 cfg80211_put_bss(wiphy, bss); 69 cfg80211_put_bss(wiphy, bss);
74 goto out; 70 return;
75 } 71 }
76 72
77 if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) { 73 if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) {
@@ -87,13 +83,11 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
87 __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs, 83 __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs,
88 status_code, 84 status_code,
89 status_code == WLAN_STATUS_SUCCESS, bss); 85 status_code == WLAN_STATUS_SUCCESS, bss);
90 out:
91 wdev_unlock(wdev);
92} 86}
93EXPORT_SYMBOL(cfg80211_send_rx_assoc); 87EXPORT_SYMBOL(cfg80211_send_rx_assoc);
94 88
95void __cfg80211_send_deauth(struct net_device *dev, 89void cfg80211_send_deauth(struct net_device *dev,
96 const u8 *buf, size_t len) 90 const u8 *buf, size_t len)
97{ 91{
98 struct wireless_dev *wdev = dev->ieee80211_ptr; 92 struct wireless_dev *wdev = dev->ieee80211_ptr;
99 struct wiphy *wiphy = wdev->wiphy; 93 struct wiphy *wiphy = wdev->wiphy;
@@ -102,7 +96,7 @@ void __cfg80211_send_deauth(struct net_device *dev,
102 const u8 *bssid = mgmt->bssid; 96 const u8 *bssid = mgmt->bssid;
103 bool was_current = false; 97 bool was_current = false;
104 98
105 trace___cfg80211_send_deauth(dev); 99 trace_cfg80211_send_deauth(dev);
106 ASSERT_WDEV_LOCK(wdev); 100 ASSERT_WDEV_LOCK(wdev);
107 101
108 if (wdev->current_bss && 102 if (wdev->current_bss &&
@@ -129,20 +123,10 @@ void __cfg80211_send_deauth(struct net_device *dev,
129 false, NULL); 123 false, NULL);
130 } 124 }
131} 125}
132EXPORT_SYMBOL(__cfg80211_send_deauth);
133
134void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len)
135{
136 struct wireless_dev *wdev = dev->ieee80211_ptr;
137
138 wdev_lock(wdev);
139 __cfg80211_send_deauth(dev, buf, len);
140 wdev_unlock(wdev);
141}
142EXPORT_SYMBOL(cfg80211_send_deauth); 126EXPORT_SYMBOL(cfg80211_send_deauth);
143 127
144void __cfg80211_send_disassoc(struct net_device *dev, 128void cfg80211_send_disassoc(struct net_device *dev,
145 const u8 *buf, size_t len) 129 const u8 *buf, size_t len)
146{ 130{
147 struct wireless_dev *wdev = dev->ieee80211_ptr; 131 struct wireless_dev *wdev = dev->ieee80211_ptr;
148 struct wiphy *wiphy = wdev->wiphy; 132 struct wiphy *wiphy = wdev->wiphy;
@@ -152,7 +136,7 @@ void __cfg80211_send_disassoc(struct net_device *dev,
152 u16 reason_code; 136 u16 reason_code;
153 bool from_ap; 137 bool from_ap;
154 138
155 trace___cfg80211_send_disassoc(dev); 139 trace_cfg80211_send_disassoc(dev);
156 ASSERT_WDEV_LOCK(wdev); 140 ASSERT_WDEV_LOCK(wdev);
157 141
158 nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL); 142 nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL);
@@ -175,16 +159,6 @@ void __cfg80211_send_disassoc(struct net_device *dev,
175 from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr); 159 from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr);
176 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap); 160 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
177} 161}
178EXPORT_SYMBOL(__cfg80211_send_disassoc);
179
180void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len)
181{
182 struct wireless_dev *wdev = dev->ieee80211_ptr;
183
184 wdev_lock(wdev);
185 __cfg80211_send_disassoc(dev, buf, len);
186 wdev_unlock(wdev);
187}
188EXPORT_SYMBOL(cfg80211_send_disassoc); 162EXPORT_SYMBOL(cfg80211_send_disassoc);
189 163
190void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr) 164void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
@@ -194,15 +168,12 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
194 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 168 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
195 169
196 trace_cfg80211_send_auth_timeout(dev, addr); 170 trace_cfg80211_send_auth_timeout(dev, addr);
197 wdev_lock(wdev);
198 171
199 nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL); 172 nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL);
200 if (wdev->sme_state == CFG80211_SME_CONNECTING) 173 if (wdev->sme_state == CFG80211_SME_CONNECTING)
201 __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0, 174 __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0,
202 WLAN_STATUS_UNSPECIFIED_FAILURE, 175 WLAN_STATUS_UNSPECIFIED_FAILURE,
203 false, NULL); 176 false, NULL);
204
205 wdev_unlock(wdev);
206} 177}
207EXPORT_SYMBOL(cfg80211_send_auth_timeout); 178EXPORT_SYMBOL(cfg80211_send_auth_timeout);
208 179
@@ -213,15 +184,12 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
213 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 184 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
214 185
215 trace_cfg80211_send_assoc_timeout(dev, addr); 186 trace_cfg80211_send_assoc_timeout(dev, addr);
216 wdev_lock(wdev);
217 187
218 nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL); 188 nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL);
219 if (wdev->sme_state == CFG80211_SME_CONNECTING) 189 if (wdev->sme_state == CFG80211_SME_CONNECTING)
220 __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0, 190 __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0,
221 WLAN_STATUS_UNSPECIFIED_FAILURE, 191 WLAN_STATUS_UNSPECIFIED_FAILURE,
222 false, NULL); 192 false, NULL);
223
224 wdev_unlock(wdev);
225} 193}
226EXPORT_SYMBOL(cfg80211_send_assoc_timeout); 194EXPORT_SYMBOL(cfg80211_send_assoc_timeout);
227 195
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 5755bc14abbd..23fafeae8a10 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1911,12 +1911,12 @@ TRACE_EVENT(cfg80211_send_rx_assoc,
1911 NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG) 1911 NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG)
1912); 1912);
1913 1913
1914DEFINE_EVENT(netdev_evt_only, __cfg80211_send_deauth, 1914DEFINE_EVENT(netdev_evt_only, cfg80211_send_deauth,
1915 TP_PROTO(struct net_device *netdev), 1915 TP_PROTO(struct net_device *netdev),
1916 TP_ARGS(netdev) 1916 TP_ARGS(netdev)
1917); 1917);
1918 1918
1919DEFINE_EVENT(netdev_evt_only, __cfg80211_send_disassoc, 1919DEFINE_EVENT(netdev_evt_only, cfg80211_send_disassoc,
1920 TP_PROTO(struct net_device *netdev), 1920 TP_PROTO(struct net_device *netdev),
1921 TP_ARGS(netdev) 1921 TP_ARGS(netdev)
1922); 1922);