aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-06 21:56:07 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:02:31 -0400
commitcb0b4beb93d14429bf0c50fc1ab8e26348dca880 (patch)
tree2bdb9aa1f2b3e7e2fdd9425da5ab6aa062134aa5 /net/wireless/mlme.c
parentc238c8ac63f2d33ea5e7c0b9e9e0ccd8ae9a34e4 (diff)
cfg80211: mlme API must be able to sleep
After the mac80211 mlme cleanup, we can require that the MLME functions in cfg80211 can sleep. This will simplify future work in cfg80211 a lot. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/mlme.c')
-rw-r--r--net/wireless/mlme.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 087d3377958f..f7dc7524e145 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -12,7 +12,7 @@
12#include "core.h" 12#include "core.h"
13#include "nl80211.h" 13#include "nl80211.h"
14 14
15void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) 15void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
16{ 16{
17 struct wireless_dev *wdev = dev->ieee80211_ptr; 17 struct wireless_dev *wdev = dev->ieee80211_ptr;
18 struct wiphy *wiphy = wdev->wiphy; 18 struct wiphy *wiphy = wdev->wiphy;
@@ -23,6 +23,8 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gf
23 u16 status = le16_to_cpu(mgmt->u.auth.status_code); 23 u16 status = le16_to_cpu(mgmt->u.auth.status_code);
24 bool done = false; 24 bool done = false;
25 25
26 might_sleep();
27
26 for (i = 0; i < MAX_AUTH_BSSES; i++) { 28 for (i = 0; i < MAX_AUTH_BSSES; i++) {
27 if (wdev->authtry_bsses[i] && 29 if (wdev->authtry_bsses[i] &&
28 memcmp(wdev->authtry_bsses[i]->pub.bssid, bssid, 30 memcmp(wdev->authtry_bsses[i]->pub.bssid, bssid,
@@ -41,12 +43,12 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gf
41 43
42 WARN_ON(!done); 44 WARN_ON(!done);
43 45
44 nl80211_send_rx_auth(rdev, dev, buf, len, gfp); 46 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
45 cfg80211_sme_rx_auth(dev, buf, len); 47 cfg80211_sme_rx_auth(dev, buf, len);
46} 48}
47EXPORT_SYMBOL(cfg80211_send_rx_auth); 49EXPORT_SYMBOL(cfg80211_send_rx_auth);
48 50
49void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) 51void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
50{ 52{
51 u16 status_code; 53 u16 status_code;
52 struct wireless_dev *wdev = dev->ieee80211_ptr; 54 struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -57,12 +59,14 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, g
57 int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); 59 int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
58 bool done; 60 bool done;
59 61
62 might_sleep();
63
60 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 64 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
61 65
62 nl80211_send_rx_assoc(rdev, dev, buf, len, gfp); 66 nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL);
63 67
64 cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs, 68 cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs,
65 status_code, gfp); 69 status_code, GFP_KERNEL);
66 70
67 if (status_code == WLAN_STATUS_SUCCESS) { 71 if (status_code == WLAN_STATUS_SUCCESS) {
68 for (i = 0; wdev->current_bss && i < MAX_AUTH_BSSES; i++) { 72 for (i = 0; wdev->current_bss && i < MAX_AUTH_BSSES; i++) {
@@ -80,7 +84,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, g
80} 84}
81EXPORT_SYMBOL(cfg80211_send_rx_assoc); 85EXPORT_SYMBOL(cfg80211_send_rx_assoc);
82 86
83void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) 87void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len)
84{ 88{
85 struct wireless_dev *wdev = dev->ieee80211_ptr; 89 struct wireless_dev *wdev = dev->ieee80211_ptr;
86 struct wiphy *wiphy = wdev->wiphy; 90 struct wiphy *wiphy = wdev->wiphy;
@@ -90,7 +94,9 @@ void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp
90 int i; 94 int i;
91 bool done = false; 95 bool done = false;
92 96
93 nl80211_send_deauth(rdev, dev, buf, len, gfp); 97 might_sleep();
98
99 nl80211_send_deauth(rdev, dev, buf, len, GFP_KERNEL);
94 100
95 if (wdev->current_bss && 101 if (wdev->current_bss &&
96 memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) { 102 memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
@@ -132,16 +138,17 @@ void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp
132 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); 138 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
133 139
134 from_ap = memcmp(mgmt->da, dev->dev_addr, ETH_ALEN) == 0; 140 from_ap = memcmp(mgmt->da, dev->dev_addr, ETH_ALEN) == 0;
135 __cfg80211_disconnected(dev, gfp, NULL, 0, 141 __cfg80211_disconnected(dev, GFP_KERNEL, NULL, 0,
136 reason_code, from_ap); 142 reason_code, from_ap);
137 } else if (wdev->sme_state == CFG80211_SME_CONNECTING) { 143 } else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
138 cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0, 144 cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
139 WLAN_STATUS_UNSPECIFIED_FAILURE, gfp); 145 WLAN_STATUS_UNSPECIFIED_FAILURE,
146 GFP_KERNEL);
140 } 147 }
141} 148}
142EXPORT_SYMBOL(cfg80211_send_deauth); 149EXPORT_SYMBOL(cfg80211_send_deauth);
143 150
144void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) 151void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len)
145{ 152{
146 struct wireless_dev *wdev = dev->ieee80211_ptr; 153 struct wireless_dev *wdev = dev->ieee80211_ptr;
147 struct wiphy *wiphy = wdev->wiphy; 154 struct wiphy *wiphy = wdev->wiphy;
@@ -153,7 +160,9 @@ void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, g
153 bool from_ap; 160 bool from_ap;
154 bool done = false; 161 bool done = false;
155 162
156 nl80211_send_disassoc(rdev, dev, buf, len, gfp); 163 might_sleep();
164
165 nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL);
157 166
158 if (!wdev->sme_state == CFG80211_SME_CONNECTED) 167 if (!wdev->sme_state == CFG80211_SME_CONNECTED)
159 return; 168 return;
@@ -177,12 +186,12 @@ void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, g
177 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 186 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
178 187
179 from_ap = memcmp(mgmt->da, dev->dev_addr, ETH_ALEN) == 0; 188 from_ap = memcmp(mgmt->da, dev->dev_addr, ETH_ALEN) == 0;
180 __cfg80211_disconnected(dev, gfp, NULL, 0, 189 __cfg80211_disconnected(dev, GFP_KERNEL, NULL, 0,
181 reason_code, from_ap); 190 reason_code, from_ap);
182} 191}
183EXPORT_SYMBOL(cfg80211_send_disassoc); 192EXPORT_SYMBOL(cfg80211_send_disassoc);
184 193
185void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp) 194void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
186{ 195{
187 struct wireless_dev *wdev = dev->ieee80211_ptr; 196 struct wireless_dev *wdev = dev->ieee80211_ptr;
188 struct wiphy *wiphy = wdev->wiphy; 197 struct wiphy *wiphy = wdev->wiphy;
@@ -190,10 +199,13 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gf
190 int i; 199 int i;
191 bool done = false; 200 bool done = false;
192 201
193 nl80211_send_auth_timeout(rdev, dev, addr, gfp); 202 might_sleep();
203
204 nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL);
194 if (wdev->sme_state == CFG80211_SME_CONNECTING) 205 if (wdev->sme_state == CFG80211_SME_CONNECTING)
195 cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0, 206 cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0,
196 WLAN_STATUS_UNSPECIFIED_FAILURE, gfp); 207 WLAN_STATUS_UNSPECIFIED_FAILURE,
208 GFP_KERNEL);
197 209
198 for (i = 0; addr && i < MAX_AUTH_BSSES; i++) { 210 for (i = 0; addr && i < MAX_AUTH_BSSES; i++) {
199 if (wdev->authtry_bsses[i] && 211 if (wdev->authtry_bsses[i] &&
@@ -211,7 +223,7 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gf
211} 223}
212EXPORT_SYMBOL(cfg80211_send_auth_timeout); 224EXPORT_SYMBOL(cfg80211_send_auth_timeout);
213 225
214void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp) 226void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
215{ 227{
216 struct wireless_dev *wdev = dev->ieee80211_ptr; 228 struct wireless_dev *wdev = dev->ieee80211_ptr;
217 struct wiphy *wiphy = wdev->wiphy; 229 struct wiphy *wiphy = wdev->wiphy;
@@ -219,10 +231,13 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t g
219 int i; 231 int i;
220 bool done = false; 232 bool done = false;
221 233
222 nl80211_send_assoc_timeout(rdev, dev, addr, gfp); 234 might_sleep();
235
236 nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL);
223 if (wdev->sme_state == CFG80211_SME_CONNECTING) 237 if (wdev->sme_state == CFG80211_SME_CONNECTING)
224 cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0, 238 cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0,
225 WLAN_STATUS_UNSPECIFIED_FAILURE, gfp); 239 WLAN_STATUS_UNSPECIFIED_FAILURE,
240 GFP_KERNEL);
226 241
227 for (i = 0; addr && i < MAX_AUTH_BSSES; i++) { 242 for (i = 0; addr && i < MAX_AUTH_BSSES; i++) {
228 if (wdev->auth_bsses[i] && 243 if (wdev->auth_bsses[i] &&