diff options
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r-- | include/net/cfg80211.h | 789 |
1 files changed, 687 insertions, 102 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 2fd06c60ffbb..396e8fc8910e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -25,6 +25,43 @@ | |||
25 | #include <linux/wireless.h> | 25 | #include <linux/wireless.h> |
26 | 26 | ||
27 | 27 | ||
28 | /** | ||
29 | * DOC: Introduction | ||
30 | * | ||
31 | * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges | ||
32 | * userspace and drivers, and offers some utility functionality associated | ||
33 | * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used | ||
34 | * by all modern wireless drivers in Linux, so that they offer a consistent | ||
35 | * API through nl80211. For backward compatibility, cfg80211 also offers | ||
36 | * wireless extensions to userspace, but hides them from drivers completely. | ||
37 | * | ||
38 | * Additionally, cfg80211 contains code to help enforce regulatory spectrum | ||
39 | * use restrictions. | ||
40 | */ | ||
41 | |||
42 | |||
43 | /** | ||
44 | * DOC: Device registration | ||
45 | * | ||
46 | * In order for a driver to use cfg80211, it must register the hardware device | ||
47 | * with cfg80211. This happens through a number of hardware capability structs | ||
48 | * described below. | ||
49 | * | ||
50 | * The fundamental structure for each device is the 'wiphy', of which each | ||
51 | * instance describes a physical wireless device connected to the system. Each | ||
52 | * such wiphy can have zero, one, or many virtual interfaces associated with | ||
53 | * it, which need to be identified as such by pointing the network interface's | ||
54 | * @ieee80211_ptr pointer to a &struct wireless_dev which further describes | ||
55 | * the wireless part of the interface, normally this struct is embedded in the | ||
56 | * network interface's private data area. Drivers can optionally allow creating | ||
57 | * or destroying virtual interfaces on the fly, but without at least one or the | ||
58 | * ability to create some the wireless device isn't useful. | ||
59 | * | ||
60 | * Each wiphy structure contains device capability information, and also has | ||
61 | * a pointer to the various operations the driver offers. The definitions and | ||
62 | * structures here describe these capabilities in detail. | ||
63 | */ | ||
64 | |||
28 | /* | 65 | /* |
29 | * wireless hardware capability structures | 66 | * wireless hardware capability structures |
30 | */ | 67 | */ |
@@ -205,14 +242,25 @@ struct ieee80211_supported_band { | |||
205 | */ | 242 | */ |
206 | 243 | ||
207 | /** | 244 | /** |
245 | * DOC: Actions and configuration | ||
246 | * | ||
247 | * Each wireless device and each virtual interface offer a set of configuration | ||
248 | * operations and other actions that are invoked by userspace. Each of these | ||
249 | * actions is described in the operations structure, and the parameters these | ||
250 | * operations use are described separately. | ||
251 | * | ||
252 | * Additionally, some operations are asynchronous and expect to get status | ||
253 | * information via some functions that drivers need to call. | ||
254 | * | ||
255 | * Scanning and BSS list handling with its associated functionality is described | ||
256 | * in a separate chapter. | ||
257 | */ | ||
258 | |||
259 | /** | ||
208 | * struct vif_params - describes virtual interface parameters | 260 | * struct vif_params - describes virtual interface parameters |
209 | * @mesh_id: mesh ID to use | ||
210 | * @mesh_id_len: length of the mesh ID | ||
211 | * @use_4addr: use 4-address frames | 261 | * @use_4addr: use 4-address frames |
212 | */ | 262 | */ |
213 | struct vif_params { | 263 | struct vif_params { |
214 | u8 *mesh_id; | ||
215 | int mesh_id_len; | ||
216 | int use_4addr; | 264 | int use_4addr; |
217 | }; | 265 | }; |
218 | 266 | ||
@@ -241,12 +289,24 @@ struct key_params { | |||
241 | * enum survey_info_flags - survey information flags | 289 | * enum survey_info_flags - survey information flags |
242 | * | 290 | * |
243 | * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in | 291 | * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in |
292 | * @SURVEY_INFO_IN_USE: channel is currently being used | ||
293 | * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in | ||
294 | * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in | ||
295 | * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in | ||
296 | * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in | ||
297 | * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in | ||
244 | * | 298 | * |
245 | * Used by the driver to indicate which info in &struct survey_info | 299 | * Used by the driver to indicate which info in &struct survey_info |
246 | * it has filled in during the get_survey(). | 300 | * it has filled in during the get_survey(). |
247 | */ | 301 | */ |
248 | enum survey_info_flags { | 302 | enum survey_info_flags { |
249 | SURVEY_INFO_NOISE_DBM = 1<<0, | 303 | SURVEY_INFO_NOISE_DBM = 1<<0, |
304 | SURVEY_INFO_IN_USE = 1<<1, | ||
305 | SURVEY_INFO_CHANNEL_TIME = 1<<2, | ||
306 | SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, | ||
307 | SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, | ||
308 | SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, | ||
309 | SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, | ||
250 | }; | 310 | }; |
251 | 311 | ||
252 | /** | 312 | /** |
@@ -256,6 +316,11 @@ enum survey_info_flags { | |||
256 | * @filled: bitflag of flags from &enum survey_info_flags | 316 | * @filled: bitflag of flags from &enum survey_info_flags |
257 | * @noise: channel noise in dBm. This and all following fields are | 317 | * @noise: channel noise in dBm. This and all following fields are |
258 | * optional | 318 | * optional |
319 | * @channel_time: amount of time in ms the radio spent on the channel | ||
320 | * @channel_time_busy: amount of time the primary channel was sensed busy | ||
321 | * @channel_time_ext_busy: amount of time the extension channel was sensed busy | ||
322 | * @channel_time_rx: amount of time the radio spent receiving data | ||
323 | * @channel_time_tx: amount of time the radio spent transmitting data | ||
259 | * | 324 | * |
260 | * Used by dump_survey() to report back per-channel survey information. | 325 | * Used by dump_survey() to report back per-channel survey information. |
261 | * | 326 | * |
@@ -264,6 +329,11 @@ enum survey_info_flags { | |||
264 | */ | 329 | */ |
265 | struct survey_info { | 330 | struct survey_info { |
266 | struct ieee80211_channel *channel; | 331 | struct ieee80211_channel *channel; |
332 | u64 channel_time; | ||
333 | u64 channel_time_busy; | ||
334 | u64 channel_time_ext_busy; | ||
335 | u64 channel_time_rx; | ||
336 | u64 channel_time_tx; | ||
267 | u32 filled; | 337 | u32 filled; |
268 | s8 noise; | 338 | s8 noise; |
269 | }; | 339 | }; |
@@ -317,6 +387,7 @@ enum plink_actions { | |||
317 | * @listen_interval: listen interval or -1 for no change | 387 | * @listen_interval: listen interval or -1 for no change |
318 | * @aid: AID or zero for no change | 388 | * @aid: AID or zero for no change |
319 | * @plink_action: plink action to take | 389 | * @plink_action: plink action to take |
390 | * @plink_state: set the peer link state for a station | ||
320 | * @ht_capa: HT capabilities of station | 391 | * @ht_capa: HT capabilities of station |
321 | */ | 392 | */ |
322 | struct station_parameters { | 393 | struct station_parameters { |
@@ -327,6 +398,7 @@ struct station_parameters { | |||
327 | u16 aid; | 398 | u16 aid; |
328 | u8 supported_rates_len; | 399 | u8 supported_rates_len; |
329 | u8 plink_action; | 400 | u8 plink_action; |
401 | u8 plink_state; | ||
330 | struct ieee80211_ht_cap *ht_capa; | 402 | struct ieee80211_ht_cap *ht_capa; |
331 | }; | 403 | }; |
332 | 404 | ||
@@ -343,10 +415,17 @@ struct station_parameters { | |||
343 | * @STATION_INFO_PLID: @plid filled | 415 | * @STATION_INFO_PLID: @plid filled |
344 | * @STATION_INFO_PLINK_STATE: @plink_state filled | 416 | * @STATION_INFO_PLINK_STATE: @plink_state filled |
345 | * @STATION_INFO_SIGNAL: @signal filled | 417 | * @STATION_INFO_SIGNAL: @signal filled |
346 | * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled | 418 | * @STATION_INFO_TX_BITRATE: @txrate fields are filled |
347 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) | 419 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) |
348 | * @STATION_INFO_RX_PACKETS: @rx_packets filled | 420 | * @STATION_INFO_RX_PACKETS: @rx_packets filled |
349 | * @STATION_INFO_TX_PACKETS: @tx_packets filled | 421 | * @STATION_INFO_TX_PACKETS: @tx_packets filled |
422 | * @STATION_INFO_TX_RETRIES: @tx_retries filled | ||
423 | * @STATION_INFO_TX_FAILED: @tx_failed filled | ||
424 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled | ||
425 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled | ||
426 | * @STATION_INFO_RX_BITRATE: @rxrate fields are filled | ||
427 | * @STATION_INFO_BSS_PARAM: @bss_param filled | ||
428 | * @STATION_INFO_CONNECTED_TIME: @connected_time filled | ||
350 | */ | 429 | */ |
351 | enum station_info_flags { | 430 | enum station_info_flags { |
352 | STATION_INFO_INACTIVE_TIME = 1<<0, | 431 | STATION_INFO_INACTIVE_TIME = 1<<0, |
@@ -359,6 +438,13 @@ enum station_info_flags { | |||
359 | STATION_INFO_TX_BITRATE = 1<<7, | 438 | STATION_INFO_TX_BITRATE = 1<<7, |
360 | STATION_INFO_RX_PACKETS = 1<<8, | 439 | STATION_INFO_RX_PACKETS = 1<<8, |
361 | STATION_INFO_TX_PACKETS = 1<<9, | 440 | STATION_INFO_TX_PACKETS = 1<<9, |
441 | STATION_INFO_TX_RETRIES = 1<<10, | ||
442 | STATION_INFO_TX_FAILED = 1<<11, | ||
443 | STATION_INFO_RX_DROP_MISC = 1<<12, | ||
444 | STATION_INFO_SIGNAL_AVG = 1<<13, | ||
445 | STATION_INFO_RX_BITRATE = 1<<14, | ||
446 | STATION_INFO_BSS_PARAM = 1<<15, | ||
447 | STATION_INFO_CONNECTED_TIME = 1<<16 | ||
362 | }; | 448 | }; |
363 | 449 | ||
364 | /** | 450 | /** |
@@ -393,11 +479,43 @@ struct rate_info { | |||
393 | }; | 479 | }; |
394 | 480 | ||
395 | /** | 481 | /** |
482 | * enum station_info_rate_flags - bitrate info flags | ||
483 | * | ||
484 | * Used by the driver to indicate the specific rate transmission | ||
485 | * type for 802.11n transmissions. | ||
486 | * | ||
487 | * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled | ||
488 | * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled | ||
489 | * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled | ||
490 | */ | ||
491 | enum bss_param_flags { | ||
492 | BSS_PARAM_FLAGS_CTS_PROT = 1<<0, | ||
493 | BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, | ||
494 | BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, | ||
495 | }; | ||
496 | |||
497 | /** | ||
498 | * struct sta_bss_parameters - BSS parameters for the attached station | ||
499 | * | ||
500 | * Information about the currently associated BSS | ||
501 | * | ||
502 | * @flags: bitflag of flags from &enum bss_param_flags | ||
503 | * @dtim_period: DTIM period for the BSS | ||
504 | * @beacon_interval: beacon interval | ||
505 | */ | ||
506 | struct sta_bss_parameters { | ||
507 | u8 flags; | ||
508 | u8 dtim_period; | ||
509 | u16 beacon_interval; | ||
510 | }; | ||
511 | |||
512 | /** | ||
396 | * struct station_info - station information | 513 | * struct station_info - station information |
397 | * | 514 | * |
398 | * Station information filled by driver for get_station() and dump_station. | 515 | * Station information filled by driver for get_station() and dump_station. |
399 | * | 516 | * |
400 | * @filled: bitflag of flags from &enum station_info_flags | 517 | * @filled: bitflag of flags from &enum station_info_flags |
518 | * @connected_time: time(in secs) since a station is last connected | ||
401 | * @inactive_time: time since last station activity (tx/rx) in milliseconds | 519 | * @inactive_time: time since last station activity (tx/rx) in milliseconds |
402 | * @rx_bytes: bytes received from this station | 520 | * @rx_bytes: bytes received from this station |
403 | * @tx_bytes: bytes transmitted to this station | 521 | * @tx_bytes: bytes transmitted to this station |
@@ -405,9 +523,15 @@ struct rate_info { | |||
405 | * @plid: mesh peer link id | 523 | * @plid: mesh peer link id |
406 | * @plink_state: mesh peer link state | 524 | * @plink_state: mesh peer link state |
407 | * @signal: signal strength of last received packet in dBm | 525 | * @signal: signal strength of last received packet in dBm |
408 | * @txrate: current unicast bitrate to this station | 526 | * @signal_avg: signal strength average in dBm |
527 | * @txrate: current unicast bitrate from this station | ||
528 | * @rxrate: current unicast bitrate to this station | ||
409 | * @rx_packets: packets received from this station | 529 | * @rx_packets: packets received from this station |
410 | * @tx_packets: packets transmitted to this station | 530 | * @tx_packets: packets transmitted to this station |
531 | * @tx_retries: cumulative retry counts | ||
532 | * @tx_failed: number of failed transmissions (retries exceeded, no ACK) | ||
533 | * @rx_dropped_misc: Dropped for un-specified reason. | ||
534 | * @bss_param: current BSS parameters | ||
411 | * @generation: generation number for nl80211 dumps. | 535 | * @generation: generation number for nl80211 dumps. |
412 | * This number should increase every time the list of stations | 536 | * This number should increase every time the list of stations |
413 | * changes, i.e. when a station is added or removed, so that | 537 | * changes, i.e. when a station is added or removed, so that |
@@ -415,6 +539,7 @@ struct rate_info { | |||
415 | */ | 539 | */ |
416 | struct station_info { | 540 | struct station_info { |
417 | u32 filled; | 541 | u32 filled; |
542 | u32 connected_time; | ||
418 | u32 inactive_time; | 543 | u32 inactive_time; |
419 | u32 rx_bytes; | 544 | u32 rx_bytes; |
420 | u32 tx_bytes; | 545 | u32 tx_bytes; |
@@ -422,9 +547,15 @@ struct station_info { | |||
422 | u16 plid; | 547 | u16 plid; |
423 | u8 plink_state; | 548 | u8 plink_state; |
424 | s8 signal; | 549 | s8 signal; |
550 | s8 signal_avg; | ||
425 | struct rate_info txrate; | 551 | struct rate_info txrate; |
552 | struct rate_info rxrate; | ||
426 | u32 rx_packets; | 553 | u32 rx_packets; |
427 | u32 tx_packets; | 554 | u32 tx_packets; |
555 | u32 tx_retries; | ||
556 | u32 tx_failed; | ||
557 | u32 rx_dropped_misc; | ||
558 | struct sta_bss_parameters bss_param; | ||
428 | 559 | ||
429 | int generation; | 560 | int generation; |
430 | }; | 561 | }; |
@@ -519,6 +650,8 @@ struct mpath_info { | |||
519 | * (or NULL for no change) | 650 | * (or NULL for no change) |
520 | * @basic_rates_len: number of basic rates | 651 | * @basic_rates_len: number of basic rates |
521 | * @ap_isolate: do not forward packets between connected stations | 652 | * @ap_isolate: do not forward packets between connected stations |
653 | * @ht_opmode: HT Operation mode | ||
654 | * (u16 = opmode, -1 = do not change) | ||
522 | */ | 655 | */ |
523 | struct bss_parameters { | 656 | struct bss_parameters { |
524 | int use_cts_prot; | 657 | int use_cts_prot; |
@@ -527,8 +660,14 @@ struct bss_parameters { | |||
527 | u8 *basic_rates; | 660 | u8 *basic_rates; |
528 | u8 basic_rates_len; | 661 | u8 basic_rates_len; |
529 | int ap_isolate; | 662 | int ap_isolate; |
663 | int ht_opmode; | ||
530 | }; | 664 | }; |
531 | 665 | ||
666 | /* | ||
667 | * struct mesh_config - 802.11s mesh configuration | ||
668 | * | ||
669 | * These parameters can be changed while the mesh is active. | ||
670 | */ | ||
532 | struct mesh_config { | 671 | struct mesh_config { |
533 | /* Timeouts in ms */ | 672 | /* Timeouts in ms */ |
534 | /* Mesh plink management parameters */ | 673 | /* Mesh plink management parameters */ |
@@ -538,6 +677,8 @@ struct mesh_config { | |||
538 | u16 dot11MeshMaxPeerLinks; | 677 | u16 dot11MeshMaxPeerLinks; |
539 | u8 dot11MeshMaxRetries; | 678 | u8 dot11MeshMaxRetries; |
540 | u8 dot11MeshTTL; | 679 | u8 dot11MeshTTL; |
680 | /* ttl used in path selection information elements */ | ||
681 | u8 element_ttl; | ||
541 | bool auto_open_plinks; | 682 | bool auto_open_plinks; |
542 | /* HWMP parameters */ | 683 | /* HWMP parameters */ |
543 | u8 dot11MeshHWMPmaxPREQretries; | 684 | u8 dot11MeshHWMPmaxPREQretries; |
@@ -550,6 +691,30 @@ struct mesh_config { | |||
550 | }; | 691 | }; |
551 | 692 | ||
552 | /** | 693 | /** |
694 | * struct mesh_setup - 802.11s mesh setup configuration | ||
695 | * @mesh_id: the mesh ID | ||
696 | * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes | ||
697 | * @path_sel_proto: which path selection protocol to use | ||
698 | * @path_metric: which metric to use | ||
699 | * @ie: vendor information elements (optional) | ||
700 | * @ie_len: length of vendor information elements | ||
701 | * @is_authenticated: this mesh requires authentication | ||
702 | * @is_secure: this mesh uses security | ||
703 | * | ||
704 | * These parameters are fixed when the mesh is created. | ||
705 | */ | ||
706 | struct mesh_setup { | ||
707 | const u8 *mesh_id; | ||
708 | u8 mesh_id_len; | ||
709 | u8 path_sel_proto; | ||
710 | u8 path_metric; | ||
711 | const u8 *ie; | ||
712 | u8 ie_len; | ||
713 | bool is_authenticated; | ||
714 | bool is_secure; | ||
715 | }; | ||
716 | |||
717 | /** | ||
553 | * struct ieee80211_txq_params - TX queue parameters | 718 | * struct ieee80211_txq_params - TX queue parameters |
554 | * @queue: TX queue identifier (NL80211_TXQ_Q_*) | 719 | * @queue: TX queue identifier (NL80211_TXQ_Q_*) |
555 | * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled | 720 | * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled |
@@ -570,8 +735,28 @@ struct ieee80211_txq_params { | |||
570 | /* from net/wireless.h */ | 735 | /* from net/wireless.h */ |
571 | struct wiphy; | 736 | struct wiphy; |
572 | 737 | ||
573 | /* from net/ieee80211.h */ | 738 | /** |
574 | struct ieee80211_channel; | 739 | * DOC: Scanning and BSS list handling |
740 | * | ||
741 | * The scanning process itself is fairly simple, but cfg80211 offers quite | ||
742 | * a bit of helper functionality. To start a scan, the scan operation will | ||
743 | * be invoked with a scan definition. This scan definition contains the | ||
744 | * channels to scan, and the SSIDs to send probe requests for (including the | ||
745 | * wildcard, if desired). A passive scan is indicated by having no SSIDs to | ||
746 | * probe. Additionally, a scan request may contain extra information elements | ||
747 | * that should be added to the probe request. The IEs are guaranteed to be | ||
748 | * well-formed, and will not exceed the maximum length the driver advertised | ||
749 | * in the wiphy structure. | ||
750 | * | ||
751 | * When scanning finds a BSS, cfg80211 needs to be notified of that, because | ||
752 | * it is responsible for maintaining the BSS list; the driver should not | ||
753 | * maintain a list itself. For this notification, various functions exist. | ||
754 | * | ||
755 | * Since drivers do not maintain a BSS list, there are also a number of | ||
756 | * functions to search for a BSS and obtain information about it from the | ||
757 | * BSS structure cfg80211 maintains. The BSS list is also made available | ||
758 | * to userspace. | ||
759 | */ | ||
575 | 760 | ||
576 | /** | 761 | /** |
577 | * struct cfg80211_ssid - SSID description | 762 | * struct cfg80211_ssid - SSID description |
@@ -613,6 +798,35 @@ struct cfg80211_scan_request { | |||
613 | }; | 798 | }; |
614 | 799 | ||
615 | /** | 800 | /** |
801 | * struct cfg80211_sched_scan_request - scheduled scan request description | ||
802 | * | ||
803 | * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) | ||
804 | * @n_ssids: number of SSIDs | ||
805 | * @n_channels: total number of channels to scan | ||
806 | * @interval: interval between each scheduled scan cycle | ||
807 | * @ie: optional information element(s) to add into Probe Request or %NULL | ||
808 | * @ie_len: length of ie in octets | ||
809 | * @wiphy: the wiphy this was for | ||
810 | * @dev: the interface | ||
811 | * @channels: channels to scan | ||
812 | */ | ||
813 | struct cfg80211_sched_scan_request { | ||
814 | struct cfg80211_ssid *ssids; | ||
815 | int n_ssids; | ||
816 | u32 n_channels; | ||
817 | u32 interval; | ||
818 | const u8 *ie; | ||
819 | size_t ie_len; | ||
820 | |||
821 | /* internal */ | ||
822 | struct wiphy *wiphy; | ||
823 | struct net_device *dev; | ||
824 | |||
825 | /* keep last */ | ||
826 | struct ieee80211_channel *channels[0]; | ||
827 | }; | ||
828 | |||
829 | /** | ||
616 | * enum cfg80211_signal_type - signal type | 830 | * enum cfg80211_signal_type - signal type |
617 | * | 831 | * |
618 | * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available | 832 | * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available |
@@ -691,6 +905,10 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); | |||
691 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | 905 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is |
692 | * required to assume that the port is unauthorized until authorized by | 906 | * required to assume that the port is unauthorized until authorized by |
693 | * user space. Otherwise, port is marked authorized by default. | 907 | * user space. Otherwise, port is marked authorized by default. |
908 | * @control_port_ethertype: the control port protocol that should be | ||
909 | * allowed through even on unauthorized ports | ||
910 | * @control_port_no_encrypt: TRUE to prevent encryption of control port | ||
911 | * protocol frames. | ||
694 | */ | 912 | */ |
695 | struct cfg80211_crypto_settings { | 913 | struct cfg80211_crypto_settings { |
696 | u32 wpa_versions; | 914 | u32 wpa_versions; |
@@ -700,6 +918,8 @@ struct cfg80211_crypto_settings { | |||
700 | int n_akm_suites; | 918 | int n_akm_suites; |
701 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; | 919 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; |
702 | bool control_port; | 920 | bool control_port; |
921 | __be16 control_port_ethertype; | ||
922 | bool control_port_no_encrypt; | ||
703 | }; | 923 | }; |
704 | 924 | ||
705 | /** | 925 | /** |
@@ -811,6 +1031,7 @@ struct cfg80211_disassoc_request { | |||
811 | * @privacy: this is a protected network, keys will be configured | 1031 | * @privacy: this is a protected network, keys will be configured |
812 | * after joining | 1032 | * after joining |
813 | * @basic_rates: bitmap of basic rates to use when creating the IBSS | 1033 | * @basic_rates: bitmap of basic rates to use when creating the IBSS |
1034 | * @mcast_rate: per-band multicast rate index + 1 (0: disabled) | ||
814 | */ | 1035 | */ |
815 | struct cfg80211_ibss_params { | 1036 | struct cfg80211_ibss_params { |
816 | u8 *ssid; | 1037 | u8 *ssid; |
@@ -822,6 +1043,7 @@ struct cfg80211_ibss_params { | |||
822 | u32 basic_rates; | 1043 | u32 basic_rates; |
823 | bool channel_fixed; | 1044 | bool channel_fixed; |
824 | bool privacy; | 1045 | bool privacy; |
1046 | int mcast_rate[IEEE80211_NUM_BANDS]; | ||
825 | }; | 1047 | }; |
826 | 1048 | ||
827 | /** | 1049 | /** |
@@ -900,6 +1122,38 @@ struct cfg80211_pmksa { | |||
900 | }; | 1122 | }; |
901 | 1123 | ||
902 | /** | 1124 | /** |
1125 | * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern | ||
1126 | * @mask: bitmask where to match pattern and where to ignore bytes, | ||
1127 | * one bit per byte, in same format as nl80211 | ||
1128 | * @pattern: bytes to match where bitmask is 1 | ||
1129 | * @pattern_len: length of pattern (in bytes) | ||
1130 | * | ||
1131 | * Internal note: @mask and @pattern are allocated in one chunk of | ||
1132 | * memory, free @mask only! | ||
1133 | */ | ||
1134 | struct cfg80211_wowlan_trig_pkt_pattern { | ||
1135 | u8 *mask, *pattern; | ||
1136 | int pattern_len; | ||
1137 | }; | ||
1138 | |||
1139 | /** | ||
1140 | * struct cfg80211_wowlan - Wake on Wireless-LAN support info | ||
1141 | * | ||
1142 | * This structure defines the enabled WoWLAN triggers for the device. | ||
1143 | * @any: wake up on any activity -- special trigger if device continues | ||
1144 | * operating as normal during suspend | ||
1145 | * @disconnect: wake up if getting disconnected | ||
1146 | * @magic_pkt: wake up on receiving magic packet | ||
1147 | * @patterns: wake up on receiving packet matching a pattern | ||
1148 | * @n_patterns: number of patterns | ||
1149 | */ | ||
1150 | struct cfg80211_wowlan { | ||
1151 | bool any, disconnect, magic_pkt; | ||
1152 | struct cfg80211_wowlan_trig_pkt_pattern *patterns; | ||
1153 | int n_patterns; | ||
1154 | }; | ||
1155 | |||
1156 | /** | ||
903 | * struct cfg80211_ops - backend description for wireless configuration | 1157 | * struct cfg80211_ops - backend description for wireless configuration |
904 | * | 1158 | * |
905 | * This struct is registered by fullmac card drivers and/or wireless stacks | 1159 | * This struct is registered by fullmac card drivers and/or wireless stacks |
@@ -912,12 +1166,15 @@ struct cfg80211_pmksa { | |||
912 | * wireless extensions but this is subject to reevaluation as soon as this | 1166 | * wireless extensions but this is subject to reevaluation as soon as this |
913 | * code is used more widely and we have a first user without wext. | 1167 | * code is used more widely and we have a first user without wext. |
914 | * | 1168 | * |
915 | * @suspend: wiphy device needs to be suspended | 1169 | * @suspend: wiphy device needs to be suspended. The variable @wow will |
1170 | * be %NULL or contain the enabled Wake-on-Wireless triggers that are | ||
1171 | * configured for the device. | ||
916 | * @resume: wiphy device needs to be resumed | 1172 | * @resume: wiphy device needs to be resumed |
917 | * | 1173 | * |
918 | * @add_virtual_intf: create a new virtual interface with the given name, | 1174 | * @add_virtual_intf: create a new virtual interface with the given name, |
919 | * must set the struct wireless_dev's iftype. Beware: You must create | 1175 | * must set the struct wireless_dev's iftype. Beware: You must create |
920 | * the new netdev in the wiphy's network namespace! | 1176 | * the new netdev in the wiphy's network namespace! Returns the netdev, |
1177 | * or an ERR_PTR. | ||
921 | * | 1178 | * |
922 | * @del_virtual_intf: remove the virtual interface determined by ifindex. | 1179 | * @del_virtual_intf: remove the virtual interface determined by ifindex. |
923 | * | 1180 | * |
@@ -958,10 +1215,12 @@ struct cfg80211_pmksa { | |||
958 | * @change_mpath: change a given mesh path | 1215 | * @change_mpath: change a given mesh path |
959 | * @get_mpath: get a mesh path for the given parameters | 1216 | * @get_mpath: get a mesh path for the given parameters |
960 | * @dump_mpath: dump mesh path callback -- resume dump at index @idx | 1217 | * @dump_mpath: dump mesh path callback -- resume dump at index @idx |
1218 | * @join_mesh: join the mesh network with the specified parameters | ||
1219 | * @leave_mesh: leave the current mesh network | ||
961 | * | 1220 | * |
962 | * @get_mesh_params: Put the current mesh parameters into *params | 1221 | * @get_mesh_config: Get the current mesh configuration |
963 | * | 1222 | * |
964 | * @set_mesh_params: Set mesh parameters. | 1223 | * @update_mesh_config: Update mesh parameters on a running mesh. |
965 | * The mask is a bitfield which tells us which parameters to | 1224 | * The mask is a bitfield which tells us which parameters to |
966 | * set, and which to leave alone. | 1225 | * set, and which to leave alone. |
967 | * | 1226 | * |
@@ -1020,7 +1279,9 @@ struct cfg80211_pmksa { | |||
1020 | * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. | 1279 | * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. |
1021 | * This allows the operation to be terminated prior to timeout based on | 1280 | * This allows the operation to be terminated prior to timeout based on |
1022 | * the duration value. | 1281 | * the duration value. |
1023 | * @action: Transmit an action frame | 1282 | * @mgmt_tx: Transmit a management frame. |
1283 | * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management | ||
1284 | * frame on another channel | ||
1024 | * | 1285 | * |
1025 | * @testmode_cmd: run a test mode command | 1286 | * @testmode_cmd: run a test mode command |
1026 | * | 1287 | * |
@@ -1034,15 +1295,35 @@ struct cfg80211_pmksa { | |||
1034 | * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 | 1295 | * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 |
1035 | * allows the driver to adjust the dynamic ps timeout value. | 1296 | * allows the driver to adjust the dynamic ps timeout value. |
1036 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. | 1297 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. |
1298 | * @sched_scan_start: Tell the driver to start a scheduled scan. | ||
1299 | * @sched_scan_stop: Tell the driver to stop an ongoing scheduled | ||
1300 | * scan. The driver_initiated flag specifies whether the driver | ||
1301 | * itself has informed that the scan has stopped. | ||
1302 | * | ||
1303 | * @mgmt_frame_register: Notify driver that a management frame type was | ||
1304 | * registered. Note that this callback may not sleep, and cannot run | ||
1305 | * concurrently with itself. | ||
1037 | * | 1306 | * |
1307 | * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. | ||
1308 | * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may | ||
1309 | * reject TX/RX mask combinations they cannot support by returning -EINVAL | ||
1310 | * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). | ||
1311 | * | ||
1312 | * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). | ||
1313 | * | ||
1314 | * @set_ringparam: Set tx and rx ring sizes. | ||
1315 | * | ||
1316 | * @get_ringparam: Get tx and rx ring current and maximum sizes. | ||
1038 | */ | 1317 | */ |
1039 | struct cfg80211_ops { | 1318 | struct cfg80211_ops { |
1040 | int (*suspend)(struct wiphy *wiphy); | 1319 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
1041 | int (*resume)(struct wiphy *wiphy); | 1320 | int (*resume)(struct wiphy *wiphy); |
1042 | 1321 | ||
1043 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | 1322 | struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, |
1044 | enum nl80211_iftype type, u32 *flags, | 1323 | char *name, |
1045 | struct vif_params *params); | 1324 | enum nl80211_iftype type, |
1325 | u32 *flags, | ||
1326 | struct vif_params *params); | ||
1046 | int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); | 1327 | int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); |
1047 | int (*change_virtual_intf)(struct wiphy *wiphy, | 1328 | int (*change_virtual_intf)(struct wiphy *wiphy, |
1048 | struct net_device *dev, | 1329 | struct net_device *dev, |
@@ -1050,16 +1331,17 @@ struct cfg80211_ops { | |||
1050 | struct vif_params *params); | 1331 | struct vif_params *params); |
1051 | 1332 | ||
1052 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, | 1333 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, |
1053 | u8 key_index, const u8 *mac_addr, | 1334 | u8 key_index, bool pairwise, const u8 *mac_addr, |
1054 | struct key_params *params); | 1335 | struct key_params *params); |
1055 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, | 1336 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, |
1056 | u8 key_index, const u8 *mac_addr, void *cookie, | 1337 | u8 key_index, bool pairwise, const u8 *mac_addr, |
1338 | void *cookie, | ||
1057 | void (*callback)(void *cookie, struct key_params*)); | 1339 | void (*callback)(void *cookie, struct key_params*)); |
1058 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, | 1340 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, |
1059 | u8 key_index, const u8 *mac_addr); | 1341 | u8 key_index, bool pairwise, const u8 *mac_addr); |
1060 | int (*set_default_key)(struct wiphy *wiphy, | 1342 | int (*set_default_key)(struct wiphy *wiphy, |
1061 | struct net_device *netdev, | 1343 | struct net_device *netdev, |
1062 | u8 key_index); | 1344 | u8 key_index, bool unicast, bool multicast); |
1063 | int (*set_default_mgmt_key)(struct wiphy *wiphy, | 1345 | int (*set_default_mgmt_key)(struct wiphy *wiphy, |
1064 | struct net_device *netdev, | 1346 | struct net_device *netdev, |
1065 | u8 key_index); | 1347 | u8 key_index); |
@@ -1094,12 +1376,17 @@ struct cfg80211_ops { | |||
1094 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, | 1376 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, |
1095 | int idx, u8 *dst, u8 *next_hop, | 1377 | int idx, u8 *dst, u8 *next_hop, |
1096 | struct mpath_info *pinfo); | 1378 | struct mpath_info *pinfo); |
1097 | int (*get_mesh_params)(struct wiphy *wiphy, | 1379 | int (*get_mesh_config)(struct wiphy *wiphy, |
1098 | struct net_device *dev, | 1380 | struct net_device *dev, |
1099 | struct mesh_config *conf); | 1381 | struct mesh_config *conf); |
1100 | int (*set_mesh_params)(struct wiphy *wiphy, | 1382 | int (*update_mesh_config)(struct wiphy *wiphy, |
1101 | struct net_device *dev, | 1383 | struct net_device *dev, u32 mask, |
1102 | const struct mesh_config *nconf, u32 mask); | 1384 | const struct mesh_config *nconf); |
1385 | int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, | ||
1386 | const struct mesh_config *conf, | ||
1387 | const struct mesh_setup *setup); | ||
1388 | int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); | ||
1389 | |||
1103 | int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, | 1390 | int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, |
1104 | struct bss_parameters *params); | 1391 | struct bss_parameters *params); |
1105 | 1392 | ||
@@ -1140,7 +1427,7 @@ struct cfg80211_ops { | |||
1140 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); | 1427 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); |
1141 | 1428 | ||
1142 | int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, | 1429 | int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, |
1143 | u8 *addr); | 1430 | const u8 *addr); |
1144 | 1431 | ||
1145 | void (*rfkill_poll)(struct wiphy *wiphy); | 1432 | void (*rfkill_poll)(struct wiphy *wiphy); |
1146 | 1433 | ||
@@ -1172,11 +1459,14 @@ struct cfg80211_ops { | |||
1172 | struct net_device *dev, | 1459 | struct net_device *dev, |
1173 | u64 cookie); | 1460 | u64 cookie); |
1174 | 1461 | ||
1175 | int (*action)(struct wiphy *wiphy, struct net_device *dev, | 1462 | int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, |
1176 | struct ieee80211_channel *chan, | 1463 | struct ieee80211_channel *chan, bool offchan, |
1177 | enum nl80211_channel_type channel_type, | 1464 | enum nl80211_channel_type channel_type, |
1178 | bool channel_type_valid, | 1465 | bool channel_type_valid, unsigned int wait, |
1179 | const u8 *buf, size_t len, u64 *cookie); | 1466 | const u8 *buf, size_t len, u64 *cookie); |
1467 | int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, | ||
1468 | struct net_device *dev, | ||
1469 | u64 cookie); | ||
1180 | 1470 | ||
1181 | int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, | 1471 | int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, |
1182 | bool enabled, int timeout); | 1472 | bool enabled, int timeout); |
@@ -1184,6 +1474,22 @@ struct cfg80211_ops { | |||
1184 | int (*set_cqm_rssi_config)(struct wiphy *wiphy, | 1474 | int (*set_cqm_rssi_config)(struct wiphy *wiphy, |
1185 | struct net_device *dev, | 1475 | struct net_device *dev, |
1186 | s32 rssi_thold, u32 rssi_hyst); | 1476 | s32 rssi_thold, u32 rssi_hyst); |
1477 | |||
1478 | void (*mgmt_frame_register)(struct wiphy *wiphy, | ||
1479 | struct net_device *dev, | ||
1480 | u16 frame_type, bool reg); | ||
1481 | |||
1482 | int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); | ||
1483 | int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); | ||
1484 | |||
1485 | int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); | ||
1486 | void (*get_ringparam)(struct wiphy *wiphy, | ||
1487 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); | ||
1488 | |||
1489 | int (*sched_scan_start)(struct wiphy *wiphy, | ||
1490 | struct net_device *dev, | ||
1491 | struct cfg80211_sched_scan_request *request); | ||
1492 | int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); | ||
1187 | }; | 1493 | }; |
1188 | 1494 | ||
1189 | /* | 1495 | /* |
@@ -1201,19 +1507,24 @@ struct cfg80211_ops { | |||
1201 | * initiator is %REGDOM_SET_BY_CORE). | 1507 | * initiator is %REGDOM_SET_BY_CORE). |
1202 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will | 1508 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will |
1203 | * ignore regulatory domain settings until it gets its own regulatory | 1509 | * ignore regulatory domain settings until it gets its own regulatory |
1204 | * domain via its regulatory_hint(). After its gets its own regulatory | 1510 | * domain via its regulatory_hint() unless the regulatory hint is |
1205 | * domain it will only allow further regulatory domain settings to | 1511 | * from a country IE. After its gets its own regulatory domain it will |
1206 | * further enhance compliance. For example if channel 13 and 14 are | 1512 | * only allow further regulatory domain settings to further enhance |
1207 | * disabled by this regulatory domain no user regulatory domain can | 1513 | * compliance. For example if channel 13 and 14 are disabled by this |
1208 | * enable these channels at a later time. This can be used for devices | 1514 | * regulatory domain no user regulatory domain can enable these channels |
1209 | * which do not have calibration information gauranteed for frequencies | 1515 | * at a later time. This can be used for devices which do not have |
1210 | * or settings outside of its regulatory domain. | 1516 | * calibration information guaranteed for frequencies or settings |
1517 | * outside of its regulatory domain. | ||
1211 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure | 1518 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure |
1212 | * that passive scan flags and beaconing flags may not be lifted by | 1519 | * that passive scan flags and beaconing flags may not be lifted by |
1213 | * cfg80211 due to regulatory beacon hints. For more information on beacon | 1520 | * cfg80211 due to regulatory beacon hints. For more information on beacon |
1214 | * hints read the documenation for regulatory_hint_found_beacon() | 1521 | * hints read the documenation for regulatory_hint_found_beacon() |
1215 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this | 1522 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this |
1216 | * wiphy at all | 1523 | * wiphy at all |
1524 | * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface | ||
1525 | * combinations for this device. This flag is used for backward | ||
1526 | * compatibility only until all drivers advertise combinations and | ||
1527 | * they will always be enforced. | ||
1217 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled | 1528 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled |
1218 | * by default -- this flag will be set depending on the kernel's default | 1529 | * by default -- this flag will be set depending on the kernel's default |
1219 | * on wiphy_new(), but can be changed by the driver if it has a good | 1530 | * on wiphy_new(), but can be changed by the driver if it has a good |
@@ -1221,24 +1532,148 @@ struct cfg80211_ops { | |||
1221 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station | 1532 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station |
1222 | * on a VLAN interface) | 1533 | * on a VLAN interface) |
1223 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station | 1534 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station |
1535 | * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the | ||
1536 | * control port protocol ethertype. The device also honours the | ||
1537 | * control_port_no_encrypt flag. | ||
1538 | * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. | ||
1539 | * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing | ||
1540 | * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. | ||
1541 | * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. | ||
1224 | */ | 1542 | */ |
1225 | enum wiphy_flags { | 1543 | enum wiphy_flags { |
1226 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1544 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
1227 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), | 1545 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), |
1228 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), | 1546 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), |
1229 | WIPHY_FLAG_NETNS_OK = BIT(3), | 1547 | WIPHY_FLAG_NETNS_OK = BIT(3), |
1230 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), | 1548 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), |
1231 | WIPHY_FLAG_4ADDR_AP = BIT(5), | 1549 | WIPHY_FLAG_4ADDR_AP = BIT(5), |
1232 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 1550 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
1551 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | ||
1552 | WIPHY_FLAG_IBSS_RSN = BIT(8), | ||
1553 | WIPHY_FLAG_MESH_AUTH = BIT(10), | ||
1554 | WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), | ||
1555 | WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12), | ||
1556 | }; | ||
1557 | |||
1558 | /** | ||
1559 | * struct ieee80211_iface_limit - limit on certain interface types | ||
1560 | * @max: maximum number of interfaces of these types | ||
1561 | * @types: interface types (bits) | ||
1562 | */ | ||
1563 | struct ieee80211_iface_limit { | ||
1564 | u16 max; | ||
1565 | u16 types; | ||
1566 | }; | ||
1567 | |||
1568 | /** | ||
1569 | * struct ieee80211_iface_combination - possible interface combination | ||
1570 | * @limits: limits for the given interface types | ||
1571 | * @n_limits: number of limitations | ||
1572 | * @num_different_channels: can use up to this many different channels | ||
1573 | * @max_interfaces: maximum number of interfaces in total allowed in this | ||
1574 | * group | ||
1575 | * @beacon_int_infra_match: In this combination, the beacon intervals | ||
1576 | * between infrastructure and AP types must match. This is required | ||
1577 | * only in special cases. | ||
1578 | * | ||
1579 | * These examples can be expressed as follows: | ||
1580 | * | ||
1581 | * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: | ||
1582 | * | ||
1583 | * struct ieee80211_iface_limit limits1[] = { | ||
1584 | * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, | ||
1585 | * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, | ||
1586 | * }; | ||
1587 | * struct ieee80211_iface_combination combination1 = { | ||
1588 | * .limits = limits1, | ||
1589 | * .n_limits = ARRAY_SIZE(limits1), | ||
1590 | * .max_interfaces = 2, | ||
1591 | * .beacon_int_infra_match = true, | ||
1592 | * }; | ||
1593 | * | ||
1594 | * | ||
1595 | * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: | ||
1596 | * | ||
1597 | * struct ieee80211_iface_limit limits2[] = { | ||
1598 | * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | | ||
1599 | * BIT(NL80211_IFTYPE_P2P_GO), }, | ||
1600 | * }; | ||
1601 | * struct ieee80211_iface_combination combination2 = { | ||
1602 | * .limits = limits2, | ||
1603 | * .n_limits = ARRAY_SIZE(limits2), | ||
1604 | * .max_interfaces = 8, | ||
1605 | * .num_different_channels = 1, | ||
1606 | * }; | ||
1607 | * | ||
1608 | * | ||
1609 | * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. | ||
1610 | * This allows for an infrastructure connection and three P2P connections. | ||
1611 | * | ||
1612 | * struct ieee80211_iface_limit limits3[] = { | ||
1613 | * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, | ||
1614 | * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | | ||
1615 | * BIT(NL80211_IFTYPE_P2P_CLIENT), }, | ||
1616 | * }; | ||
1617 | * struct ieee80211_iface_combination combination3 = { | ||
1618 | * .limits = limits3, | ||
1619 | * .n_limits = ARRAY_SIZE(limits3), | ||
1620 | * .max_interfaces = 4, | ||
1621 | * .num_different_channels = 2, | ||
1622 | * }; | ||
1623 | */ | ||
1624 | struct ieee80211_iface_combination { | ||
1625 | const struct ieee80211_iface_limit *limits; | ||
1626 | u32 num_different_channels; | ||
1627 | u16 max_interfaces; | ||
1628 | u8 n_limits; | ||
1629 | bool beacon_int_infra_match; | ||
1233 | }; | 1630 | }; |
1234 | 1631 | ||
1235 | struct mac_address { | 1632 | struct mac_address { |
1236 | u8 addr[ETH_ALEN]; | 1633 | u8 addr[ETH_ALEN]; |
1237 | }; | 1634 | }; |
1238 | 1635 | ||
1636 | struct ieee80211_txrx_stypes { | ||
1637 | u16 tx, rx; | ||
1638 | }; | ||
1639 | |||
1640 | /** | ||
1641 | * enum wiphy_wowlan_support_flags - WoWLAN support flags | ||
1642 | * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" | ||
1643 | * trigger that keeps the device operating as-is and | ||
1644 | * wakes up the host on any activity, for example a | ||
1645 | * received packet that passed filtering; note that the | ||
1646 | * packet should be preserved in that case | ||
1647 | * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet | ||
1648 | * (see nl80211.h) | ||
1649 | * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect | ||
1650 | */ | ||
1651 | enum wiphy_wowlan_support_flags { | ||
1652 | WIPHY_WOWLAN_ANY = BIT(0), | ||
1653 | WIPHY_WOWLAN_MAGIC_PKT = BIT(1), | ||
1654 | WIPHY_WOWLAN_DISCONNECT = BIT(2), | ||
1655 | }; | ||
1656 | |||
1657 | /** | ||
1658 | * struct wiphy_wowlan_support - WoWLAN support data | ||
1659 | * @flags: see &enum wiphy_wowlan_support_flags | ||
1660 | * @n_patterns: number of supported wakeup patterns | ||
1661 | * (see nl80211.h for the pattern definition) | ||
1662 | * @pattern_max_len: maximum length of each pattern | ||
1663 | * @pattern_min_len: minimum length of each pattern | ||
1664 | */ | ||
1665 | struct wiphy_wowlan_support { | ||
1666 | u32 flags; | ||
1667 | int n_patterns; | ||
1668 | int pattern_max_len; | ||
1669 | int pattern_min_len; | ||
1670 | }; | ||
1671 | |||
1239 | /** | 1672 | /** |
1240 | * struct wiphy - wireless hardware description | 1673 | * struct wiphy - wireless hardware description |
1241 | * @reg_notifier: the driver's regulatory notification callback | 1674 | * @reg_notifier: the driver's regulatory notification callback, |
1675 | * note that if your driver uses wiphy_apply_custom_regulatory() | ||
1676 | * the reg_notifier's request can be passed as NULL | ||
1242 | * @regd: the driver's regulatory domain, if one was requested via | 1677 | * @regd: the driver's regulatory domain, if one was requested via |
1243 | * the regulatory_hint() API. This can be used by the driver | 1678 | * the regulatory_hint() API. This can be used by the driver |
1244 | * on the reg_notifier() if it chooses to ignore future | 1679 | * on the reg_notifier() if it chooses to ignore future |
@@ -1271,6 +1706,11 @@ struct mac_address { | |||
1271 | * @priv: driver private data (sized according to wiphy_new() parameter) | 1706 | * @priv: driver private data (sized according to wiphy_new() parameter) |
1272 | * @interface_modes: bitmask of interfaces types valid for this wiphy, | 1707 | * @interface_modes: bitmask of interfaces types valid for this wiphy, |
1273 | * must be set by driver | 1708 | * must be set by driver |
1709 | * @iface_combinations: Valid interface combinations array, should not | ||
1710 | * list single interface types. | ||
1711 | * @n_iface_combinations: number of entries in @iface_combinations array. | ||
1712 | * @software_iftypes: bitmask of software interface types, these are not | ||
1713 | * subject to any restrictions since they are purely managed in SW. | ||
1274 | * @flags: wiphy flags, see &enum wiphy_flags | 1714 | * @flags: wiphy flags, see &enum wiphy_flags |
1275 | * @bss_priv_size: each BSS struct has private data allocated with it, | 1715 | * @bss_priv_size: each BSS struct has private data allocated with it, |
1276 | * this variable determines its size | 1716 | * this variable determines its size |
@@ -1286,6 +1726,23 @@ struct mac_address { | |||
1286 | * @privid: a pointer that drivers can use to identify if an arbitrary | 1726 | * @privid: a pointer that drivers can use to identify if an arbitrary |
1287 | * wiphy is theirs, e.g. in global notifiers | 1727 | * wiphy is theirs, e.g. in global notifiers |
1288 | * @bands: information about bands/channels supported by this device | 1728 | * @bands: information about bands/channels supported by this device |
1729 | * | ||
1730 | * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or | ||
1731 | * transmitted through nl80211, points to an array indexed by interface | ||
1732 | * type | ||
1733 | * | ||
1734 | * @available_antennas_tx: bitmap of antennas which are available to be | ||
1735 | * configured as TX antennas. Antenna configuration commands will be | ||
1736 | * rejected unless this or @available_antennas_rx is set. | ||
1737 | * | ||
1738 | * @available_antennas_rx: bitmap of antennas which are available to be | ||
1739 | * configured as RX antennas. Antenna configuration commands will be | ||
1740 | * rejected unless this or @available_antennas_tx is set. | ||
1741 | * | ||
1742 | * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation | ||
1743 | * may request, if implemented. | ||
1744 | * | ||
1745 | * @wowlan: WoWLAN support information | ||
1289 | */ | 1746 | */ |
1290 | struct wiphy { | 1747 | struct wiphy { |
1291 | /* assign these fields before you register the wiphy */ | 1748 | /* assign these fields before you register the wiphy */ |
@@ -1294,9 +1751,16 @@ struct wiphy { | |||
1294 | u8 perm_addr[ETH_ALEN]; | 1751 | u8 perm_addr[ETH_ALEN]; |
1295 | u8 addr_mask[ETH_ALEN]; | 1752 | u8 addr_mask[ETH_ALEN]; |
1296 | 1753 | ||
1297 | u16 n_addresses; | ||
1298 | struct mac_address *addresses; | 1754 | struct mac_address *addresses; |
1299 | 1755 | ||
1756 | const struct ieee80211_txrx_stypes *mgmt_stypes; | ||
1757 | |||
1758 | const struct ieee80211_iface_combination *iface_combinations; | ||
1759 | int n_iface_combinations; | ||
1760 | u16 software_iftypes; | ||
1761 | |||
1762 | u16 n_addresses; | ||
1763 | |||
1300 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | 1764 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ |
1301 | u16 interface_modes; | 1765 | u16 interface_modes; |
1302 | 1766 | ||
@@ -1320,8 +1784,15 @@ struct wiphy { | |||
1320 | char fw_version[ETHTOOL_BUSINFO_LEN]; | 1784 | char fw_version[ETHTOOL_BUSINFO_LEN]; |
1321 | u32 hw_version; | 1785 | u32 hw_version; |
1322 | 1786 | ||
1787 | struct wiphy_wowlan_support wowlan; | ||
1788 | |||
1789 | u16 max_remain_on_channel_duration; | ||
1790 | |||
1323 | u8 max_num_pmkids; | 1791 | u8 max_num_pmkids; |
1324 | 1792 | ||
1793 | u32 available_antennas_tx; | ||
1794 | u32 available_antennas_rx; | ||
1795 | |||
1325 | /* If multiple wiphys are registered and you're handed e.g. | 1796 | /* If multiple wiphys are registered and you're handed e.g. |
1326 | * a regular netdev with assigned ieee80211_ptr, you won't | 1797 | * a regular netdev with assigned ieee80211_ptr, you won't |
1327 | * know whether it points to a wiphy your driver has registered | 1798 | * know whether it points to a wiphy your driver has registered |
@@ -1487,15 +1958,19 @@ struct cfg80211_cached_keys; | |||
1487 | * @bssid: (private) Used by the internal configuration code | 1958 | * @bssid: (private) Used by the internal configuration code |
1488 | * @ssid: (private) Used by the internal configuration code | 1959 | * @ssid: (private) Used by the internal configuration code |
1489 | * @ssid_len: (private) Used by the internal configuration code | 1960 | * @ssid_len: (private) Used by the internal configuration code |
1961 | * @mesh_id_len: (private) Used by the internal configuration code | ||
1962 | * @mesh_id_up_len: (private) Used by the internal configuration code | ||
1490 | * @wext: (private) Used by the internal wireless extensions compat code | 1963 | * @wext: (private) Used by the internal wireless extensions compat code |
1491 | * @use_4addr: indicates 4addr mode is used on this interface, must be | 1964 | * @use_4addr: indicates 4addr mode is used on this interface, must be |
1492 | * set by driver (if supported) on add_interface BEFORE registering the | 1965 | * set by driver (if supported) on add_interface BEFORE registering the |
1493 | * netdev and may otherwise be used by driver read-only, will be update | 1966 | * netdev and may otherwise be used by driver read-only, will be update |
1494 | * by cfg80211 on change_interface | 1967 | * by cfg80211 on change_interface |
1495 | * @action_registrations: list of registrations for action frames | 1968 | * @mgmt_registrations: list of registrations for management frames |
1496 | * @action_registrations_lock: lock for the list | 1969 | * @mgmt_registrations_lock: lock for the list |
1497 | * @mtx: mutex used to lock data in this struct | 1970 | * @mtx: mutex used to lock data in this struct |
1498 | * @cleanup_work: work struct used for cleanup that can't be done directly | 1971 | * @cleanup_work: work struct used for cleanup that can't be done directly |
1972 | * @beacon_interval: beacon interval used on this device for transmitting | ||
1973 | * beacons, 0 when not valid | ||
1499 | */ | 1974 | */ |
1500 | struct wireless_dev { | 1975 | struct wireless_dev { |
1501 | struct wiphy *wiphy; | 1976 | struct wiphy *wiphy; |
@@ -1505,8 +1980,8 @@ struct wireless_dev { | |||
1505 | struct list_head list; | 1980 | struct list_head list; |
1506 | struct net_device *netdev; | 1981 | struct net_device *netdev; |
1507 | 1982 | ||
1508 | struct list_head action_registrations; | 1983 | struct list_head mgmt_registrations; |
1509 | spinlock_t action_registrations_lock; | 1984 | spinlock_t mgmt_registrations_lock; |
1510 | 1985 | ||
1511 | struct mutex mtx; | 1986 | struct mutex mtx; |
1512 | 1987 | ||
@@ -1516,7 +1991,7 @@ struct wireless_dev { | |||
1516 | 1991 | ||
1517 | /* currently used for IBSS and SME - might be rearranged later */ | 1992 | /* currently used for IBSS and SME - might be rearranged later */ |
1518 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 1993 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
1519 | u8 ssid_len; | 1994 | u8 ssid_len, mesh_id_len, mesh_id_up_len; |
1520 | enum { | 1995 | enum { |
1521 | CFG80211_SME_IDLE, | 1996 | CFG80211_SME_IDLE, |
1522 | CFG80211_SME_CONNECTING, | 1997 | CFG80211_SME_CONNECTING, |
@@ -1536,6 +2011,8 @@ struct wireless_dev { | |||
1536 | bool ps; | 2011 | bool ps; |
1537 | int ps_timeout; | 2012 | int ps_timeout; |
1538 | 2013 | ||
2014 | int beacon_interval; | ||
2015 | |||
1539 | #ifdef CONFIG_CFG80211_WEXT | 2016 | #ifdef CONFIG_CFG80211_WEXT |
1540 | /* wext data */ | 2017 | /* wext data */ |
1541 | struct { | 2018 | struct { |
@@ -1563,15 +2040,18 @@ static inline void *wdev_priv(struct wireless_dev *wdev) | |||
1563 | return wiphy_priv(wdev->wiphy); | 2040 | return wiphy_priv(wdev->wiphy); |
1564 | } | 2041 | } |
1565 | 2042 | ||
1566 | /* | 2043 | /** |
1567 | * Utility functions | 2044 | * DOC: Utility functions |
2045 | * | ||
2046 | * cfg80211 offers a number of utility functions that can be useful. | ||
1568 | */ | 2047 | */ |
1569 | 2048 | ||
1570 | /** | 2049 | /** |
1571 | * ieee80211_channel_to_frequency - convert channel number to frequency | 2050 | * ieee80211_channel_to_frequency - convert channel number to frequency |
1572 | * @chan: channel number | 2051 | * @chan: channel number |
2052 | * @band: band, necessary due to channel number overlap | ||
1573 | */ | 2053 | */ |
1574 | extern int ieee80211_channel_to_frequency(int chan); | 2054 | extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); |
1575 | 2055 | ||
1576 | /** | 2056 | /** |
1577 | * ieee80211_frequency_to_channel - convert frequency to channel number | 2057 | * ieee80211_frequency_to_channel - convert frequency to channel number |
@@ -1715,7 +2195,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | |||
1715 | * ieee80211_hdrlen - get header length in bytes from frame control | 2195 | * ieee80211_hdrlen - get header length in bytes from frame control |
1716 | * @fc: frame control field in little-endian format | 2196 | * @fc: frame control field in little-endian format |
1717 | */ | 2197 | */ |
1718 | unsigned int ieee80211_hdrlen(__le16 fc); | 2198 | unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); |
2199 | |||
2200 | /** | ||
2201 | * DOC: Data path helpers | ||
2202 | * | ||
2203 | * In addition to generic utilities, cfg80211 also offers | ||
2204 | * functions that help implement the data path for devices | ||
2205 | * that do not do the 802.11/802.3 conversion on the device. | ||
2206 | */ | ||
1719 | 2207 | ||
1720 | /** | 2208 | /** |
1721 | * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 | 2209 | * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 |
@@ -1750,10 +2238,12 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, | |||
1750 | * @addr: The device MAC address. | 2238 | * @addr: The device MAC address. |
1751 | * @iftype: The device interface type. | 2239 | * @iftype: The device interface type. |
1752 | * @extra_headroom: The hardware extra headroom for SKBs in the @list. | 2240 | * @extra_headroom: The hardware extra headroom for SKBs in the @list. |
2241 | * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. | ||
1753 | */ | 2242 | */ |
1754 | void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, | 2243 | void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, |
1755 | const u8 *addr, enum nl80211_iftype iftype, | 2244 | const u8 *addr, enum nl80211_iftype iftype, |
1756 | const unsigned int extra_headroom); | 2245 | const unsigned int extra_headroom, |
2246 | bool has_80211_header); | ||
1757 | 2247 | ||
1758 | /** | 2248 | /** |
1759 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame | 2249 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame |
@@ -1777,8 +2267,10 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb); | |||
1777 | */ | 2267 | */ |
1778 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); | 2268 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); |
1779 | 2269 | ||
1780 | /* | 2270 | /** |
1781 | * Regulatory helper functions for wiphys | 2271 | * DOC: Regulatory enforcement infrastructure |
2272 | * | ||
2273 | * TODO | ||
1782 | */ | 2274 | */ |
1783 | 2275 | ||
1784 | /** | 2276 | /** |
@@ -1971,6 +2463,24 @@ int cfg80211_wext_siwpmksa(struct net_device *dev, | |||
1971 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); | 2463 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); |
1972 | 2464 | ||
1973 | /** | 2465 | /** |
2466 | * cfg80211_sched_scan_results - notify that new scan results are available | ||
2467 | * | ||
2468 | * @wiphy: the wiphy which got scheduled scan results | ||
2469 | */ | ||
2470 | void cfg80211_sched_scan_results(struct wiphy *wiphy); | ||
2471 | |||
2472 | /** | ||
2473 | * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped | ||
2474 | * | ||
2475 | * @wiphy: the wiphy on which the scheduled scan stopped | ||
2476 | * | ||
2477 | * The driver can call this function to inform cfg80211 that the | ||
2478 | * scheduled scan had to be stopped, for whatever reason. The driver | ||
2479 | * is then called back via the sched_scan_stop operation when done. | ||
2480 | */ | ||
2481 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); | ||
2482 | |||
2483 | /** | ||
1974 | * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame | 2484 | * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame |
1975 | * | 2485 | * |
1976 | * @wiphy: the wiphy reporting the BSS | 2486 | * @wiphy: the wiphy reporting the BSS |
@@ -2148,11 +2658,37 @@ void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, | |||
2148 | size_t len); | 2658 | size_t len); |
2149 | 2659 | ||
2150 | /** | 2660 | /** |
2661 | * cfg80211_send_unprot_deauth - notification of unprotected deauthentication | ||
2662 | * @dev: network device | ||
2663 | * @buf: deauthentication frame (header + body) | ||
2664 | * @len: length of the frame data | ||
2665 | * | ||
2666 | * This function is called whenever a received Deauthentication frame has been | ||
2667 | * dropped in station mode because of MFP being used but the Deauthentication | ||
2668 | * frame was not protected. This function may sleep. | ||
2669 | */ | ||
2670 | void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, | ||
2671 | size_t len); | ||
2672 | |||
2673 | /** | ||
2674 | * cfg80211_send_unprot_disassoc - notification of unprotected disassociation | ||
2675 | * @dev: network device | ||
2676 | * @buf: disassociation frame (header + body) | ||
2677 | * @len: length of the frame data | ||
2678 | * | ||
2679 | * This function is called whenever a received Disassociation frame has been | ||
2680 | * dropped in station mode because of MFP being used but the Disassociation | ||
2681 | * frame was not protected. This function may sleep. | ||
2682 | */ | ||
2683 | void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, | ||
2684 | size_t len); | ||
2685 | |||
2686 | /** | ||
2151 | * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) | 2687 | * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) |
2152 | * @dev: network device | 2688 | * @dev: network device |
2153 | * @addr: The source MAC address of the frame | 2689 | * @addr: The source MAC address of the frame |
2154 | * @key_type: The key type that the received frame used | 2690 | * @key_type: The key type that the received frame used |
2155 | * @key_id: Key identifier (0..3) | 2691 | * @key_id: Key identifier (0..3). Can be -1 if missing. |
2156 | * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) | 2692 | * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) |
2157 | * @gfp: allocation flags | 2693 | * @gfp: allocation flags |
2158 | * | 2694 | * |
@@ -2181,6 +2717,36 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
2181 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); | 2717 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); |
2182 | 2718 | ||
2183 | /** | 2719 | /** |
2720 | * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate | ||
2721 | * | ||
2722 | * @dev: network device | ||
2723 | * @macaddr: the MAC address of the new candidate | ||
2724 | * @ie: information elements advertised by the peer candidate | ||
2725 | * @ie_len: lenght of the information elements buffer | ||
2726 | * @gfp: allocation flags | ||
2727 | * | ||
2728 | * This function notifies cfg80211 that the mesh peer candidate has been | ||
2729 | * detected, most likely via a beacon or, less likely, via a probe response. | ||
2730 | * cfg80211 then sends a notification to userspace. | ||
2731 | */ | ||
2732 | void cfg80211_notify_new_peer_candidate(struct net_device *dev, | ||
2733 | const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); | ||
2734 | |||
2735 | /** | ||
2736 | * DOC: RFkill integration | ||
2737 | * | ||
2738 | * RFkill integration in cfg80211 is almost invisible to drivers, | ||
2739 | * as cfg80211 automatically registers an rfkill instance for each | ||
2740 | * wireless device it knows about. Soft kill is also translated | ||
2741 | * into disconnecting and turning all interfaces off, drivers are | ||
2742 | * expected to turn off the device when all interfaces are down. | ||
2743 | * | ||
2744 | * However, devices may have a hard RFkill line, in which case they | ||
2745 | * also need to interact with the rfkill subsystem, via cfg80211. | ||
2746 | * They can do this with a few helper functions documented here. | ||
2747 | */ | ||
2748 | |||
2749 | /** | ||
2184 | * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state | 2750 | * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state |
2185 | * @wiphy: the wiphy | 2751 | * @wiphy: the wiphy |
2186 | * @blocked: block status | 2752 | * @blocked: block status |
@@ -2201,6 +2767,17 @@ void wiphy_rfkill_stop_polling(struct wiphy *wiphy); | |||
2201 | 2767 | ||
2202 | #ifdef CONFIG_NL80211_TESTMODE | 2768 | #ifdef CONFIG_NL80211_TESTMODE |
2203 | /** | 2769 | /** |
2770 | * DOC: Test mode | ||
2771 | * | ||
2772 | * Test mode is a set of utility functions to allow drivers to | ||
2773 | * interact with driver-specific tools to aid, for instance, | ||
2774 | * factory programming. | ||
2775 | * | ||
2776 | * This chapter describes how drivers interact with it, for more | ||
2777 | * information see the nl80211 book's chapter on it. | ||
2778 | */ | ||
2779 | |||
2780 | /** | ||
2204 | * cfg80211_testmode_alloc_reply_skb - allocate testmode reply | 2781 | * cfg80211_testmode_alloc_reply_skb - allocate testmode reply |
2205 | * @wiphy: the wiphy | 2782 | * @wiphy: the wiphy |
2206 | * @approxlen: an upper bound of the length of the data that will | 2783 | * @approxlen: an upper bound of the length of the data that will |
@@ -2302,6 +2879,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
2302 | * cfg80211_roamed - notify cfg80211 of roaming | 2879 | * cfg80211_roamed - notify cfg80211 of roaming |
2303 | * | 2880 | * |
2304 | * @dev: network device | 2881 | * @dev: network device |
2882 | * @channel: the channel of the new AP | ||
2305 | * @bssid: the BSSID of the new AP | 2883 | * @bssid: the BSSID of the new AP |
2306 | * @req_ie: association request IEs (maybe be %NULL) | 2884 | * @req_ie: association request IEs (maybe be %NULL) |
2307 | * @req_ie_len: association request IEs length | 2885 | * @req_ie_len: association request IEs length |
@@ -2312,7 +2890,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
2312 | * It should be called by the underlying driver whenever it roamed | 2890 | * It should be called by the underlying driver whenever it roamed |
2313 | * from one AP to another while connected. | 2891 | * from one AP to another while connected. |
2314 | */ | 2892 | */ |
2315 | void cfg80211_roamed(struct net_device *dev, const u8 *bssid, | 2893 | void cfg80211_roamed(struct net_device *dev, |
2894 | struct ieee80211_channel *channel, | ||
2895 | const u8 *bssid, | ||
2316 | const u8 *req_ie, size_t req_ie_len, | 2896 | const u8 *req_ie, size_t req_ie_len, |
2317 | const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); | 2897 | const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); |
2318 | 2898 | ||
@@ -2373,38 +2953,48 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
2373 | struct station_info *sinfo, gfp_t gfp); | 2953 | struct station_info *sinfo, gfp_t gfp); |
2374 | 2954 | ||
2375 | /** | 2955 | /** |
2376 | * cfg80211_rx_action - notification of received, unprocessed Action frame | 2956 | * cfg80211_del_sta - notify userspace about deletion of a station |
2957 | * | ||
2958 | * @dev: the netdev | ||
2959 | * @mac_addr: the station's address | ||
2960 | * @gfp: allocation flags | ||
2961 | */ | ||
2962 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | ||
2963 | |||
2964 | /** | ||
2965 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame | ||
2377 | * @dev: network device | 2966 | * @dev: network device |
2378 | * @freq: Frequency on which the frame was received in MHz | 2967 | * @freq: Frequency on which the frame was received in MHz |
2379 | * @buf: Action frame (header + body) | 2968 | * @buf: Management frame (header + body) |
2380 | * @len: length of the frame data | 2969 | * @len: length of the frame data |
2381 | * @gfp: context flags | 2970 | * @gfp: context flags |
2382 | * Returns %true if a user space application is responsible for rejecting the | 2971 | * |
2383 | * unrecognized Action frame; %false if no such application is registered | 2972 | * Returns %true if a user space application has registered for this frame. |
2384 | * (i.e., the driver is responsible for rejecting the unrecognized Action | 2973 | * For action frames, that makes it responsible for rejecting unrecognized |
2385 | * frame) | 2974 | * action frames; %false otherwise, in which case for action frames the |
2975 | * driver is responsible for rejecting the frame. | ||
2386 | * | 2976 | * |
2387 | * This function is called whenever an Action frame is received for a station | 2977 | * This function is called whenever an Action frame is received for a station |
2388 | * mode interface, but is not processed in kernel. | 2978 | * mode interface, but is not processed in kernel. |
2389 | */ | 2979 | */ |
2390 | bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, | 2980 | bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, |
2391 | size_t len, gfp_t gfp); | 2981 | size_t len, gfp_t gfp); |
2392 | 2982 | ||
2393 | /** | 2983 | /** |
2394 | * cfg80211_action_tx_status - notification of TX status for Action frame | 2984 | * cfg80211_mgmt_tx_status - notification of TX status for management frame |
2395 | * @dev: network device | 2985 | * @dev: network device |
2396 | * @cookie: Cookie returned by cfg80211_ops::action() | 2986 | * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() |
2397 | * @buf: Action frame (header + body) | 2987 | * @buf: Management frame (header + body) |
2398 | * @len: length of the frame data | 2988 | * @len: length of the frame data |
2399 | * @ack: Whether frame was acknowledged | 2989 | * @ack: Whether frame was acknowledged |
2400 | * @gfp: context flags | 2990 | * @gfp: context flags |
2401 | * | 2991 | * |
2402 | * This function is called whenever an Action frame was requested to be | 2992 | * This function is called whenever a management frame was requested to be |
2403 | * transmitted with cfg80211_ops::action() to report the TX status of the | 2993 | * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the |
2404 | * transmission attempt. | 2994 | * transmission attempt. |
2405 | */ | 2995 | */ |
2406 | void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, | 2996 | void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, |
2407 | const u8 *buf, size_t len, bool ack, gfp_t gfp); | 2997 | const u8 *buf, size_t len, bool ack, gfp_t gfp); |
2408 | 2998 | ||
2409 | 2999 | ||
2410 | /** | 3000 | /** |
@@ -2420,56 +3010,53 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, | 3010 | enum nl80211_cqm_rssi_threshold_event rssi_event, |
2421 | gfp_t gfp); | 3011 | gfp_t gfp); |
2422 | 3012 | ||
2423 | #ifdef __KERNEL__ | 3013 | /** |
3014 | * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer | ||
3015 | * @dev: network device | ||
3016 | * @peer: peer's MAC address | ||
3017 | * @num_packets: how many packets were lost -- should be a fixed threshold | ||
3018 | * but probably no less than maybe 50, or maybe a throughput dependent | ||
3019 | * threshold (to account for temporary interference) | ||
3020 | * @gfp: context flags | ||
3021 | */ | ||
3022 | void cfg80211_cqm_pktloss_notify(struct net_device *dev, | ||
3023 | const u8 *peer, u32 num_packets, gfp_t gfp); | ||
2424 | 3024 | ||
2425 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3025 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
2426 | 3026 | ||
2427 | /* wiphy_printk helpers, similar to dev_printk */ | 3027 | /* wiphy_printk helpers, similar to dev_printk */ |
2428 | 3028 | ||
2429 | #define wiphy_printk(level, wiphy, format, args...) \ | 3029 | #define wiphy_printk(level, wiphy, format, args...) \ |
2430 | printk(level "%s: " format, wiphy_name(wiphy), ##args) | 3030 | dev_printk(level, &(wiphy)->dev, format, ##args) |
2431 | #define wiphy_emerg(wiphy, format, args...) \ | 3031 | #define wiphy_emerg(wiphy, format, args...) \ |
2432 | wiphy_printk(KERN_EMERG, wiphy, format, ##args) | 3032 | dev_emerg(&(wiphy)->dev, format, ##args) |
2433 | #define wiphy_alert(wiphy, format, args...) \ | 3033 | #define wiphy_alert(wiphy, format, args...) \ |
2434 | wiphy_printk(KERN_ALERT, wiphy, format, ##args) | 3034 | dev_alert(&(wiphy)->dev, format, ##args) |
2435 | #define wiphy_crit(wiphy, format, args...) \ | 3035 | #define wiphy_crit(wiphy, format, args...) \ |
2436 | wiphy_printk(KERN_CRIT, wiphy, format, ##args) | 3036 | dev_crit(&(wiphy)->dev, format, ##args) |
2437 | #define wiphy_err(wiphy, format, args...) \ | 3037 | #define wiphy_err(wiphy, format, args...) \ |
2438 | wiphy_printk(KERN_ERR, wiphy, format, ##args) | 3038 | dev_err(&(wiphy)->dev, format, ##args) |
2439 | #define wiphy_warn(wiphy, format, args...) \ | 3039 | #define wiphy_warn(wiphy, format, args...) \ |
2440 | wiphy_printk(KERN_WARNING, wiphy, format, ##args) | 3040 | dev_warn(&(wiphy)->dev, format, ##args) |
2441 | #define wiphy_notice(wiphy, format, args...) \ | 3041 | #define wiphy_notice(wiphy, format, args...) \ |
2442 | wiphy_printk(KERN_NOTICE, wiphy, format, ##args) | 3042 | dev_notice(&(wiphy)->dev, format, ##args) |
2443 | #define wiphy_info(wiphy, format, args...) \ | 3043 | #define wiphy_info(wiphy, format, args...) \ |
2444 | wiphy_printk(KERN_INFO, wiphy, format, ##args) | 3044 | dev_info(&(wiphy)->dev, format, ##args) |
2445 | |||
2446 | int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) | ||
2447 | __attribute__ ((format (printf, 2, 3))); | ||
2448 | 3045 | ||
2449 | #if defined(DEBUG) | 3046 | #define wiphy_debug(wiphy, format, args...) \ |
2450 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2451 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | 3047 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) |
2452 | #elif defined(CONFIG_DYNAMIC_DEBUG) | 3048 | |
2453 | #define wiphy_dbg(wiphy, format, args...) \ | 3049 | #define wiphy_dbg(wiphy, format, args...) \ |
2454 | dynamic_pr_debug("%s: " format, wiphy_name(wiphy), ##args) | 3050 | dev_dbg(&(wiphy)->dev, format, ##args) |
2455 | #else | ||
2456 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2457 | ({ \ | ||
2458 | if (0) \ | ||
2459 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2460 | 0; \ | ||
2461 | }) | ||
2462 | #endif | ||
2463 | 3051 | ||
2464 | #if defined(VERBOSE_DEBUG) | 3052 | #if defined(VERBOSE_DEBUG) |
2465 | #define wiphy_vdbg wiphy_dbg | 3053 | #define wiphy_vdbg wiphy_dbg |
2466 | #else | 3054 | #else |
2467 | |||
2468 | #define wiphy_vdbg(wiphy, format, args...) \ | 3055 | #define wiphy_vdbg(wiphy, format, args...) \ |
2469 | ({ \ | 3056 | ({ \ |
2470 | if (0) \ | 3057 | if (0) \ |
2471 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | 3058 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ |
2472 | 0; \ | 3059 | 0; \ |
2473 | }) | 3060 | }) |
2474 | #endif | 3061 | #endif |
2475 | 3062 | ||
@@ -2481,6 +3068,4 @@ int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) | |||
2481 | #define wiphy_WARN(wiphy, format, args...) \ | 3068 | #define wiphy_WARN(wiphy, format, args...) \ |
2482 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); | 3069 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); |
2483 | 3070 | ||
2484 | #endif | ||
2485 | |||
2486 | #endif /* __NET_CFG80211_H */ | 3071 | #endif /* __NET_CFG80211_H */ |