aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--include/net/cfg80211.h30
-rw-r--r--net/mac80211/mlme.c26
-rw-r--r--net/wireless/mlme.c51
3 files changed, 56 insertions, 51 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fe49833242d7..60c1f11da45f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1721,70 +1721,68 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
1721 * @dev: network device 1721 * @dev: network device
1722 * @buf: authentication frame (header + body) 1722 * @buf: authentication frame (header + body)
1723 * @len: length of the frame data 1723 * @len: length of the frame data
1724 * @gfp: allocation flags
1725 * 1724 *
1726 * This function is called whenever an authentication has been processed in 1725 * This function is called whenever an authentication has been processed in
1727 * station mode. The driver is required to call either this function or 1726 * station mode. The driver is required to call either this function or
1728 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 1727 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1729 * call. 1728 * call. This function may sleep.
1730 */ 1729 */
1731void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp); 1730void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1732 1731
1733/** 1732/**
1734 * cfg80211_send_auth_timeout - notification of timed out authentication 1733 * cfg80211_send_auth_timeout - notification of timed out authentication
1735 * @dev: network device 1734 * @dev: network device
1736 * @addr: The MAC address of the device with which the authentication timed out 1735 * @addr: The MAC address of the device with which the authentication timed out
1737 * @gfp: allocation flags 1736 *
1737 * This function may sleep.
1738 */ 1738 */
1739void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp); 1739void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1740 1740
1741/** 1741/**
1742 * cfg80211_send_rx_assoc - notification of processed association 1742 * cfg80211_send_rx_assoc - notification of processed association
1743 * @dev: network device 1743 * @dev: network device
1744 * @buf: (re)association response frame (header + body) 1744 * @buf: (re)association response frame (header + body)
1745 * @len: length of the frame data 1745 * @len: length of the frame data
1746 * @gfp: allocation flags
1747 * 1746 *
1748 * This function is called whenever a (re)association response has been 1747 * This function is called whenever a (re)association response has been
1749 * processed in station mode. The driver is required to call either this 1748 * processed in station mode. The driver is required to call either this
1750 * function or cfg80211_send_assoc_timeout() to indicate the result of 1749 * function or cfg80211_send_assoc_timeout() to indicate the result of
1751 * cfg80211_ops::assoc() call. 1750 * cfg80211_ops::assoc() call. This function may sleep.
1752 */ 1751 */
1753void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp); 1752void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1754 1753
1755/** 1754/**
1756 * cfg80211_send_assoc_timeout - notification of timed out association 1755 * cfg80211_send_assoc_timeout - notification of timed out association
1757 * @dev: network device 1756 * @dev: network device
1758 * @addr: The MAC address of the device with which the association timed out 1757 * @addr: The MAC address of the device with which the association timed out
1759 * @gfp: allocation flags 1758 *
1759 * This function may sleep.
1760 */ 1760 */
1761void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp); 1761void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1762 1762
1763/** 1763/**
1764 * cfg80211_send_deauth - notification of processed deauthentication 1764 * cfg80211_send_deauth - notification of processed deauthentication
1765 * @dev: network device 1765 * @dev: network device
1766 * @buf: deauthentication frame (header + body) 1766 * @buf: deauthentication frame (header + body)
1767 * @len: length of the frame data 1767 * @len: length of the frame data
1768 * @gfp: allocation flags
1769 * 1768 *
1770 * This function is called whenever deauthentication has been processed in 1769 * This function is called whenever deauthentication has been processed in
1771 * station mode. This includes both received deauthentication frames and 1770 * station mode. This includes both received deauthentication frames and
1772 * locally generated ones. 1771 * locally generated ones. This function may sleep.
1773 */ 1772 */
1774void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp); 1773void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
1775 1774
1776/** 1775/**
1777 * cfg80211_send_disassoc - notification of processed disassociation 1776 * cfg80211_send_disassoc - notification of processed disassociation
1778 * @dev: network device 1777 * @dev: network device
1779 * @buf: disassociation response frame (header + body) 1778 * @buf: disassociation response frame (header + body)
1780 * @len: length of the frame data 1779 * @len: length of the frame data
1781 * @gfp: allocation flags
1782 * 1780 *
1783 * This function is called whenever disassociation has been processed in 1781 * This function is called whenever disassociation has been processed in
1784 * station mode. This includes both received disassociation frames and locally 1782 * station mode. This includes both received disassociation frames and locally
1785 * generated ones. 1783 * generated ones. This function may sleep.
1786 */ 1784 */
1787void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp); 1785void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
1788 1786
1789/** 1787/**
1790 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1788 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 108e8c9c60fd..15dbb57ab55e 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -412,11 +412,9 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
412 mgmt->u.deauth.reason_code = cpu_to_le16(reason); 412 mgmt->u.deauth.reason_code = cpu_to_le16(reason);
413 413
414 if (stype == IEEE80211_STYPE_DEAUTH) 414 if (stype == IEEE80211_STYPE_DEAUTH)
415 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, skb->len, 415 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, skb->len);
416 GFP_KERNEL);
417 else 416 else
418 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, skb->len, 417 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, skb->len);
419 GFP_KERNEL);
420 ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED); 418 ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED);
421} 419}
422 420
@@ -1839,12 +1837,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1839 /* no action */ 1837 /* no action */
1840 break; 1838 break;
1841 case RX_MGMT_CFG80211_DEAUTH: 1839 case RX_MGMT_CFG80211_DEAUTH:
1842 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, 1840 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
1843 skb->len, GFP_KERNEL);
1844 break; 1841 break;
1845 case RX_MGMT_CFG80211_DISASSOC: 1842 case RX_MGMT_CFG80211_DISASSOC:
1846 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, 1843 cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
1847 skb->len, GFP_KERNEL);
1848 break; 1844 break;
1849 default: 1845 default:
1850 WARN(1, "unexpected: %d", rma); 1846 WARN(1, "unexpected: %d", rma);
@@ -1893,12 +1889,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1893 /* no action */ 1889 /* no action */
1894 break; 1890 break;
1895 case RX_MGMT_CFG80211_AUTH: 1891 case RX_MGMT_CFG80211_AUTH:
1896 cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, skb->len, 1892 cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, skb->len);
1897 GFP_KERNEL);
1898 break; 1893 break;
1899 case RX_MGMT_CFG80211_ASSOC: 1894 case RX_MGMT_CFG80211_ASSOC:
1900 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len, 1895 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len);
1901 GFP_KERNEL);
1902 break; 1896 break;
1903 default: 1897 default:
1904 WARN(1, "unexpected: %d", rma); 1898 WARN(1, "unexpected: %d", rma);
@@ -2026,13 +2020,11 @@ static void ieee80211_sta_work(struct work_struct *work)
2026 switch (wk->tries) { 2020 switch (wk->tries) {
2027 case RX_MGMT_CFG80211_AUTH_TO: 2021 case RX_MGMT_CFG80211_AUTH_TO:
2028 cfg80211_send_auth_timeout(sdata->dev, 2022 cfg80211_send_auth_timeout(sdata->dev,
2029 wk->bss->cbss.bssid, 2023 wk->bss->cbss.bssid);
2030 GFP_KERNEL);
2031 break; 2024 break;
2032 case RX_MGMT_CFG80211_ASSOC_TO: 2025 case RX_MGMT_CFG80211_ASSOC_TO:
2033 cfg80211_send_auth_timeout(sdata->dev, 2026 cfg80211_send_assoc_timeout(sdata->dev,
2034 wk->bss->cbss.bssid, 2027 wk->bss->cbss.bssid);
2035 GFP_KERNEL);
2036 break; 2028 break;
2037 default: 2029 default:
2038 WARN(1, "unexpected: %d", wk->tries); 2030 WARN(1, "unexpected: %d", wk->tries);
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] &&