diff options
author | David S. Miller <davem@davemloft.net> | 2009-04-25 19:36:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-25 19:36:46 -0400 |
commit | 495a1b4eff1a216a3ea171ac137f1807e6555f52 (patch) | |
tree | 72d059d6d66fac6a74df33bac2eb40dcd0ea0732 /include | |
parent | ad8affd972a705a38e769859c50ee8e749b631da (diff) | |
parent | d3feaf5ad12259927039a675cfb25dc342b403ab (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Conflicts:
net/mac80211/pm.c
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ieee80211.h | 41 | ||||
-rw-r--r-- | include/linux/mmc/sdio_ids.h | 2 | ||||
-rw-r--r-- | include/linux/nl80211.h | 127 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 2 | ||||
-rw-r--r-- | include/linux/rfkill.h | 14 | ||||
-rw-r--r-- | include/net/cfg80211.h | 897 | ||||
-rw-r--r-- | include/net/mac80211.h | 117 | ||||
-rw-r--r-- | include/net/regulatory.h | 101 | ||||
-rw-r--r-- | include/net/wireless.h | 472 |
9 files changed, 1119 insertions, 654 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 4b501b48ce86..c52e7fba4e40 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -540,7 +540,7 @@ struct ieee80211_tim_ie { | |||
540 | u8 dtim_period; | 540 | u8 dtim_period; |
541 | u8 bitmap_ctrl; | 541 | u8 bitmap_ctrl; |
542 | /* variable size: 1 - 251 bytes */ | 542 | /* variable size: 1 - 251 bytes */ |
543 | u8 virtual_map[0]; | 543 | u8 virtual_map[1]; |
544 | } __attribute__ ((packed)); | 544 | } __attribute__ ((packed)); |
545 | 545 | ||
546 | #define WLAN_SA_QUERY_TR_ID_LEN 16 | 546 | #define WLAN_SA_QUERY_TR_ID_LEN 16 |
@@ -1383,4 +1383,43 @@ static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq) | |||
1383 | return -1; | 1383 | return -1; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | /** | ||
1387 | * ieee80211_tu_to_usec - convert time units (TU) to microseconds | ||
1388 | * @tu: the TUs | ||
1389 | */ | ||
1390 | static inline unsigned long ieee80211_tu_to_usec(unsigned long tu) | ||
1391 | { | ||
1392 | return 1024 * tu; | ||
1393 | } | ||
1394 | |||
1395 | /** | ||
1396 | * ieee80211_check_tim - check if AID bit is set in TIM | ||
1397 | * @tim: the TIM IE | ||
1398 | * @tim_len: length of the TIM IE | ||
1399 | * @aid: the AID to look for | ||
1400 | */ | ||
1401 | static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim, | ||
1402 | u8 tim_len, u16 aid) | ||
1403 | { | ||
1404 | u8 mask; | ||
1405 | u8 index, indexn1, indexn2; | ||
1406 | |||
1407 | if (unlikely(!tim || tim_len < sizeof(*tim))) | ||
1408 | return false; | ||
1409 | |||
1410 | aid &= 0x3fff; | ||
1411 | index = aid / 8; | ||
1412 | mask = 1 << (aid & 7); | ||
1413 | |||
1414 | indexn1 = tim->bitmap_ctrl & 0xfe; | ||
1415 | indexn2 = tim_len + indexn1 - 4; | ||
1416 | |||
1417 | if (index < indexn1 || index > indexn2) | ||
1418 | return false; | ||
1419 | |||
1420 | index -= indexn1; | ||
1421 | |||
1422 | return !!(tim->virtual_map[index] & mask); | ||
1423 | } | ||
1424 | |||
1386 | #endif /* LINUX_IEEE80211_H */ | 1425 | #endif /* LINUX_IEEE80211_H */ |
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index ea1bf5ba092f..c7211ab6dd4b 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h | |||
@@ -25,5 +25,7 @@ | |||
25 | 25 | ||
26 | #define SDIO_VENDOR_ID_MARVELL 0x02df | 26 | #define SDIO_VENDOR_ID_MARVELL 0x02df |
27 | #define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 | 27 | #define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 |
28 | #define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104 | ||
29 | #define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105 | ||
28 | 30 | ||
29 | #endif | 31 | #endif |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index cbe8ce3bf486..e9fd13aa79f0 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * Copyright 2008 Michael Wu <flamingice@sourmilk.net> | 7 | * Copyright 2008 Michael Wu <flamingice@sourmilk.net> |
8 | * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> | 8 | * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> |
9 | * Copyright 2008 Michael Buesch <mb@bu3sch.de> | 9 | * Copyright 2008 Michael Buesch <mb@bu3sch.de> |
10 | * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com> | 10 | * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> |
11 | * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> | 11 | * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> |
12 | * Copyright 2008 Colin McCabe <colin@cozybit.com> | 12 | * Copyright 2008 Colin McCabe <colin@cozybit.com> |
13 | * | 13 | * |
@@ -46,8 +46,10 @@ | |||
46 | * to get a list of all present wiphys. | 46 | * to get a list of all present wiphys. |
47 | * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or | 47 | * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or |
48 | * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, | 48 | * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, |
49 | * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or | 49 | * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, |
50 | * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. | 50 | * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, |
51 | * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, | ||
52 | * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. | ||
51 | * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request | 53 | * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request |
52 | * or rename notification. Has attributes %NL80211_ATTR_WIPHY and | 54 | * or rename notification. Has attributes %NL80211_ATTR_WIPHY and |
53 | * %NL80211_ATTR_WIPHY_NAME. | 55 | * %NL80211_ATTR_WIPHY_NAME. |
@@ -166,6 +168,22 @@ | |||
166 | * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is | 168 | * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is |
167 | * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on | 169 | * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on |
168 | * to (%NL80211_ATTR_REG_ALPHA2). | 170 | * to (%NL80211_ATTR_REG_ALPHA2). |
171 | * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon | ||
172 | * has been found while world roaming thus enabling active scan or | ||
173 | * any mode of operation that initiates TX (beacons) on a channel | ||
174 | * where we would not have been able to do either before. As an example | ||
175 | * if you are world roaming (regulatory domain set to world or if your | ||
176 | * driver is using a custom world roaming regulatory domain) and while | ||
177 | * doing a passive scan on the 5 GHz band you find an AP there (if not | ||
178 | * on a DFS channel) you will now be able to actively scan for that AP | ||
179 | * or use AP mode on your card on that same channel. Note that this will | ||
180 | * never be used for channels 1-11 on the 2 GHz band as they are always | ||
181 | * enabled world wide. This beacon hint is only sent if your device had | ||
182 | * either disabled active scanning or beaconing on a channel. We send to | ||
183 | * userspace the wiphy on which we removed a restriction from | ||
184 | * (%NL80211_ATTR_WIPHY) and the channel on which this occurred | ||
185 | * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER) | ||
186 | * the beacon hint was processed. | ||
169 | * | 187 | * |
170 | * @NL80211_CMD_AUTHENTICATE: authentication request and notification. | 188 | * @NL80211_CMD_AUTHENTICATE: authentication request and notification. |
171 | * This command is used both as a command (request to authenticate) and | 189 | * This command is used both as a command (request to authenticate) and |
@@ -185,8 +203,12 @@ | |||
185 | * frame, i.e., it was for the local STA and was received in correct | 203 | * frame, i.e., it was for the local STA and was received in correct |
186 | * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the | 204 | * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the |
187 | * MLME SAP interface (kernel providing MLME, userspace SME). The | 205 | * MLME SAP interface (kernel providing MLME, userspace SME). The |
188 | * included NL80211_ATTR_FRAME attribute contains the management frame | 206 | * included %NL80211_ATTR_FRAME attribute contains the management frame |
189 | * (including both the header and frame body, but not FCS). | 207 | * (including both the header and frame body, but not FCS). This event is |
208 | * also used to indicate if the authentication attempt timed out. In that | ||
209 | * case the %NL80211_ATTR_FRAME attribute is replaced with a | ||
210 | * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which | ||
211 | * pending authentication timed out). | ||
190 | * @NL80211_CMD_ASSOCIATE: association request and notification; like | 212 | * @NL80211_CMD_ASSOCIATE: association request and notification; like |
191 | * NL80211_CMD_AUTHENTICATE but for Association and Reassociation | 213 | * NL80211_CMD_AUTHENTICATE but for Association and Reassociation |
192 | * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, | 214 | * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, |
@@ -199,6 +221,25 @@ | |||
199 | * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to | 221 | * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to |
200 | * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). | 222 | * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). |
201 | * | 223 | * |
224 | * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael | ||
225 | * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the | ||
226 | * event includes %NL80211_ATTR_MAC to describe the source MAC address of | ||
227 | * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key | ||
228 | * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and | ||
229 | * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this | ||
230 | * event matches with MLME-MICHAELMICFAILURE.indication() primitive | ||
231 | * | ||
232 | * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a | ||
233 | * FREQ attribute (for the initial frequency if no peer can be found) | ||
234 | * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those | ||
235 | * should be fixed rather than automatically determined. Can only be | ||
236 | * executed on a network interface that is UP, and fixed BSSID/FREQ | ||
237 | * may be rejected. Another optional parameter is the beacon interval, | ||
238 | * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not | ||
239 | * given defaults to 100 TU (102.4ms). | ||
240 | * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is | ||
241 | * determined by the network interface. | ||
242 | * | ||
202 | * @NL80211_CMD_MAX: highest used command number | 243 | * @NL80211_CMD_MAX: highest used command number |
203 | * @__NL80211_CMD_AFTER_LAST: internal use | 244 | * @__NL80211_CMD_AFTER_LAST: internal use |
204 | */ | 245 | */ |
@@ -260,6 +301,13 @@ enum nl80211_commands { | |||
260 | NL80211_CMD_DEAUTHENTICATE, | 301 | NL80211_CMD_DEAUTHENTICATE, |
261 | NL80211_CMD_DISASSOCIATE, | 302 | NL80211_CMD_DISASSOCIATE, |
262 | 303 | ||
304 | NL80211_CMD_MICHAEL_MIC_FAILURE, | ||
305 | |||
306 | NL80211_CMD_REG_BEACON_HINT, | ||
307 | |||
308 | NL80211_CMD_JOIN_IBSS, | ||
309 | NL80211_CMD_LEAVE_IBSS, | ||
310 | |||
263 | /* add new commands above here */ | 311 | /* add new commands above here */ |
264 | 312 | ||
265 | /* used to define NL80211_CMD_MAX below */ | 313 | /* used to define NL80211_CMD_MAX below */ |
@@ -278,6 +326,7 @@ enum nl80211_commands { | |||
278 | #define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE | 326 | #define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE |
279 | #define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE | 327 | #define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE |
280 | #define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE | 328 | #define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE |
329 | #define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT | ||
281 | 330 | ||
282 | /** | 331 | /** |
283 | * enum nl80211_attrs - nl80211 netlink attributes | 332 | * enum nl80211_attrs - nl80211 netlink attributes |
@@ -296,6 +345,18 @@ enum nl80211_commands { | |||
296 | * NL80211_CHAN_HT20 = HT20 only | 345 | * NL80211_CHAN_HT20 = HT20 only |
297 | * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel | 346 | * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel |
298 | * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel | 347 | * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel |
348 | * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is | ||
349 | * less than or equal to the RTS threshold; allowed range: 1..255; | ||
350 | * dot11ShortRetryLimit; u8 | ||
351 | * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is | ||
352 | * greater than the RTS threshold; allowed range: 1..255; | ||
353 | * dot11ShortLongLimit; u8 | ||
354 | * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum | ||
355 | * length in octets for frames; allowed range: 256..8000, disable | ||
356 | * fragmentation with (u32)-1; dot11FragmentationThreshold; u32 | ||
357 | * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length | ||
358 | * larger than or equal to this use RTS/CTS handshake); allowed range: | ||
359 | * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 | ||
299 | * | 360 | * |
300 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on | 361 | * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on |
301 | * @NL80211_ATTR_IFNAME: network interface name | 362 | * @NL80211_ATTR_IFNAME: network interface name |
@@ -380,6 +441,8 @@ enum nl80211_commands { | |||
380 | * | 441 | * |
381 | * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with | 442 | * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with |
382 | * a single scan request, a wiphy attribute. | 443 | * a single scan request, a wiphy attribute. |
444 | * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements | ||
445 | * that can be added to a scan request | ||
383 | * | 446 | * |
384 | * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) | 447 | * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) |
385 | * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive | 448 | * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive |
@@ -408,6 +471,29 @@ enum nl80211_commands { | |||
408 | * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and | 471 | * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and |
409 | * %NL80211_CMD_DISASSOCIATE, u16 | 472 | * %NL80211_CMD_DISASSOCIATE, u16 |
410 | * | 473 | * |
474 | * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as | ||
475 | * a u32 | ||
476 | * | ||
477 | * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change | ||
478 | * due to considerations from a beacon hint. This attribute reflects | ||
479 | * the state of the channel _before_ the beacon hint processing. This | ||
480 | * attributes consists of a nested attribute containing | ||
481 | * NL80211_FREQUENCY_ATTR_* | ||
482 | * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change | ||
483 | * due to considerations from a beacon hint. This attribute reflects | ||
484 | * the state of the channel _after_ the beacon hint processing. This | ||
485 | * attributes consists of a nested attribute containing | ||
486 | * NL80211_FREQUENCY_ATTR_* | ||
487 | * | ||
488 | * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported | ||
489 | * cipher suites | ||
490 | * | ||
491 | * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look | ||
492 | * for other networks on different channels | ||
493 | * | ||
494 | * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this | ||
495 | * is used, e.g., with %NL80211_CMD_AUTHENTICATE event | ||
496 | * | ||
411 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 497 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
412 | * @__NL80211_ATTR_AFTER_LAST: internal use | 498 | * @__NL80211_ATTR_AFTER_LAST: internal use |
413 | */ | 499 | */ |
@@ -492,6 +578,24 @@ enum nl80211_attrs { | |||
492 | NL80211_ATTR_AUTH_TYPE, | 578 | NL80211_ATTR_AUTH_TYPE, |
493 | NL80211_ATTR_REASON_CODE, | 579 | NL80211_ATTR_REASON_CODE, |
494 | 580 | ||
581 | NL80211_ATTR_KEY_TYPE, | ||
582 | |||
583 | NL80211_ATTR_MAX_SCAN_IE_LEN, | ||
584 | NL80211_ATTR_CIPHER_SUITES, | ||
585 | |||
586 | NL80211_ATTR_FREQ_BEFORE, | ||
587 | NL80211_ATTR_FREQ_AFTER, | ||
588 | |||
589 | NL80211_ATTR_FREQ_FIXED, | ||
590 | |||
591 | |||
592 | NL80211_ATTR_WIPHY_RETRY_SHORT, | ||
593 | NL80211_ATTR_WIPHY_RETRY_LONG, | ||
594 | NL80211_ATTR_WIPHY_FRAG_THRESHOLD, | ||
595 | NL80211_ATTR_WIPHY_RTS_THRESHOLD, | ||
596 | |||
597 | NL80211_ATTR_TIMED_OUT, | ||
598 | |||
495 | /* add attributes here, update the policy in nl80211.c */ | 599 | /* add attributes here, update the policy in nl80211.c */ |
496 | 600 | ||
497 | __NL80211_ATTR_AFTER_LAST, | 601 | __NL80211_ATTR_AFTER_LAST, |
@@ -1062,4 +1166,17 @@ enum nl80211_auth_type { | |||
1062 | NL80211_AUTHTYPE_FT, | 1166 | NL80211_AUTHTYPE_FT, |
1063 | NL80211_AUTHTYPE_NETWORK_EAP, | 1167 | NL80211_AUTHTYPE_NETWORK_EAP, |
1064 | }; | 1168 | }; |
1169 | |||
1170 | /** | ||
1171 | * enum nl80211_key_type - Key Type | ||
1172 | * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key | ||
1173 | * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key | ||
1174 | * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS) | ||
1175 | */ | ||
1176 | enum nl80211_key_type { | ||
1177 | NL80211_KEYTYPE_GROUP, | ||
1178 | NL80211_KEYTYPE_PAIRWISE, | ||
1179 | NL80211_KEYTYPE_PEERKEY, | ||
1180 | }; | ||
1181 | |||
1065 | #endif /* __LINUX_NL80211_H */ | 1182 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index ee98cd570885..ea061e290d02 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2313,6 +2313,8 @@ | |||
2313 | 2313 | ||
2314 | #define PCI_VENDOR_ID_QMI 0x1a32 | 2314 | #define PCI_VENDOR_ID_QMI 0x1a32 |
2315 | 2315 | ||
2316 | #define PCI_VENDOR_ID_AZWAVE 0x1a3b | ||
2317 | |||
2316 | #define PCI_VENDOR_ID_TEKRAM 0x1de1 | 2318 | #define PCI_VENDOR_ID_TEKRAM 0x1de1 |
2317 | #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 | 2319 | #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 |
2318 | 2320 | ||
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index 164332cbb77c..de18ef227e00 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -52,23 +52,12 @@ enum rfkill_state { | |||
52 | RFKILL_STATE_MAX, /* marker for last valid state */ | 52 | RFKILL_STATE_MAX, /* marker for last valid state */ |
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* | ||
56 | * These are DEPRECATED, drivers using them should be verified to | ||
57 | * comply with the rfkill usage guidelines in Documentation/rfkill.txt | ||
58 | * and then converted to use the new names for rfkill_state | ||
59 | */ | ||
60 | #define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED | ||
61 | #define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED | ||
62 | |||
63 | /** | 55 | /** |
64 | * struct rfkill - rfkill control structure. | 56 | * struct rfkill - rfkill control structure. |
65 | * @name: Name of the switch. | 57 | * @name: Name of the switch. |
66 | * @type: Radio type which the button controls, the value stored | 58 | * @type: Radio type which the button controls, the value stored |
67 | * here should be a value from enum rfkill_type. | 59 | * here should be a value from enum rfkill_type. |
68 | * @state: State of the switch, "UNBLOCKED" means radio can operate. | 60 | * @state: State of the switch, "UNBLOCKED" means radio can operate. |
69 | * @user_claim_unsupported: Whether the hardware supports exclusive | ||
70 | * RF-kill control by userspace. Set this before registering. | ||
71 | * @user_claim: Set when the switch is controlled exlusively by userspace. | ||
72 | * @mutex: Guards switch state transitions. It serializes callbacks | 61 | * @mutex: Guards switch state transitions. It serializes callbacks |
73 | * and also protects the state. | 62 | * and also protects the state. |
74 | * @data: Pointer to the RF button drivers private data which will be | 63 | * @data: Pointer to the RF button drivers private data which will be |
@@ -91,9 +80,6 @@ struct rfkill { | |||
91 | const char *name; | 80 | const char *name; |
92 | enum rfkill_type type; | 81 | enum rfkill_type type; |
93 | 82 | ||
94 | bool user_claim_unsupported; | ||
95 | bool user_claim; | ||
96 | |||
97 | /* the mutex serializes callbacks and also protects | 83 | /* the mutex serializes callbacks and also protects |
98 | * the state */ | 84 | * the state */ |
99 | struct mutex mutex; | 85 | struct mutex mutex; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 5389afdc1297..b8a76764e1c5 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1,71 +1,217 @@ | |||
1 | #ifndef __NET_CFG80211_H | 1 | #ifndef __NET_CFG80211_H |
2 | #define __NET_CFG80211_H | 2 | #define __NET_CFG80211_H |
3 | /* | ||
4 | * 802.11 device and configuration interface | ||
5 | * | ||
6 | * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
3 | 12 | ||
13 | #include <linux/netdevice.h> | ||
14 | #include <linux/debugfs.h> | ||
15 | #include <linux/list.h> | ||
4 | #include <linux/netlink.h> | 16 | #include <linux/netlink.h> |
5 | #include <linux/skbuff.h> | 17 | #include <linux/skbuff.h> |
6 | #include <linux/nl80211.h> | 18 | #include <linux/nl80211.h> |
7 | #include <linux/if_ether.h> | 19 | #include <linux/if_ether.h> |
8 | #include <linux/ieee80211.h> | 20 | #include <linux/ieee80211.h> |
9 | #include <linux/wireless.h> | 21 | #include <net/regulatory.h> |
10 | #include <net/iw_handler.h> | 22 | |
11 | #include <net/genetlink.h> | ||
12 | /* remove once we remove the wext stuff */ | 23 | /* remove once we remove the wext stuff */ |
13 | #include <net/iw_handler.h> | 24 | #include <net/iw_handler.h> |
25 | #include <linux/wireless.h> | ||
26 | |||
14 | 27 | ||
15 | /* | 28 | /* |
16 | * 802.11 configuration in-kernel interface | 29 | * wireless hardware capability structures |
30 | */ | ||
31 | |||
32 | /** | ||
33 | * enum ieee80211_band - supported frequency bands | ||
34 | * | ||
35 | * The bands are assigned this way because the supported | ||
36 | * bitrates differ in these bands. | ||
17 | * | 37 | * |
18 | * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> | 38 | * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band |
39 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | ||
19 | */ | 40 | */ |
41 | enum ieee80211_band { | ||
42 | IEEE80211_BAND_2GHZ, | ||
43 | IEEE80211_BAND_5GHZ, | ||
44 | |||
45 | /* keep last */ | ||
46 | IEEE80211_NUM_BANDS | ||
47 | }; | ||
20 | 48 | ||
21 | /** | 49 | /** |
22 | * struct vif_params - describes virtual interface parameters | 50 | * enum ieee80211_channel_flags - channel flags |
23 | * @mesh_id: mesh ID to use | 51 | * |
24 | * @mesh_id_len: length of the mesh ID | 52 | * Channel flags set by the regulatory control code. |
53 | * | ||
54 | * @IEEE80211_CHAN_DISABLED: This channel is disabled. | ||
55 | * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted | ||
56 | * on this channel. | ||
57 | * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. | ||
58 | * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. | ||
59 | * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel | ||
60 | * is not permitted. | ||
61 | * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel | ||
62 | * is not permitted. | ||
25 | */ | 63 | */ |
26 | struct vif_params { | 64 | enum ieee80211_channel_flags { |
27 | u8 *mesh_id; | 65 | IEEE80211_CHAN_DISABLED = 1<<0, |
28 | int mesh_id_len; | 66 | IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, |
67 | IEEE80211_CHAN_NO_IBSS = 1<<2, | ||
68 | IEEE80211_CHAN_RADAR = 1<<3, | ||
69 | IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4, | ||
70 | IEEE80211_CHAN_NO_FAT_BELOW = 1<<5, | ||
29 | }; | 71 | }; |
30 | 72 | ||
31 | /* Radiotap header iteration | 73 | /** |
32 | * implemented in net/wireless/radiotap.c | 74 | * struct ieee80211_channel - channel definition |
33 | * docs in Documentation/networking/radiotap-headers.txt | 75 | * |
76 | * This structure describes a single channel for use | ||
77 | * with cfg80211. | ||
78 | * | ||
79 | * @center_freq: center frequency in MHz | ||
80 | * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz | ||
81 | * @hw_value: hardware-specific value for the channel | ||
82 | * @flags: channel flags from &enum ieee80211_channel_flags. | ||
83 | * @orig_flags: channel flags at registration time, used by regulatory | ||
84 | * code to support devices with additional restrictions | ||
85 | * @band: band this channel belongs to. | ||
86 | * @max_antenna_gain: maximum antenna gain in dBi | ||
87 | * @max_power: maximum transmission power (in dBm) | ||
88 | * @beacon_found: helper to regulatory code to indicate when a beacon | ||
89 | * has been found on this channel. Use regulatory_hint_found_beacon() | ||
90 | * to enable this, this is is useful only on 5 GHz band. | ||
91 | * @orig_mag: internal use | ||
92 | * @orig_mpwr: internal use | ||
34 | */ | 93 | */ |
94 | struct ieee80211_channel { | ||
95 | enum ieee80211_band band; | ||
96 | u16 center_freq; | ||
97 | u8 max_bandwidth; | ||
98 | u16 hw_value; | ||
99 | u32 flags; | ||
100 | int max_antenna_gain; | ||
101 | int max_power; | ||
102 | bool beacon_found; | ||
103 | u32 orig_flags; | ||
104 | int orig_mag, orig_mpwr; | ||
105 | }; | ||
106 | |||
35 | /** | 107 | /** |
36 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args | 108 | * enum ieee80211_rate_flags - rate flags |
37 | * @rtheader: pointer to the radiotap header we are walking through | 109 | * |
38 | * @max_length: length of radiotap header in cpu byte ordering | 110 | * Hardware/specification flags for rates. These are structured |
39 | * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg | 111 | * in a way that allows using the same bitrate structure for |
40 | * @this_arg: pointer to current radiotap arg | 112 | * different bands/PHY modes. |
41 | * @arg_index: internal next argument index | 113 | * |
42 | * @arg: internal next argument pointer | 114 | * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short |
43 | * @next_bitmap: internal pointer to next present u32 | 115 | * preamble on this bitrate; only relevant in 2.4GHz band and |
44 | * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present | 116 | * with CCK rates. |
117 | * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate | ||
118 | * when used with 802.11a (on the 5 GHz band); filled by the | ||
119 | * core code when registering the wiphy. | ||
120 | * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate | ||
121 | * when used with 802.11b (on the 2.4 GHz band); filled by the | ||
122 | * core code when registering the wiphy. | ||
123 | * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate | ||
124 | * when used with 802.11g (on the 2.4 GHz band); filled by the | ||
125 | * core code when registering the wiphy. | ||
126 | * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. | ||
45 | */ | 127 | */ |
128 | enum ieee80211_rate_flags { | ||
129 | IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, | ||
130 | IEEE80211_RATE_MANDATORY_A = 1<<1, | ||
131 | IEEE80211_RATE_MANDATORY_B = 1<<2, | ||
132 | IEEE80211_RATE_MANDATORY_G = 1<<3, | ||
133 | IEEE80211_RATE_ERP_G = 1<<4, | ||
134 | }; | ||
46 | 135 | ||
47 | struct ieee80211_radiotap_iterator { | 136 | /** |
48 | struct ieee80211_radiotap_header *rtheader; | 137 | * struct ieee80211_rate - bitrate definition |
49 | int max_length; | 138 | * |
50 | int this_arg_index; | 139 | * This structure describes a bitrate that an 802.11 PHY can |
51 | u8 *this_arg; | 140 | * operate with. The two values @hw_value and @hw_value_short |
141 | * are only for driver use when pointers to this structure are | ||
142 | * passed around. | ||
143 | * | ||
144 | * @flags: rate-specific flags | ||
145 | * @bitrate: bitrate in units of 100 Kbps | ||
146 | * @hw_value: driver/hardware value for this rate | ||
147 | * @hw_value_short: driver/hardware value for this rate when | ||
148 | * short preamble is used | ||
149 | */ | ||
150 | struct ieee80211_rate { | ||
151 | u32 flags; | ||
152 | u16 bitrate; | ||
153 | u16 hw_value, hw_value_short; | ||
154 | }; | ||
52 | 155 | ||
53 | int arg_index; | 156 | /** |
54 | u8 *arg; | 157 | * struct ieee80211_sta_ht_cap - STA's HT capabilities |
55 | __le32 *next_bitmap; | 158 | * |
56 | u32 bitmap_shifter; | 159 | * This structure describes most essential parameters needed |
160 | * to describe 802.11n HT capabilities for an STA. | ||
161 | * | ||
162 | * @ht_supported: is HT supported by the STA | ||
163 | * @cap: HT capabilities map as described in 802.11n spec | ||
164 | * @ampdu_factor: Maximum A-MPDU length factor | ||
165 | * @ampdu_density: Minimum A-MPDU spacing | ||
166 | * @mcs: Supported MCS rates | ||
167 | */ | ||
168 | struct ieee80211_sta_ht_cap { | ||
169 | u16 cap; /* use IEEE80211_HT_CAP_ */ | ||
170 | bool ht_supported; | ||
171 | u8 ampdu_factor; | ||
172 | u8 ampdu_density; | ||
173 | struct ieee80211_mcs_info mcs; | ||
57 | }; | 174 | }; |
58 | 175 | ||
59 | extern int ieee80211_radiotap_iterator_init( | 176 | /** |
60 | struct ieee80211_radiotap_iterator *iterator, | 177 | * struct ieee80211_supported_band - frequency band definition |
61 | struct ieee80211_radiotap_header *radiotap_header, | 178 | * |
62 | int max_length); | 179 | * This structure describes a frequency band a wiphy |
180 | * is able to operate in. | ||
181 | * | ||
182 | * @channels: Array of channels the hardware can operate in | ||
183 | * in this band. | ||
184 | * @band: the band this structure represents | ||
185 | * @n_channels: Number of channels in @channels | ||
186 | * @bitrates: Array of bitrates the hardware can operate with | ||
187 | * in this band. Must be sorted to give a valid "supported | ||
188 | * rates" IE, i.e. CCK rates first, then OFDM. | ||
189 | * @n_bitrates: Number of bitrates in @bitrates | ||
190 | */ | ||
191 | struct ieee80211_supported_band { | ||
192 | struct ieee80211_channel *channels; | ||
193 | struct ieee80211_rate *bitrates; | ||
194 | enum ieee80211_band band; | ||
195 | int n_channels; | ||
196 | int n_bitrates; | ||
197 | struct ieee80211_sta_ht_cap ht_cap; | ||
198 | }; | ||
63 | 199 | ||
64 | extern int ieee80211_radiotap_iterator_next( | 200 | /* |
65 | struct ieee80211_radiotap_iterator *iterator); | 201 | * Wireless hardware/device configuration structures and methods |
202 | */ | ||
66 | 203 | ||
204 | /** | ||
205 | * struct vif_params - describes virtual interface parameters | ||
206 | * @mesh_id: mesh ID to use | ||
207 | * @mesh_id_len: length of the mesh ID | ||
208 | */ | ||
209 | struct vif_params { | ||
210 | u8 *mesh_id; | ||
211 | int mesh_id_len; | ||
212 | }; | ||
67 | 213 | ||
68 | /** | 214 | /** |
69 | * struct key_params - key information | 215 | * struct key_params - key information |
70 | * | 216 | * |
71 | * Information about a key | 217 | * Information about a key |
@@ -348,92 +494,6 @@ struct bss_parameters { | |||
348 | u8 basic_rates_len; | 494 | u8 basic_rates_len; |
349 | }; | 495 | }; |
350 | 496 | ||
351 | /** | ||
352 | * enum environment_cap - Environment parsed from country IE | ||
353 | * @ENVIRON_ANY: indicates country IE applies to both indoor and | ||
354 | * outdoor operation. | ||
355 | * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation | ||
356 | * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation | ||
357 | */ | ||
358 | enum environment_cap { | ||
359 | ENVIRON_ANY, | ||
360 | ENVIRON_INDOOR, | ||
361 | ENVIRON_OUTDOOR, | ||
362 | }; | ||
363 | |||
364 | /** | ||
365 | * struct regulatory_request - used to keep track of regulatory requests | ||
366 | * | ||
367 | * @wiphy_idx: this is set if this request's initiator is | ||
368 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | ||
369 | * can be used by the wireless core to deal with conflicts | ||
370 | * and potentially inform users of which devices specifically | ||
371 | * cased the conflicts. | ||
372 | * @initiator: indicates who sent this request, could be any of | ||
373 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) | ||
374 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | ||
375 | * regulatory domain. We have a few special codes: | ||
376 | * 00 - World regulatory domain | ||
377 | * 99 - built by driver but a specific alpha2 cannot be determined | ||
378 | * 98 - result of an intersection between two regulatory domains | ||
379 | * @intersect: indicates whether the wireless core should intersect | ||
380 | * the requested regulatory domain with the presently set regulatory | ||
381 | * domain. | ||
382 | * @country_ie_checksum: checksum of the last processed and accepted | ||
383 | * country IE | ||
384 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, | ||
385 | * indoor, or if it doesn't matter | ||
386 | * @list: used to insert into the reg_requests_list linked list | ||
387 | */ | ||
388 | struct regulatory_request { | ||
389 | int wiphy_idx; | ||
390 | enum nl80211_reg_initiator initiator; | ||
391 | char alpha2[2]; | ||
392 | bool intersect; | ||
393 | u32 country_ie_checksum; | ||
394 | enum environment_cap country_ie_env; | ||
395 | struct list_head list; | ||
396 | }; | ||
397 | |||
398 | struct ieee80211_freq_range { | ||
399 | u32 start_freq_khz; | ||
400 | u32 end_freq_khz; | ||
401 | u32 max_bandwidth_khz; | ||
402 | }; | ||
403 | |||
404 | struct ieee80211_power_rule { | ||
405 | u32 max_antenna_gain; | ||
406 | u32 max_eirp; | ||
407 | }; | ||
408 | |||
409 | struct ieee80211_reg_rule { | ||
410 | struct ieee80211_freq_range freq_range; | ||
411 | struct ieee80211_power_rule power_rule; | ||
412 | u32 flags; | ||
413 | }; | ||
414 | |||
415 | struct ieee80211_regdomain { | ||
416 | u32 n_reg_rules; | ||
417 | char alpha2[2]; | ||
418 | struct ieee80211_reg_rule reg_rules[]; | ||
419 | }; | ||
420 | |||
421 | #define MHZ_TO_KHZ(freq) ((freq) * 1000) | ||
422 | #define KHZ_TO_MHZ(freq) ((freq) / 1000) | ||
423 | #define DBI_TO_MBI(gain) ((gain) * 100) | ||
424 | #define MBI_TO_DBI(gain) ((gain) / 100) | ||
425 | #define DBM_TO_MBM(gain) ((gain) * 100) | ||
426 | #define MBM_TO_DBM(gain) ((gain) / 100) | ||
427 | |||
428 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ | ||
429 | .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ | ||
430 | .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ | ||
431 | .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ | ||
432 | .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \ | ||
433 | .power_rule.max_eirp = DBM_TO_MBM(eirp), \ | ||
434 | .flags = reg_flags, \ | ||
435 | } | ||
436 | |||
437 | struct mesh_config { | 497 | struct mesh_config { |
438 | /* Timeouts in ms */ | 498 | /* Timeouts in ms */ |
439 | /* Mesh plink management parameters */ | 499 | /* Mesh plink management parameters */ |
@@ -504,7 +564,7 @@ struct cfg80211_scan_request { | |||
504 | int n_ssids; | 564 | int n_ssids; |
505 | struct ieee80211_channel **channels; | 565 | struct ieee80211_channel **channels; |
506 | u32 n_channels; | 566 | u32 n_channels; |
507 | u8 *ie; | 567 | const u8 *ie; |
508 | size_t ie_len; | 568 | size_t ie_len; |
509 | 569 | ||
510 | /* internal */ | 570 | /* internal */ |
@@ -659,6 +719,47 @@ struct cfg80211_disassoc_request { | |||
659 | }; | 719 | }; |
660 | 720 | ||
661 | /** | 721 | /** |
722 | * struct cfg80211_ibss_params - IBSS parameters | ||
723 | * | ||
724 | * This structure defines the IBSS parameters for the join_ibss() | ||
725 | * method. | ||
726 | * | ||
727 | * @ssid: The SSID, will always be non-null. | ||
728 | * @ssid_len: The length of the SSID, will always be non-zero. | ||
729 | * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not | ||
730 | * search for IBSSs with a different BSSID. | ||
731 | * @channel: The channel to use if no IBSS can be found to join. | ||
732 | * @channel_fixed: The channel should be fixed -- do not search for | ||
733 | * IBSSs to join on other channels. | ||
734 | * @ie: information element(s) to include in the beacon | ||
735 | * @ie_len: length of that | ||
736 | * @beacon_interval: beacon interval to use | ||
737 | */ | ||
738 | struct cfg80211_ibss_params { | ||
739 | u8 *ssid; | ||
740 | u8 *bssid; | ||
741 | struct ieee80211_channel *channel; | ||
742 | u8 *ie; | ||
743 | u8 ssid_len, ie_len; | ||
744 | u16 beacon_interval; | ||
745 | bool channel_fixed; | ||
746 | }; | ||
747 | |||
748 | /** | ||
749 | * enum wiphy_params_flags - set_wiphy_params bitfield values | ||
750 | * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed | ||
751 | * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed | ||
752 | * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed | ||
753 | * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed | ||
754 | */ | ||
755 | enum wiphy_params_flags { | ||
756 | WIPHY_PARAM_RETRY_SHORT = 1 << 0, | ||
757 | WIPHY_PARAM_RETRY_LONG = 1 << 1, | ||
758 | WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, | ||
759 | WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, | ||
760 | }; | ||
761 | |||
762 | /** | ||
662 | * struct cfg80211_ops - backend description for wireless configuration | 763 | * struct cfg80211_ops - backend description for wireless configuration |
663 | * | 764 | * |
664 | * This struct is registered by fullmac card drivers and/or wireless stacks | 765 | * This struct is registered by fullmac card drivers and/or wireless stacks |
@@ -733,6 +834,16 @@ struct cfg80211_disassoc_request { | |||
733 | * @assoc: Request to (re)associate with the specified peer | 834 | * @assoc: Request to (re)associate with the specified peer |
734 | * @deauth: Request to deauthenticate from the specified peer | 835 | * @deauth: Request to deauthenticate from the specified peer |
735 | * @disassoc: Request to disassociate from the specified peer | 836 | * @disassoc: Request to disassociate from the specified peer |
837 | * | ||
838 | * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call | ||
839 | * cfg80211_ibss_joined(), also call that function when changing BSSID due | ||
840 | * to a merge. | ||
841 | * @leave_ibss: Leave the IBSS. | ||
842 | * | ||
843 | * @set_wiphy_params: Notify that wiphy parameters have changed; | ||
844 | * @changed bitfield (see &enum wiphy_params_flags) describes which values | ||
845 | * have changed. The actual parameter values are available in | ||
846 | * struct wiphy. If returning an error, no value should be changed. | ||
736 | */ | 847 | */ |
737 | struct cfg80211_ops { | 848 | struct cfg80211_ops { |
738 | int (*suspend)(struct wiphy *wiphy); | 849 | int (*suspend)(struct wiphy *wiphy); |
@@ -818,9 +929,414 @@ struct cfg80211_ops { | |||
818 | struct cfg80211_deauth_request *req); | 929 | struct cfg80211_deauth_request *req); |
819 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, | 930 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, |
820 | struct cfg80211_disassoc_request *req); | 931 | struct cfg80211_disassoc_request *req); |
932 | |||
933 | int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, | ||
934 | struct cfg80211_ibss_params *params); | ||
935 | int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); | ||
936 | |||
937 | int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); | ||
938 | }; | ||
939 | |||
940 | /* | ||
941 | * wireless hardware and networking interfaces structures | ||
942 | * and registration/helper functions | ||
943 | */ | ||
944 | |||
945 | /** | ||
946 | * struct wiphy - wireless hardware description | ||
947 | * @idx: the wiphy index assigned to this item | ||
948 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
949 | * @custom_regulatory: tells us the driver for this device | ||
950 | * has its own custom regulatory domain and cannot identify the | ||
951 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | ||
952 | * we will disregard the first regulatory hint (when the | ||
953 | * initiator is %REGDOM_SET_BY_CORE). | ||
954 | * @strict_regulatory: tells us the driver for this device will ignore | ||
955 | * regulatory domain settings until it gets its own regulatory domain | ||
956 | * via its regulatory_hint(). After its gets its own regulatory domain | ||
957 | * it will only allow further regulatory domain settings to further | ||
958 | * enhance compliance. For example if channel 13 and 14 are disabled | ||
959 | * by this regulatory domain no user regulatory domain can enable these | ||
960 | * channels at a later time. This can be used for devices which do not | ||
961 | * have calibration information gauranteed for frequencies or settings | ||
962 | * outside of its regulatory domain. | ||
963 | * @reg_notifier: the driver's regulatory notification callback | ||
964 | * @regd: the driver's regulatory domain, if one was requested via | ||
965 | * the regulatory_hint() API. This can be used by the driver | ||
966 | * on the reg_notifier() if it chooses to ignore future | ||
967 | * regulatory domain changes caused by other drivers. | ||
968 | * @signal_type: signal type reported in &struct cfg80211_bss. | ||
969 | * @cipher_suites: supported cipher suites | ||
970 | * @n_cipher_suites: number of supported cipher suites | ||
971 | * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) | ||
972 | * @retry_long: Retry limit for long frames (dot11LongRetryLimit) | ||
973 | * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); | ||
974 | * -1 = fragmentation disabled, only odd values >= 256 used | ||
975 | * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled | ||
976 | */ | ||
977 | struct wiphy { | ||
978 | /* assign these fields before you register the wiphy */ | ||
979 | |||
980 | /* permanent MAC address */ | ||
981 | u8 perm_addr[ETH_ALEN]; | ||
982 | |||
983 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | ||
984 | u16 interface_modes; | ||
985 | |||
986 | bool custom_regulatory; | ||
987 | bool strict_regulatory; | ||
988 | |||
989 | enum cfg80211_signal_type signal_type; | ||
990 | |||
991 | int bss_priv_size; | ||
992 | u8 max_scan_ssids; | ||
993 | u16 max_scan_ie_len; | ||
994 | |||
995 | int n_cipher_suites; | ||
996 | const u32 *cipher_suites; | ||
997 | |||
998 | u8 retry_short; | ||
999 | u8 retry_long; | ||
1000 | u32 frag_threshold; | ||
1001 | u32 rts_threshold; | ||
1002 | |||
1003 | /* If multiple wiphys are registered and you're handed e.g. | ||
1004 | * a regular netdev with assigned ieee80211_ptr, you won't | ||
1005 | * know whether it points to a wiphy your driver has registered | ||
1006 | * or not. Assign this to something global to your driver to | ||
1007 | * help determine whether you own this wiphy or not. */ | ||
1008 | void *privid; | ||
1009 | |||
1010 | struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; | ||
1011 | |||
1012 | /* Lets us get back the wiphy on the callback */ | ||
1013 | int (*reg_notifier)(struct wiphy *wiphy, | ||
1014 | struct regulatory_request *request); | ||
1015 | |||
1016 | /* fields below are read-only, assigned by cfg80211 */ | ||
1017 | |||
1018 | const struct ieee80211_regdomain *regd; | ||
1019 | |||
1020 | /* the item in /sys/class/ieee80211/ points to this, | ||
1021 | * you need use set_wiphy_dev() (see below) */ | ||
1022 | struct device dev; | ||
1023 | |||
1024 | /* dir in debugfs: ieee80211/<wiphyname> */ | ||
1025 | struct dentry *debugfsdir; | ||
1026 | |||
1027 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
1028 | }; | ||
1029 | |||
1030 | /** | ||
1031 | * wiphy_priv - return priv from wiphy | ||
1032 | * | ||
1033 | * @wiphy: the wiphy whose priv pointer to return | ||
1034 | */ | ||
1035 | static inline void *wiphy_priv(struct wiphy *wiphy) | ||
1036 | { | ||
1037 | BUG_ON(!wiphy); | ||
1038 | return &wiphy->priv; | ||
1039 | } | ||
1040 | |||
1041 | /** | ||
1042 | * set_wiphy_dev - set device pointer for wiphy | ||
1043 | * | ||
1044 | * @wiphy: The wiphy whose device to bind | ||
1045 | * @dev: The device to parent it to | ||
1046 | */ | ||
1047 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | ||
1048 | { | ||
1049 | wiphy->dev.parent = dev; | ||
1050 | } | ||
1051 | |||
1052 | /** | ||
1053 | * wiphy_dev - get wiphy dev pointer | ||
1054 | * | ||
1055 | * @wiphy: The wiphy whose device struct to look up | ||
1056 | */ | ||
1057 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | ||
1058 | { | ||
1059 | return wiphy->dev.parent; | ||
1060 | } | ||
1061 | |||
1062 | /** | ||
1063 | * wiphy_name - get wiphy name | ||
1064 | * | ||
1065 | * @wiphy: The wiphy whose name to return | ||
1066 | */ | ||
1067 | static inline const char *wiphy_name(struct wiphy *wiphy) | ||
1068 | { | ||
1069 | return dev_name(&wiphy->dev); | ||
1070 | } | ||
1071 | |||
1072 | /** | ||
1073 | * wiphy_new - create a new wiphy for use with cfg80211 | ||
1074 | * | ||
1075 | * @ops: The configuration operations for this device | ||
1076 | * @sizeof_priv: The size of the private area to allocate | ||
1077 | * | ||
1078 | * Create a new wiphy and associate the given operations with it. | ||
1079 | * @sizeof_priv bytes are allocated for private use. | ||
1080 | * | ||
1081 | * The returned pointer must be assigned to each netdev's | ||
1082 | * ieee80211_ptr for proper operation. | ||
1083 | */ | ||
1084 | struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); | ||
1085 | |||
1086 | /** | ||
1087 | * wiphy_register - register a wiphy with cfg80211 | ||
1088 | * | ||
1089 | * @wiphy: The wiphy to register. | ||
1090 | * | ||
1091 | * Returns a non-negative wiphy index or a negative error code. | ||
1092 | */ | ||
1093 | extern int wiphy_register(struct wiphy *wiphy); | ||
1094 | |||
1095 | /** | ||
1096 | * wiphy_unregister - deregister a wiphy from cfg80211 | ||
1097 | * | ||
1098 | * @wiphy: The wiphy to unregister. | ||
1099 | * | ||
1100 | * After this call, no more requests can be made with this priv | ||
1101 | * pointer, but the call may sleep to wait for an outstanding | ||
1102 | * request that is being handled. | ||
1103 | */ | ||
1104 | extern void wiphy_unregister(struct wiphy *wiphy); | ||
1105 | |||
1106 | /** | ||
1107 | * wiphy_free - free wiphy | ||
1108 | * | ||
1109 | * @wiphy: The wiphy to free | ||
1110 | */ | ||
1111 | extern void wiphy_free(struct wiphy *wiphy); | ||
1112 | |||
1113 | /** | ||
1114 | * struct wireless_dev - wireless per-netdev state | ||
1115 | * | ||
1116 | * This structure must be allocated by the driver/stack | ||
1117 | * that uses the ieee80211_ptr field in struct net_device | ||
1118 | * (this is intentional so it can be allocated along with | ||
1119 | * the netdev.) | ||
1120 | * | ||
1121 | * @wiphy: pointer to hardware description | ||
1122 | * @iftype: interface type | ||
1123 | * @list: (private) Used to collect the interfaces | ||
1124 | * @netdev: (private) Used to reference back to the netdev | ||
1125 | * @current_bss: (private) Used by the internal configuration code | ||
1126 | * @bssid: (private) Used by the internal configuration code | ||
1127 | * @ssid: (private) Used by the internal configuration code | ||
1128 | * @ssid_len: (private) Used by the internal configuration code | ||
1129 | * @wext: (private) Used by the internal wireless extensions compat code | ||
1130 | * @wext_bssid: (private) Used by the internal wireless extensions compat code | ||
1131 | */ | ||
1132 | struct wireless_dev { | ||
1133 | struct wiphy *wiphy; | ||
1134 | enum nl80211_iftype iftype; | ||
1135 | |||
1136 | /* private to the generic wireless code */ | ||
1137 | struct list_head list; | ||
1138 | struct net_device *netdev; | ||
1139 | |||
1140 | /* currently used for IBSS - might be rearranged in the future */ | ||
1141 | struct cfg80211_bss *current_bss; | ||
1142 | u8 bssid[ETH_ALEN]; | ||
1143 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | ||
1144 | u8 ssid_len; | ||
1145 | |||
1146 | #ifdef CONFIG_WIRELESS_EXT | ||
1147 | /* wext data */ | ||
1148 | struct cfg80211_ibss_params wext; | ||
1149 | u8 wext_bssid[ETH_ALEN]; | ||
1150 | #endif | ||
1151 | }; | ||
1152 | |||
1153 | /** | ||
1154 | * wdev_priv - return wiphy priv from wireless_dev | ||
1155 | * | ||
1156 | * @wdev: The wireless device whose wiphy's priv pointer to return | ||
1157 | */ | ||
1158 | static inline void *wdev_priv(struct wireless_dev *wdev) | ||
1159 | { | ||
1160 | BUG_ON(!wdev); | ||
1161 | return wiphy_priv(wdev->wiphy); | ||
1162 | } | ||
1163 | |||
1164 | /* | ||
1165 | * Utility functions | ||
1166 | */ | ||
1167 | |||
1168 | /** | ||
1169 | * ieee80211_channel_to_frequency - convert channel number to frequency | ||
1170 | */ | ||
1171 | extern int ieee80211_channel_to_frequency(int chan); | ||
1172 | |||
1173 | /** | ||
1174 | * ieee80211_frequency_to_channel - convert frequency to channel number | ||
1175 | */ | ||
1176 | extern int ieee80211_frequency_to_channel(int freq); | ||
1177 | |||
1178 | /* | ||
1179 | * Name indirection necessary because the ieee80211 code also has | ||
1180 | * a function named "ieee80211_get_channel", so if you include | ||
1181 | * cfg80211's header file you get cfg80211's version, if you try | ||
1182 | * to include both header files you'll (rightfully!) get a symbol | ||
1183 | * clash. | ||
1184 | */ | ||
1185 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | ||
1186 | int freq); | ||
1187 | /** | ||
1188 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency | ||
1189 | */ | ||
1190 | static inline struct ieee80211_channel * | ||
1191 | ieee80211_get_channel(struct wiphy *wiphy, int freq) | ||
1192 | { | ||
1193 | return __ieee80211_get_channel(wiphy, freq); | ||
1194 | } | ||
1195 | |||
1196 | /** | ||
1197 | * ieee80211_get_response_rate - get basic rate for a given rate | ||
1198 | * | ||
1199 | * @sband: the band to look for rates in | ||
1200 | * @basic_rates: bitmap of basic rates | ||
1201 | * @bitrate: the bitrate for which to find the basic rate | ||
1202 | * | ||
1203 | * This function returns the basic rate corresponding to a given | ||
1204 | * bitrate, that is the next lower bitrate contained in the basic | ||
1205 | * rate map, which is, for this function, given as a bitmap of | ||
1206 | * indices of rates in the band's bitrate table. | ||
1207 | */ | ||
1208 | struct ieee80211_rate * | ||
1209 | ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | ||
1210 | u32 basic_rates, int bitrate); | ||
1211 | |||
1212 | /* | ||
1213 | * Radiotap parsing functions -- for controlled injection support | ||
1214 | * | ||
1215 | * Implemented in net/wireless/radiotap.c | ||
1216 | * Documentation in Documentation/networking/radiotap-headers.txt | ||
1217 | */ | ||
1218 | |||
1219 | /** | ||
1220 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args | ||
1221 | * @rtheader: pointer to the radiotap header we are walking through | ||
1222 | * @max_length: length of radiotap header in cpu byte ordering | ||
1223 | * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg | ||
1224 | * @this_arg: pointer to current radiotap arg | ||
1225 | * @arg_index: internal next argument index | ||
1226 | * @arg: internal next argument pointer | ||
1227 | * @next_bitmap: internal pointer to next present u32 | ||
1228 | * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present | ||
1229 | */ | ||
1230 | |||
1231 | struct ieee80211_radiotap_iterator { | ||
1232 | struct ieee80211_radiotap_header *rtheader; | ||
1233 | int max_length; | ||
1234 | int this_arg_index; | ||
1235 | u8 *this_arg; | ||
1236 | |||
1237 | int arg_index; | ||
1238 | u8 *arg; | ||
1239 | __le32 *next_bitmap; | ||
1240 | u32 bitmap_shifter; | ||
821 | }; | 1241 | }; |
822 | 1242 | ||
823 | /* temporary wext handlers */ | 1243 | extern int ieee80211_radiotap_iterator_init( |
1244 | struct ieee80211_radiotap_iterator *iterator, | ||
1245 | struct ieee80211_radiotap_header *radiotap_header, | ||
1246 | int max_length); | ||
1247 | |||
1248 | extern int ieee80211_radiotap_iterator_next( | ||
1249 | struct ieee80211_radiotap_iterator *iterator); | ||
1250 | |||
1251 | /* | ||
1252 | * Regulatory helper functions for wiphys | ||
1253 | */ | ||
1254 | |||
1255 | /** | ||
1256 | * regulatory_hint - driver hint to the wireless core a regulatory domain | ||
1257 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
1258 | * conflicts) | ||
1259 | * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain | ||
1260 | * should be in. If @rd is set this should be NULL. Note that if you | ||
1261 | * set this to NULL you should still set rd->alpha2 to some accepted | ||
1262 | * alpha2. | ||
1263 | * | ||
1264 | * Wireless drivers can use this function to hint to the wireless core | ||
1265 | * what it believes should be the current regulatory domain by | ||
1266 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
1267 | * domain should be in or by providing a completely build regulatory domain. | ||
1268 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | ||
1269 | * for a regulatory domain structure for the respective country. | ||
1270 | * | ||
1271 | * The wiphy must have been registered to cfg80211 prior to this call. | ||
1272 | * For cfg80211 drivers this means you must first use wiphy_register(), | ||
1273 | * for mac80211 drivers you must first use ieee80211_register_hw(). | ||
1274 | * | ||
1275 | * Drivers should check the return value, its possible you can get | ||
1276 | * an -ENOMEM. | ||
1277 | */ | ||
1278 | extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); | ||
1279 | |||
1280 | /** | ||
1281 | * regulatory_hint_11d - hints a country IE as a regulatory domain | ||
1282 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
1283 | * conflicts) | ||
1284 | * @country_ie: pointer to the country IE | ||
1285 | * @country_ie_len: length of the country IE | ||
1286 | * | ||
1287 | * We will intersect the rd with the what CRDA tells us should apply | ||
1288 | * for the alpha2 this country IE belongs to, this prevents APs from | ||
1289 | * sending us incorrect or outdated information against a country. | ||
1290 | */ | ||
1291 | extern void regulatory_hint_11d(struct wiphy *wiphy, | ||
1292 | u8 *country_ie, | ||
1293 | u8 country_ie_len); | ||
1294 | /** | ||
1295 | * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain | ||
1296 | * @wiphy: the wireless device we want to process the regulatory domain on | ||
1297 | * @regd: the custom regulatory domain to use for this wiphy | ||
1298 | * | ||
1299 | * Drivers can sometimes have custom regulatory domains which do not apply | ||
1300 | * to a specific country. Drivers can use this to apply such custom regulatory | ||
1301 | * domains. This routine must be called prior to wiphy registration. The | ||
1302 | * custom regulatory domain will be trusted completely and as such previous | ||
1303 | * default channel settings will be disregarded. If no rule is found for a | ||
1304 | * channel on the regulatory domain the channel will be disabled. | ||
1305 | */ | ||
1306 | extern void wiphy_apply_custom_regulatory( | ||
1307 | struct wiphy *wiphy, | ||
1308 | const struct ieee80211_regdomain *regd); | ||
1309 | |||
1310 | /** | ||
1311 | * freq_reg_info - get regulatory information for the given frequency | ||
1312 | * @wiphy: the wiphy for which we want to process this rule for | ||
1313 | * @center_freq: Frequency in KHz for which we want regulatory information for | ||
1314 | * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one | ||
1315 | * you can set this to 0. If this frequency is allowed we then set | ||
1316 | * this value to the maximum allowed bandwidth. | ||
1317 | * @reg_rule: the regulatory rule which we have for this frequency | ||
1318 | * | ||
1319 | * Use this function to get the regulatory rule for a specific frequency on | ||
1320 | * a given wireless device. If the device has a specific regulatory domain | ||
1321 | * it wants to follow we respect that unless a country IE has been received | ||
1322 | * and processed already. | ||
1323 | * | ||
1324 | * Returns 0 if it was able to find a valid regulatory rule which does | ||
1325 | * apply to the given center_freq otherwise it returns non-zero. It will | ||
1326 | * also return -ERANGE if we determine the given center_freq does not even have | ||
1327 | * a regulatory rule for a frequency range in the center_freq's band. See | ||
1328 | * freq_in_rule_band() for our current definition of a band -- this is purely | ||
1329 | * subjective and right now its 802.11 specific. | ||
1330 | */ | ||
1331 | extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth, | ||
1332 | const struct ieee80211_reg_rule **reg_rule); | ||
1333 | |||
1334 | /* | ||
1335 | * Temporary wext handlers & helper functions | ||
1336 | * | ||
1337 | * In the future cfg80211 will simply assign the entire wext handler | ||
1338 | * structure to netdevs it manages, but we're not there yet. | ||
1339 | */ | ||
824 | int cfg80211_wext_giwname(struct net_device *dev, | 1340 | int cfg80211_wext_giwname(struct net_device *dev, |
825 | struct iw_request_info *info, | 1341 | struct iw_request_info *info, |
826 | char *name, char *extra); | 1342 | char *name, char *extra); |
@@ -834,9 +1350,57 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
834 | int cfg80211_wext_giwscan(struct net_device *dev, | 1350 | int cfg80211_wext_giwscan(struct net_device *dev, |
835 | struct iw_request_info *info, | 1351 | struct iw_request_info *info, |
836 | struct iw_point *data, char *extra); | 1352 | struct iw_point *data, char *extra); |
1353 | int cfg80211_wext_siwmlme(struct net_device *dev, | ||
1354 | struct iw_request_info *info, | ||
1355 | struct iw_point *data, char *extra); | ||
837 | int cfg80211_wext_giwrange(struct net_device *dev, | 1356 | int cfg80211_wext_giwrange(struct net_device *dev, |
838 | struct iw_request_info *info, | 1357 | struct iw_request_info *info, |
839 | struct iw_point *data, char *extra); | 1358 | struct iw_point *data, char *extra); |
1359 | int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | ||
1360 | struct iw_request_info *info, | ||
1361 | struct iw_freq *freq, char *extra); | ||
1362 | int cfg80211_ibss_wext_giwfreq(struct net_device *dev, | ||
1363 | struct iw_request_info *info, | ||
1364 | struct iw_freq *freq, char *extra); | ||
1365 | int cfg80211_ibss_wext_siwessid(struct net_device *dev, | ||
1366 | struct iw_request_info *info, | ||
1367 | struct iw_point *data, char *ssid); | ||
1368 | int cfg80211_ibss_wext_giwessid(struct net_device *dev, | ||
1369 | struct iw_request_info *info, | ||
1370 | struct iw_point *data, char *ssid); | ||
1371 | int cfg80211_ibss_wext_siwap(struct net_device *dev, | ||
1372 | struct iw_request_info *info, | ||
1373 | struct sockaddr *ap_addr, char *extra); | ||
1374 | int cfg80211_ibss_wext_giwap(struct net_device *dev, | ||
1375 | struct iw_request_info *info, | ||
1376 | struct sockaddr *ap_addr, char *extra); | ||
1377 | |||
1378 | struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, | ||
1379 | struct iw_freq *freq); | ||
1380 | |||
1381 | int cfg80211_wext_siwrts(struct net_device *dev, | ||
1382 | struct iw_request_info *info, | ||
1383 | struct iw_param *rts, char *extra); | ||
1384 | int cfg80211_wext_giwrts(struct net_device *dev, | ||
1385 | struct iw_request_info *info, | ||
1386 | struct iw_param *rts, char *extra); | ||
1387 | int cfg80211_wext_siwfrag(struct net_device *dev, | ||
1388 | struct iw_request_info *info, | ||
1389 | struct iw_param *frag, char *extra); | ||
1390 | int cfg80211_wext_giwfrag(struct net_device *dev, | ||
1391 | struct iw_request_info *info, | ||
1392 | struct iw_param *frag, char *extra); | ||
1393 | int cfg80211_wext_siwretry(struct net_device *dev, | ||
1394 | struct iw_request_info *info, | ||
1395 | struct iw_param *retry, char *extra); | ||
1396 | int cfg80211_wext_giwretry(struct net_device *dev, | ||
1397 | struct iw_request_info *info, | ||
1398 | struct iw_param *retry, char *extra); | ||
1399 | |||
1400 | /* | ||
1401 | * callbacks for asynchronous cfg80211 methods, notification | ||
1402 | * functions and BSS handling helpers | ||
1403 | */ | ||
840 | 1404 | ||
841 | /** | 1405 | /** |
842 | * cfg80211_scan_done - notify that scan finished | 1406 | * cfg80211_scan_done - notify that scan finished |
@@ -864,6 +1428,14 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
864 | struct ieee80211_mgmt *mgmt, size_t len, | 1428 | struct ieee80211_mgmt *mgmt, size_t len, |
865 | s32 signal, gfp_t gfp); | 1429 | s32 signal, gfp_t gfp); |
866 | 1430 | ||
1431 | struct cfg80211_bss* | ||
1432 | cfg80211_inform_bss(struct wiphy *wiphy, | ||
1433 | struct ieee80211_channel *channel, | ||
1434 | const u8 *bssid, | ||
1435 | u64 timestamp, u16 capability, u16 beacon_interval, | ||
1436 | const u8 *ie, size_t ielen, | ||
1437 | s32 signal, gfp_t gfp); | ||
1438 | |||
867 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 1439 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
868 | struct ieee80211_channel *channel, | 1440 | struct ieee80211_channel *channel, |
869 | const u8 *bssid, | 1441 | const u8 *bssid, |
@@ -883,6 +1455,7 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, | |||
883 | const u8 *meshid, size_t meshidlen, | 1455 | const u8 *meshid, size_t meshidlen, |
884 | const u8 *meshcfg); | 1456 | const u8 *meshcfg); |
885 | void cfg80211_put_bss(struct cfg80211_bss *bss); | 1457 | void cfg80211_put_bss(struct cfg80211_bss *bss); |
1458 | |||
886 | /** | 1459 | /** |
887 | * cfg80211_unlink_bss - unlink BSS from internal data structures | 1460 | * cfg80211_unlink_bss - unlink BSS from internal data structures |
888 | * @wiphy: the wiphy | 1461 | * @wiphy: the wiphy |
@@ -902,44 +1475,62 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | |||
902 | * @len: length of the frame data | 1475 | * @len: length of the frame data |
903 | * | 1476 | * |
904 | * This function is called whenever an authentication has been processed in | 1477 | * This function is called whenever an authentication has been processed in |
905 | * station mode. | 1478 | * station mode. The driver is required to call either this function or |
1479 | * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() | ||
1480 | * call. | ||
906 | */ | 1481 | */ |
907 | void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); | 1482 | void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); |
908 | 1483 | ||
909 | /** | 1484 | /** |
1485 | * cfg80211_send_auth_timeout - notification of timed out authentication | ||
1486 | * @dev: network device | ||
1487 | * @addr: The MAC address of the device with which the authentication timed out | ||
1488 | */ | ||
1489 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); | ||
1490 | |||
1491 | /** | ||
910 | * cfg80211_send_rx_assoc - notification of processed association | 1492 | * cfg80211_send_rx_assoc - notification of processed association |
911 | * @dev: network device | 1493 | * @dev: network device |
912 | * @buf: (re)association response frame (header + body) | 1494 | * @buf: (re)association response frame (header + body) |
913 | * @len: length of the frame data | 1495 | * @len: length of the frame data |
914 | * | 1496 | * |
915 | * This function is called whenever a (re)association response has been | 1497 | * This function is called whenever a (re)association response has been |
916 | * processed in station mode. | 1498 | * processed in station mode. The driver is required to call either this |
1499 | * function or cfg80211_send_assoc_timeout() to indicate the result of | ||
1500 | * cfg80211_ops::assoc() call. | ||
917 | */ | 1501 | */ |
918 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); | 1502 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); |
919 | 1503 | ||
920 | /** | 1504 | /** |
921 | * cfg80211_send_rx_deauth - notification of processed deauthentication | 1505 | * cfg80211_send_assoc_timeout - notification of timed out association |
1506 | * @dev: network device | ||
1507 | * @addr: The MAC address of the device with which the association timed out | ||
1508 | */ | ||
1509 | void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); | ||
1510 | |||
1511 | /** | ||
1512 | * cfg80211_send_deauth - notification of processed deauthentication | ||
922 | * @dev: network device | 1513 | * @dev: network device |
923 | * @buf: deauthentication frame (header + body) | 1514 | * @buf: deauthentication frame (header + body) |
924 | * @len: length of the frame data | 1515 | * @len: length of the frame data |
925 | * | 1516 | * |
926 | * This function is called whenever deauthentication has been processed in | 1517 | * This function is called whenever deauthentication has been processed in |
927 | * station mode. | 1518 | * station mode. This includes both received deauthentication frames and |
1519 | * locally generated ones. | ||
928 | */ | 1520 | */ |
929 | void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf, | 1521 | void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); |
930 | size_t len); | ||
931 | 1522 | ||
932 | /** | 1523 | /** |
933 | * cfg80211_send_rx_disassoc - notification of processed disassociation | 1524 | * cfg80211_send_disassoc - notification of processed disassociation |
934 | * @dev: network device | 1525 | * @dev: network device |
935 | * @buf: disassociation response frame (header + body) | 1526 | * @buf: disassociation response frame (header + body) |
936 | * @len: length of the frame data | 1527 | * @len: length of the frame data |
937 | * | 1528 | * |
938 | * This function is called whenever disassociation has been processed in | 1529 | * This function is called whenever disassociation has been processed in |
939 | * station mode. | 1530 | * station mode. This includes both received disassociation frames and locally |
1531 | * generated ones. | ||
940 | */ | 1532 | */ |
941 | void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf, | 1533 | void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); |
942 | size_t len); | ||
943 | 1534 | ||
944 | /** | 1535 | /** |
945 | * cfg80211_hold_bss - exclude bss from expiration | 1536 | * cfg80211_hold_bss - exclude bss from expiration |
@@ -958,4 +1549,36 @@ void cfg80211_hold_bss(struct cfg80211_bss *bss); | |||
958 | */ | 1549 | */ |
959 | void cfg80211_unhold_bss(struct cfg80211_bss *bss); | 1550 | void cfg80211_unhold_bss(struct cfg80211_bss *bss); |
960 | 1551 | ||
1552 | /** | ||
1553 | * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) | ||
1554 | * @dev: network device | ||
1555 | * @addr: The source MAC address of the frame | ||
1556 | * @key_type: The key type that the received frame used | ||
1557 | * @key_id: Key identifier (0..3) | ||
1558 | * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) | ||
1559 | * | ||
1560 | * This function is called whenever the local MAC detects a MIC failure in a | ||
1561 | * received frame. This matches with MLME-MICHAELMICFAILURE.indication() | ||
1562 | * primitive. | ||
1563 | */ | ||
1564 | void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | ||
1565 | enum nl80211_key_type key_type, int key_id, | ||
1566 | const u8 *tsc); | ||
1567 | |||
1568 | /** | ||
1569 | * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS | ||
1570 | * | ||
1571 | * @dev: network device | ||
1572 | * @bssid: the BSSID of the IBSS joined | ||
1573 | * @gfp: allocation flags | ||
1574 | * | ||
1575 | * This function notifies cfg80211 that the device joined an IBSS or | ||
1576 | * switched to a different BSSID. Before this function can be called, | ||
1577 | * either a beacon has to have been received from the IBSS, or one of | ||
1578 | * the cfg80211_inform_bss{,_frame} functions must have been called | ||
1579 | * with the locally generated beacon -- this guarantees that there is | ||
1580 | * always a scan result for this IBSS. cfg80211 will handle the rest. | ||
1581 | */ | ||
1582 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); | ||
1583 | |||
961 | #endif /* __NET_CFG80211_H */ | 1584 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 3b83a80e3fe0..446dbf75a1c5 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/wireless.h> | 19 | #include <linux/wireless.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/ieee80211.h> | 21 | #include <linux/ieee80211.h> |
22 | #include <net/wireless.h> | ||
23 | #include <net/cfg80211.h> | 22 | #include <net/cfg80211.h> |
24 | 23 | ||
25 | /** | 24 | /** |
@@ -518,7 +517,7 @@ struct ieee80211_rx_status { | |||
518 | * Flags to define PHY configuration options | 517 | * Flags to define PHY configuration options |
519 | * | 518 | * |
520 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 519 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) |
521 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode | 520 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) |
522 | */ | 521 | */ |
523 | enum ieee80211_conf_flags { | 522 | enum ieee80211_conf_flags { |
524 | IEEE80211_CONF_RADIOTAP = (1<<0), | 523 | IEEE80211_CONF_RADIOTAP = (1<<0), |
@@ -533,8 +532,7 @@ enum ieee80211_conf_flags { | |||
533 | * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed | 532 | * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed |
534 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed | 533 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed |
535 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed | 534 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed |
536 | * @IEEE80211_CONF_CHANGE_PS: the PS flag changed | 535 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed |
537 | * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed | ||
538 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed | 536 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed |
539 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed | 537 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed |
540 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed | 538 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed |
@@ -545,10 +543,9 @@ enum ieee80211_conf_changed { | |||
545 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), | 543 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), |
546 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), | 544 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), |
547 | IEEE80211_CONF_CHANGE_PS = BIT(4), | 545 | IEEE80211_CONF_CHANGE_PS = BIT(4), |
548 | IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5), | 546 | IEEE80211_CONF_CHANGE_POWER = BIT(5), |
549 | IEEE80211_CONF_CHANGE_POWER = BIT(6), | 547 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), |
550 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(7), | 548 | IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), |
551 | IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8), | ||
552 | }; | 549 | }; |
553 | 550 | ||
554 | /** | 551 | /** |
@@ -556,14 +553,26 @@ enum ieee80211_conf_changed { | |||
556 | * | 553 | * |
557 | * This struct indicates how the driver shall configure the hardware. | 554 | * This struct indicates how the driver shall configure the hardware. |
558 | * | 555 | * |
556 | * @flags: configuration flags defined above | ||
557 | * | ||
559 | * @radio_enabled: when zero, driver is required to switch off the radio. | 558 | * @radio_enabled: when zero, driver is required to switch off the radio. |
560 | * @beacon_int: beacon interval (TODO make interface config) | 559 | * @beacon_int: beacon interval (TODO make interface config) |
560 | * | ||
561 | * @listen_interval: listen interval in units of beacon interval | 561 | * @listen_interval: listen interval in units of beacon interval |
562 | * @flags: configuration flags defined above | 562 | * @max_sleep_interval: the maximum number of beacon intervals to sleep for |
563 | * before checking the beacon for a TIM bit (managed mode only); this | ||
564 | * value will be only achievable between DTIM frames, the hardware | ||
565 | * needs to check for the multicast traffic bit in DTIM beacons. | ||
566 | * This variable is valid only when the CONF_PS flag is set. | ||
567 | * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the | ||
568 | * powersave documentation below. This variable is valid only when | ||
569 | * the CONF_PS flag is set. | ||
570 | * | ||
563 | * @power_level: requested transmit power (in dBm) | 571 | * @power_level: requested transmit power (in dBm) |
564 | * @dynamic_ps_timeout: dynamic powersave timeout (in ms) | 572 | * |
565 | * @channel: the channel to tune to | 573 | * @channel: the channel to tune to |
566 | * @channel_type: the channel (HT) type | 574 | * @channel_type: the channel (HT) type |
575 | * | ||
567 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame | 576 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame |
568 | * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, | 577 | * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, |
569 | * but actually means the number of transmissions not the number of retries | 578 | * but actually means the number of transmissions not the number of retries |
@@ -575,6 +584,7 @@ struct ieee80211_conf { | |||
575 | int beacon_int; | 584 | int beacon_int; |
576 | u32 flags; | 585 | u32 flags; |
577 | int power_level, dynamic_ps_timeout; | 586 | int power_level, dynamic_ps_timeout; |
587 | int max_sleep_interval; | ||
578 | 588 | ||
579 | u16 listen_interval; | 589 | u16 listen_interval; |
580 | bool radio_enabled; | 590 | bool radio_enabled; |
@@ -1109,11 +1119,9 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1109 | * need software support for parsing the TIM bitmap. This is also supported | 1119 | * need software support for parsing the TIM bitmap. This is also supported |
1110 | * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and | 1120 | * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and |
1111 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still | 1121 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still |
1112 | * required to pass up beacons. Additionally, in this case, mac80211 will | 1122 | * required to pass up beacons. The hardware is still required to handle |
1113 | * wake up the hardware when multicast traffic is announced in the beacon. | 1123 | * waking up for multicast traffic; if it cannot the driver must handle that |
1114 | * | 1124 | * as best as it can, mac80211 is too slow. |
1115 | * FIXME: I don't think we can be fast enough in software when we want to | ||
1116 | * receive multicast traffic? | ||
1117 | * | 1125 | * |
1118 | * Dynamic powersave mode is an extension to normal powersave mode in which | 1126 | * Dynamic powersave mode is an extension to normal powersave mode in which |
1119 | * the hardware stays awake for a user-specified period of time after sending | 1127 | * the hardware stays awake for a user-specified period of time after sending |
@@ -1134,11 +1142,53 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1134 | * way the host will only receive beacons where some relevant information | 1142 | * way the host will only receive beacons where some relevant information |
1135 | * (for example ERP protection or WMM settings) have changed. | 1143 | * (for example ERP protection or WMM settings) have changed. |
1136 | * | 1144 | * |
1137 | * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag. | 1145 | * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER |
1138 | * The driver needs to enable beacon filter support whenever power save is | 1146 | * hardware capability. The driver needs to enable beacon filter support |
1139 | * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled, | 1147 | * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When |
1140 | * the stack will not check for beacon miss at all and the driver needs to | 1148 | * power save is enabled, the stack will not check for beacon loss and the |
1141 | * notify about complete loss of beacons with ieee80211_beacon_loss(). | 1149 | * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). |
1150 | * | ||
1151 | * The time (or number of beacons missed) until the firmware notifies the | ||
1152 | * driver of a beacon loss event (which in turn causes the driver to call | ||
1153 | * ieee80211_beacon_loss()) should be configurable and will be controlled | ||
1154 | * by mac80211 and the roaming algorithm in the future. | ||
1155 | * | ||
1156 | * Since there may be constantly changing information elements that nothing | ||
1157 | * in the software stack cares about, we will, in the future, have mac80211 | ||
1158 | * tell the driver which information elements are interesting in the sense | ||
1159 | * that we want to see changes in them. This will include | ||
1160 | * - a list of information element IDs | ||
1161 | * - a list of OUIs for the vendor information element | ||
1162 | * | ||
1163 | * Ideally, the hardware would filter out any beacons without changes in the | ||
1164 | * requested elements, but if it cannot support that it may, at the expense | ||
1165 | * of some efficiency, filter out only a subset. For example, if the device | ||
1166 | * doesn't support checking for OUIs it should pass up all changes in all | ||
1167 | * vendor information elements. | ||
1168 | * | ||
1169 | * Note that change, for the sake of simplification, also includes information | ||
1170 | * elements appearing or disappearing from the beacon. | ||
1171 | * | ||
1172 | * Some hardware supports an "ignore list" instead, just make sure nothing | ||
1173 | * that was requested is on the ignore list, and include commonly changing | ||
1174 | * information element IDs in the ignore list, for example 11 (BSS load) and | ||
1175 | * the various vendor-assigned IEs with unknown contents (128, 129, 133-136, | ||
1176 | * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility | ||
1177 | * it could also include some currently unused IDs. | ||
1178 | * | ||
1179 | * | ||
1180 | * In addition to these capabilities, hardware should support notifying the | ||
1181 | * host of changes in the beacon RSSI. This is relevant to implement roaming | ||
1182 | * when no traffic is flowing (when traffic is flowing we see the RSSI of | ||
1183 | * the received data packets). This can consist in notifying the host when | ||
1184 | * the RSSI changes significantly or when it drops below or rises above | ||
1185 | * configurable thresholds. In the future these thresholds will also be | ||
1186 | * configured by mac80211 (which gets them from userspace) to implement | ||
1187 | * them as the roaming algorithm requires. | ||
1188 | * | ||
1189 | * If the hardware cannot implement this, the driver should ask it to | ||
1190 | * periodically pass beacon frames to the host so that software can do the | ||
1191 | * signal strength threshold checking. | ||
1142 | */ | 1192 | */ |
1143 | 1193 | ||
1144 | /** | 1194 | /** |
@@ -1330,11 +1380,14 @@ enum ieee80211_ampdu_mlme_action { | |||
1330 | * the scan state machine in stack. The scan must honour the channel | 1380 | * the scan state machine in stack. The scan must honour the channel |
1331 | * configuration done by the regulatory agent in the wiphy's | 1381 | * configuration done by the regulatory agent in the wiphy's |
1332 | * registered bands. The hardware (or the driver) needs to make sure | 1382 | * registered bands. The hardware (or the driver) needs to make sure |
1333 | * that power save is disabled. When the scan finishes, | 1383 | * that power save is disabled. |
1334 | * ieee80211_scan_completed() must be called; note that it also must | 1384 | * The @req ie/ie_len members are rewritten by mac80211 to contain the |
1335 | * be called when the scan cannot finish because the hardware is | 1385 | * entire IEs after the SSID, so that drivers need not look at these |
1336 | * turned off! Anything else is a bug! Returns a negative error code | 1386 | * at all but just send them after the SSID -- mac80211 includes the |
1337 | * which will be seen in userspace. | 1387 | * (extended) supported rates and HT information (where applicable). |
1388 | * When the scan finishes, ieee80211_scan_completed() must be called; | ||
1389 | * note that it also must be called when the scan cannot finish due to | ||
1390 | * any error unless this callback returned a negative error code. | ||
1338 | * | 1391 | * |
1339 | * @sw_scan_start: Notifier function that is called just before a software scan | 1392 | * @sw_scan_start: Notifier function that is called just before a software scan |
1340 | * is started. Can be NULL, if the driver doesn't need this notification. | 1393 | * is started. Can be NULL, if the driver doesn't need this notification. |
@@ -1572,6 +1625,20 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw); | |||
1572 | */ | 1625 | */ |
1573 | void ieee80211_free_hw(struct ieee80211_hw *hw); | 1626 | void ieee80211_free_hw(struct ieee80211_hw *hw); |
1574 | 1627 | ||
1628 | /** | ||
1629 | * ieee80211_restart_hw - restart hardware completely | ||
1630 | * | ||
1631 | * Call this function when the hardware was restarted for some reason | ||
1632 | * (hardware error, ...) and the driver is unable to restore its state | ||
1633 | * by itself. mac80211 assumes that at this point the driver/hardware | ||
1634 | * is completely uninitialised and stopped, it starts the process by | ||
1635 | * calling the ->start() operation. The driver will need to reset all | ||
1636 | * internal state that it has prior to calling this function. | ||
1637 | * | ||
1638 | * @hw: the hardware to restart | ||
1639 | */ | ||
1640 | void ieee80211_restart_hw(struct ieee80211_hw *hw); | ||
1641 | |||
1575 | /* trick to avoid symbol clashes with the ieee80211 subsystem */ | 1642 | /* trick to avoid symbol clashes with the ieee80211 subsystem */ |
1576 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | 1643 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, |
1577 | struct ieee80211_rx_status *status); | 1644 | struct ieee80211_rx_status *status); |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h new file mode 100644 index 000000000000..47995b81c5d7 --- /dev/null +++ b/include/net/regulatory.h | |||
@@ -0,0 +1,101 @@ | |||
1 | #ifndef __NET_REGULATORY_H | ||
2 | #define __NET_REGULATORY_H | ||
3 | /* | ||
4 | * regulatory support structures | ||
5 | * | ||
6 | * Copyright 2008-2009 Luis R. Rodriguez <lrodriguez@atheros.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | |||
14 | /** | ||
15 | * enum environment_cap - Environment parsed from country IE | ||
16 | * @ENVIRON_ANY: indicates country IE applies to both indoor and | ||
17 | * outdoor operation. | ||
18 | * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation | ||
19 | * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation | ||
20 | */ | ||
21 | enum environment_cap { | ||
22 | ENVIRON_ANY, | ||
23 | ENVIRON_INDOOR, | ||
24 | ENVIRON_OUTDOOR, | ||
25 | }; | ||
26 | |||
27 | /** | ||
28 | * struct regulatory_request - used to keep track of regulatory requests | ||
29 | * | ||
30 | * @wiphy_idx: this is set if this request's initiator is | ||
31 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | ||
32 | * can be used by the wireless core to deal with conflicts | ||
33 | * and potentially inform users of which devices specifically | ||
34 | * cased the conflicts. | ||
35 | * @initiator: indicates who sent this request, could be any of | ||
36 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) | ||
37 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | ||
38 | * regulatory domain. We have a few special codes: | ||
39 | * 00 - World regulatory domain | ||
40 | * 99 - built by driver but a specific alpha2 cannot be determined | ||
41 | * 98 - result of an intersection between two regulatory domains | ||
42 | * @intersect: indicates whether the wireless core should intersect | ||
43 | * the requested regulatory domain with the presently set regulatory | ||
44 | * domain. | ||
45 | * @country_ie_checksum: checksum of the last processed and accepted | ||
46 | * country IE | ||
47 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, | ||
48 | * indoor, or if it doesn't matter | ||
49 | * @list: used to insert into the reg_requests_list linked list | ||
50 | */ | ||
51 | struct regulatory_request { | ||
52 | int wiphy_idx; | ||
53 | enum nl80211_reg_initiator initiator; | ||
54 | char alpha2[2]; | ||
55 | bool intersect; | ||
56 | u32 country_ie_checksum; | ||
57 | enum environment_cap country_ie_env; | ||
58 | struct list_head list; | ||
59 | }; | ||
60 | |||
61 | struct ieee80211_freq_range { | ||
62 | u32 start_freq_khz; | ||
63 | u32 end_freq_khz; | ||
64 | u32 max_bandwidth_khz; | ||
65 | }; | ||
66 | |||
67 | struct ieee80211_power_rule { | ||
68 | u32 max_antenna_gain; | ||
69 | u32 max_eirp; | ||
70 | }; | ||
71 | |||
72 | struct ieee80211_reg_rule { | ||
73 | struct ieee80211_freq_range freq_range; | ||
74 | struct ieee80211_power_rule power_rule; | ||
75 | u32 flags; | ||
76 | }; | ||
77 | |||
78 | struct ieee80211_regdomain { | ||
79 | u32 n_reg_rules; | ||
80 | char alpha2[2]; | ||
81 | struct ieee80211_reg_rule reg_rules[]; | ||
82 | }; | ||
83 | |||
84 | #define MHZ_TO_KHZ(freq) ((freq) * 1000) | ||
85 | #define KHZ_TO_MHZ(freq) ((freq) / 1000) | ||
86 | #define DBI_TO_MBI(gain) ((gain) * 100) | ||
87 | #define MBI_TO_DBI(gain) ((gain) / 100) | ||
88 | #define DBM_TO_MBM(gain) ((gain) * 100) | ||
89 | #define MBM_TO_DBM(gain) ((gain) / 100) | ||
90 | |||
91 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ | ||
92 | { \ | ||
93 | .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ | ||
94 | .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ | ||
95 | .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ | ||
96 | .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\ | ||
97 | .power_rule.max_eirp = DBM_TO_MBM(eirp), \ | ||
98 | .flags = reg_flags, \ | ||
99 | } | ||
100 | |||
101 | #endif | ||
diff --git a/include/net/wireless.h b/include/net/wireless.h deleted file mode 100644 index 64a76208580c..000000000000 --- a/include/net/wireless.h +++ /dev/null | |||
@@ -1,472 +0,0 @@ | |||
1 | #ifndef __NET_WIRELESS_H | ||
2 | #define __NET_WIRELESS_H | ||
3 | |||
4 | /* | ||
5 | * 802.11 device management | ||
6 | * | ||
7 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
8 | */ | ||
9 | |||
10 | #include <linux/netdevice.h> | ||
11 | #include <linux/debugfs.h> | ||
12 | #include <linux/list.h> | ||
13 | #include <linux/ieee80211.h> | ||
14 | #include <net/cfg80211.h> | ||
15 | |||
16 | /** | ||
17 | * enum ieee80211_band - supported frequency bands | ||
18 | * | ||
19 | * The bands are assigned this way because the supported | ||
20 | * bitrates differ in these bands. | ||
21 | * | ||
22 | * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band | ||
23 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | ||
24 | */ | ||
25 | enum ieee80211_band { | ||
26 | IEEE80211_BAND_2GHZ, | ||
27 | IEEE80211_BAND_5GHZ, | ||
28 | |||
29 | /* keep last */ | ||
30 | IEEE80211_NUM_BANDS | ||
31 | }; | ||
32 | |||
33 | /** | ||
34 | * enum ieee80211_channel_flags - channel flags | ||
35 | * | ||
36 | * Channel flags set by the regulatory control code. | ||
37 | * | ||
38 | * @IEEE80211_CHAN_DISABLED: This channel is disabled. | ||
39 | * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted | ||
40 | * on this channel. | ||
41 | * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. | ||
42 | * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. | ||
43 | * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel | ||
44 | * is not permitted. | ||
45 | * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel | ||
46 | * is not permitted. | ||
47 | */ | ||
48 | enum ieee80211_channel_flags { | ||
49 | IEEE80211_CHAN_DISABLED = 1<<0, | ||
50 | IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, | ||
51 | IEEE80211_CHAN_NO_IBSS = 1<<2, | ||
52 | IEEE80211_CHAN_RADAR = 1<<3, | ||
53 | IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4, | ||
54 | IEEE80211_CHAN_NO_FAT_BELOW = 1<<5, | ||
55 | }; | ||
56 | |||
57 | /** | ||
58 | * struct ieee80211_channel - channel definition | ||
59 | * | ||
60 | * This structure describes a single channel for use | ||
61 | * with cfg80211. | ||
62 | * | ||
63 | * @center_freq: center frequency in MHz | ||
64 | * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz | ||
65 | * @hw_value: hardware-specific value for the channel | ||
66 | * @flags: channel flags from &enum ieee80211_channel_flags. | ||
67 | * @orig_flags: channel flags at registration time, used by regulatory | ||
68 | * code to support devices with additional restrictions | ||
69 | * @band: band this channel belongs to. | ||
70 | * @max_antenna_gain: maximum antenna gain in dBi | ||
71 | * @max_power: maximum transmission power (in dBm) | ||
72 | * @beacon_found: helper to regulatory code to indicate when a beacon | ||
73 | * has been found on this channel. Use regulatory_hint_found_beacon() | ||
74 | * to enable this, this is is useful only on 5 GHz band. | ||
75 | * @orig_mag: internal use | ||
76 | * @orig_mpwr: internal use | ||
77 | */ | ||
78 | struct ieee80211_channel { | ||
79 | enum ieee80211_band band; | ||
80 | u16 center_freq; | ||
81 | u8 max_bandwidth; | ||
82 | u16 hw_value; | ||
83 | u32 flags; | ||
84 | int max_antenna_gain; | ||
85 | int max_power; | ||
86 | bool beacon_found; | ||
87 | u32 orig_flags; | ||
88 | int orig_mag, orig_mpwr; | ||
89 | }; | ||
90 | |||
91 | /** | ||
92 | * enum ieee80211_rate_flags - rate flags | ||
93 | * | ||
94 | * Hardware/specification flags for rates. These are structured | ||
95 | * in a way that allows using the same bitrate structure for | ||
96 | * different bands/PHY modes. | ||
97 | * | ||
98 | * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short | ||
99 | * preamble on this bitrate; only relevant in 2.4GHz band and | ||
100 | * with CCK rates. | ||
101 | * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate | ||
102 | * when used with 802.11a (on the 5 GHz band); filled by the | ||
103 | * core code when registering the wiphy. | ||
104 | * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate | ||
105 | * when used with 802.11b (on the 2.4 GHz band); filled by the | ||
106 | * core code when registering the wiphy. | ||
107 | * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate | ||
108 | * when used with 802.11g (on the 2.4 GHz band); filled by the | ||
109 | * core code when registering the wiphy. | ||
110 | * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. | ||
111 | */ | ||
112 | enum ieee80211_rate_flags { | ||
113 | IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, | ||
114 | IEEE80211_RATE_MANDATORY_A = 1<<1, | ||
115 | IEEE80211_RATE_MANDATORY_B = 1<<2, | ||
116 | IEEE80211_RATE_MANDATORY_G = 1<<3, | ||
117 | IEEE80211_RATE_ERP_G = 1<<4, | ||
118 | }; | ||
119 | |||
120 | /** | ||
121 | * struct ieee80211_rate - bitrate definition | ||
122 | * | ||
123 | * This structure describes a bitrate that an 802.11 PHY can | ||
124 | * operate with. The two values @hw_value and @hw_value_short | ||
125 | * are only for driver use when pointers to this structure are | ||
126 | * passed around. | ||
127 | * | ||
128 | * @flags: rate-specific flags | ||
129 | * @bitrate: bitrate in units of 100 Kbps | ||
130 | * @hw_value: driver/hardware value for this rate | ||
131 | * @hw_value_short: driver/hardware value for this rate when | ||
132 | * short preamble is used | ||
133 | */ | ||
134 | struct ieee80211_rate { | ||
135 | u32 flags; | ||
136 | u16 bitrate; | ||
137 | u16 hw_value, hw_value_short; | ||
138 | }; | ||
139 | |||
140 | /** | ||
141 | * struct ieee80211_sta_ht_cap - STA's HT capabilities | ||
142 | * | ||
143 | * This structure describes most essential parameters needed | ||
144 | * to describe 802.11n HT capabilities for an STA. | ||
145 | * | ||
146 | * @ht_supported: is HT supported by the STA | ||
147 | * @cap: HT capabilities map as described in 802.11n spec | ||
148 | * @ampdu_factor: Maximum A-MPDU length factor | ||
149 | * @ampdu_density: Minimum A-MPDU spacing | ||
150 | * @mcs: Supported MCS rates | ||
151 | */ | ||
152 | struct ieee80211_sta_ht_cap { | ||
153 | u16 cap; /* use IEEE80211_HT_CAP_ */ | ||
154 | bool ht_supported; | ||
155 | u8 ampdu_factor; | ||
156 | u8 ampdu_density; | ||
157 | struct ieee80211_mcs_info mcs; | ||
158 | }; | ||
159 | |||
160 | /** | ||
161 | * struct ieee80211_supported_band - frequency band definition | ||
162 | * | ||
163 | * This structure describes a frequency band a wiphy | ||
164 | * is able to operate in. | ||
165 | * | ||
166 | * @channels: Array of channels the hardware can operate in | ||
167 | * in this band. | ||
168 | * @band: the band this structure represents | ||
169 | * @n_channels: Number of channels in @channels | ||
170 | * @bitrates: Array of bitrates the hardware can operate with | ||
171 | * in this band. Must be sorted to give a valid "supported | ||
172 | * rates" IE, i.e. CCK rates first, then OFDM. | ||
173 | * @n_bitrates: Number of bitrates in @bitrates | ||
174 | */ | ||
175 | struct ieee80211_supported_band { | ||
176 | struct ieee80211_channel *channels; | ||
177 | struct ieee80211_rate *bitrates; | ||
178 | enum ieee80211_band band; | ||
179 | int n_channels; | ||
180 | int n_bitrates; | ||
181 | struct ieee80211_sta_ht_cap ht_cap; | ||
182 | }; | ||
183 | |||
184 | /** | ||
185 | * struct wiphy - wireless hardware description | ||
186 | * @idx: the wiphy index assigned to this item | ||
187 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
188 | * @custom_regulatory: tells us the driver for this device | ||
189 | * has its own custom regulatory domain and cannot identify the | ||
190 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | ||
191 | * we will disregard the first regulatory hint (when the | ||
192 | * initiator is %REGDOM_SET_BY_CORE). | ||
193 | * @strict_regulatory: tells us the driver for this device will ignore | ||
194 | * regulatory domain settings until it gets its own regulatory domain | ||
195 | * via its regulatory_hint(). After its gets its own regulatory domain | ||
196 | * it will only allow further regulatory domain settings to further | ||
197 | * enhance compliance. For example if channel 13 and 14 are disabled | ||
198 | * by this regulatory domain no user regulatory domain can enable these | ||
199 | * channels at a later time. This can be used for devices which do not | ||
200 | * have calibration information gauranteed for frequencies or settings | ||
201 | * outside of its regulatory domain. | ||
202 | * @reg_notifier: the driver's regulatory notification callback | ||
203 | * @regd: the driver's regulatory domain, if one was requested via | ||
204 | * the regulatory_hint() API. This can be used by the driver | ||
205 | * on the reg_notifier() if it chooses to ignore future | ||
206 | * regulatory domain changes caused by other drivers. | ||
207 | * @signal_type: signal type reported in &struct cfg80211_bss. | ||
208 | */ | ||
209 | struct wiphy { | ||
210 | /* assign these fields before you register the wiphy */ | ||
211 | |||
212 | /* permanent MAC address */ | ||
213 | u8 perm_addr[ETH_ALEN]; | ||
214 | |||
215 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | ||
216 | u16 interface_modes; | ||
217 | |||
218 | bool custom_regulatory; | ||
219 | bool strict_regulatory; | ||
220 | |||
221 | enum cfg80211_signal_type signal_type; | ||
222 | |||
223 | int bss_priv_size; | ||
224 | u8 max_scan_ssids; | ||
225 | |||
226 | /* If multiple wiphys are registered and you're handed e.g. | ||
227 | * a regular netdev with assigned ieee80211_ptr, you won't | ||
228 | * know whether it points to a wiphy your driver has registered | ||
229 | * or not. Assign this to something global to your driver to | ||
230 | * help determine whether you own this wiphy or not. */ | ||
231 | void *privid; | ||
232 | |||
233 | struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; | ||
234 | |||
235 | /* Lets us get back the wiphy on the callback */ | ||
236 | int (*reg_notifier)(struct wiphy *wiphy, | ||
237 | struct regulatory_request *request); | ||
238 | |||
239 | /* fields below are read-only, assigned by cfg80211 */ | ||
240 | |||
241 | const struct ieee80211_regdomain *regd; | ||
242 | |||
243 | /* the item in /sys/class/ieee80211/ points to this, | ||
244 | * you need use set_wiphy_dev() (see below) */ | ||
245 | struct device dev; | ||
246 | |||
247 | /* dir in debugfs: ieee80211/<wiphyname> */ | ||
248 | struct dentry *debugfsdir; | ||
249 | |||
250 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
251 | }; | ||
252 | |||
253 | /** struct wireless_dev - wireless per-netdev state | ||
254 | * | ||
255 | * This structure must be allocated by the driver/stack | ||
256 | * that uses the ieee80211_ptr field in struct net_device | ||
257 | * (this is intentional so it can be allocated along with | ||
258 | * the netdev.) | ||
259 | * | ||
260 | * @wiphy: pointer to hardware description | ||
261 | * @iftype: interface type | ||
262 | */ | ||
263 | struct wireless_dev { | ||
264 | struct wiphy *wiphy; | ||
265 | enum nl80211_iftype iftype; | ||
266 | |||
267 | /* private to the generic wireless code */ | ||
268 | struct list_head list; | ||
269 | struct net_device *netdev; | ||
270 | }; | ||
271 | |||
272 | /** | ||
273 | * wiphy_priv - return priv from wiphy | ||
274 | */ | ||
275 | static inline void *wiphy_priv(struct wiphy *wiphy) | ||
276 | { | ||
277 | BUG_ON(!wiphy); | ||
278 | return &wiphy->priv; | ||
279 | } | ||
280 | |||
281 | /** | ||
282 | * set_wiphy_dev - set device pointer for wiphy | ||
283 | */ | ||
284 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | ||
285 | { | ||
286 | wiphy->dev.parent = dev; | ||
287 | } | ||
288 | |||
289 | /** | ||
290 | * wiphy_dev - get wiphy dev pointer | ||
291 | */ | ||
292 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | ||
293 | { | ||
294 | return wiphy->dev.parent; | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * wiphy_name - get wiphy name | ||
299 | */ | ||
300 | static inline const char *wiphy_name(struct wiphy *wiphy) | ||
301 | { | ||
302 | return dev_name(&wiphy->dev); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * wdev_priv - return wiphy priv from wireless_dev | ||
307 | */ | ||
308 | static inline void *wdev_priv(struct wireless_dev *wdev) | ||
309 | { | ||
310 | BUG_ON(!wdev); | ||
311 | return wiphy_priv(wdev->wiphy); | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * wiphy_new - create a new wiphy for use with cfg80211 | ||
316 | * | ||
317 | * create a new wiphy and associate the given operations with it. | ||
318 | * @sizeof_priv bytes are allocated for private use. | ||
319 | * | ||
320 | * the returned pointer must be assigned to each netdev's | ||
321 | * ieee80211_ptr for proper operation. | ||
322 | */ | ||
323 | struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); | ||
324 | |||
325 | /** | ||
326 | * wiphy_register - register a wiphy with cfg80211 | ||
327 | * | ||
328 | * register the given wiphy | ||
329 | * | ||
330 | * Returns a non-negative wiphy index or a negative error code. | ||
331 | */ | ||
332 | extern int wiphy_register(struct wiphy *wiphy); | ||
333 | |||
334 | /** | ||
335 | * wiphy_unregister - deregister a wiphy from cfg80211 | ||
336 | * | ||
337 | * unregister a device with the given priv pointer. | ||
338 | * After this call, no more requests can be made with this priv | ||
339 | * pointer, but the call may sleep to wait for an outstanding | ||
340 | * request that is being handled. | ||
341 | */ | ||
342 | extern void wiphy_unregister(struct wiphy *wiphy); | ||
343 | |||
344 | /** | ||
345 | * wiphy_free - free wiphy | ||
346 | */ | ||
347 | extern void wiphy_free(struct wiphy *wiphy); | ||
348 | |||
349 | /** | ||
350 | * ieee80211_channel_to_frequency - convert channel number to frequency | ||
351 | */ | ||
352 | extern int ieee80211_channel_to_frequency(int chan); | ||
353 | |||
354 | /** | ||
355 | * ieee80211_frequency_to_channel - convert frequency to channel number | ||
356 | */ | ||
357 | extern int ieee80211_frequency_to_channel(int freq); | ||
358 | |||
359 | /* | ||
360 | * Name indirection necessary because the ieee80211 code also has | ||
361 | * a function named "ieee80211_get_channel", so if you include | ||
362 | * cfg80211's header file you get cfg80211's version, if you try | ||
363 | * to include both header files you'll (rightfully!) get a symbol | ||
364 | * clash. | ||
365 | */ | ||
366 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | ||
367 | int freq); | ||
368 | /** | ||
369 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency | ||
370 | */ | ||
371 | static inline struct ieee80211_channel * | ||
372 | ieee80211_get_channel(struct wiphy *wiphy, int freq) | ||
373 | { | ||
374 | return __ieee80211_get_channel(wiphy, freq); | ||
375 | } | ||
376 | |||
377 | /** | ||
378 | * ieee80211_get_response_rate - get basic rate for a given rate | ||
379 | * | ||
380 | * @sband: the band to look for rates in | ||
381 | * @basic_rates: bitmap of basic rates | ||
382 | * @bitrate: the bitrate for which to find the basic rate | ||
383 | * | ||
384 | * This function returns the basic rate corresponding to a given | ||
385 | * bitrate, that is the next lower bitrate contained in the basic | ||
386 | * rate map, which is, for this function, given as a bitmap of | ||
387 | * indices of rates in the band's bitrate table. | ||
388 | */ | ||
389 | struct ieee80211_rate * | ||
390 | ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | ||
391 | u32 basic_rates, int bitrate); | ||
392 | |||
393 | /** | ||
394 | * regulatory_hint - driver hint to the wireless core a regulatory domain | ||
395 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
396 | * conflicts) | ||
397 | * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain | ||
398 | * should be in. If @rd is set this should be NULL. Note that if you | ||
399 | * set this to NULL you should still set rd->alpha2 to some accepted | ||
400 | * alpha2. | ||
401 | * | ||
402 | * Wireless drivers can use this function to hint to the wireless core | ||
403 | * what it believes should be the current regulatory domain by | ||
404 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
405 | * domain should be in or by providing a completely build regulatory domain. | ||
406 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | ||
407 | * for a regulatory domain structure for the respective country. | ||
408 | * | ||
409 | * The wiphy must have been registered to cfg80211 prior to this call. | ||
410 | * For cfg80211 drivers this means you must first use wiphy_register(), | ||
411 | * for mac80211 drivers you must first use ieee80211_register_hw(). | ||
412 | * | ||
413 | * Drivers should check the return value, its possible you can get | ||
414 | * an -ENOMEM. | ||
415 | */ | ||
416 | extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); | ||
417 | |||
418 | /** | ||
419 | * regulatory_hint_11d - hints a country IE as a regulatory domain | ||
420 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
421 | * conflicts) | ||
422 | * @country_ie: pointer to the country IE | ||
423 | * @country_ie_len: length of the country IE | ||
424 | * | ||
425 | * We will intersect the rd with the what CRDA tells us should apply | ||
426 | * for the alpha2 this country IE belongs to, this prevents APs from | ||
427 | * sending us incorrect or outdated information against a country. | ||
428 | */ | ||
429 | extern void regulatory_hint_11d(struct wiphy *wiphy, | ||
430 | u8 *country_ie, | ||
431 | u8 country_ie_len); | ||
432 | /** | ||
433 | * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain | ||
434 | * @wiphy: the wireless device we want to process the regulatory domain on | ||
435 | * @regd: the custom regulatory domain to use for this wiphy | ||
436 | * | ||
437 | * Drivers can sometimes have custom regulatory domains which do not apply | ||
438 | * to a specific country. Drivers can use this to apply such custom regulatory | ||
439 | * domains. This routine must be called prior to wiphy registration. The | ||
440 | * custom regulatory domain will be trusted completely and as such previous | ||
441 | * default channel settings will be disregarded. If no rule is found for a | ||
442 | * channel on the regulatory domain the channel will be disabled. | ||
443 | */ | ||
444 | extern void wiphy_apply_custom_regulatory( | ||
445 | struct wiphy *wiphy, | ||
446 | const struct ieee80211_regdomain *regd); | ||
447 | |||
448 | /** | ||
449 | * freq_reg_info - get regulatory information for the given frequency | ||
450 | * @wiphy: the wiphy for which we want to process this rule for | ||
451 | * @center_freq: Frequency in KHz for which we want regulatory information for | ||
452 | * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one | ||
453 | * you can set this to 0. If this frequency is allowed we then set | ||
454 | * this value to the maximum allowed bandwidth. | ||
455 | * @reg_rule: the regulatory rule which we have for this frequency | ||
456 | * | ||
457 | * Use this function to get the regulatory rule for a specific frequency on | ||
458 | * a given wireless device. If the device has a specific regulatory domain | ||
459 | * it wants to follow we respect that unless a country IE has been received | ||
460 | * and processed already. | ||
461 | * | ||
462 | * Returns 0 if it was able to find a valid regulatory rule which does | ||
463 | * apply to the given center_freq otherwise it returns non-zero. It will | ||
464 | * also return -ERANGE if we determine the given center_freq does not even have | ||
465 | * a regulatory rule for a frequency range in the center_freq's band. See | ||
466 | * freq_in_rule_band() for our current definition of a band -- this is purely | ||
467 | * subjective and right now its 802.11 specific. | ||
468 | */ | ||
469 | extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth, | ||
470 | const struct ieee80211_reg_rule **reg_rule); | ||
471 | |||
472 | #endif /* __NET_WIRELESS_H */ | ||