diff options
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r-- | include/net/mac80211.h | 586 |
1 files changed, 438 insertions, 148 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 998c30fc8981..45d7d44d7cbe 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright 2002-2005, Devicescape Software, Inc. | 4 | * Copyright 2002-2005, Devicescape Software, Inc. |
5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
6 | * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 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 | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -107,25 +107,14 @@ enum ieee80211_max_queues { | |||
107 | * 2^n-1 in the range 1..32767] | 107 | * 2^n-1 in the range 1..32767] |
108 | * @cw_max: maximum contention window [like @cw_min] | 108 | * @cw_max: maximum contention window [like @cw_min] |
109 | * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled | 109 | * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled |
110 | * @uapsd: is U-APSD mode enabled for the queue | ||
110 | */ | 111 | */ |
111 | struct ieee80211_tx_queue_params { | 112 | struct ieee80211_tx_queue_params { |
112 | u16 txop; | 113 | u16 txop; |
113 | u16 cw_min; | 114 | u16 cw_min; |
114 | u16 cw_max; | 115 | u16 cw_max; |
115 | u8 aifs; | 116 | u8 aifs; |
116 | }; | 117 | bool uapsd; |
117 | |||
118 | /** | ||
119 | * struct ieee80211_tx_queue_stats - transmit queue statistics | ||
120 | * | ||
121 | * @len: number of packets in queue | ||
122 | * @limit: queue length limit | ||
123 | * @count: number of frames sent | ||
124 | */ | ||
125 | struct ieee80211_tx_queue_stats { | ||
126 | unsigned int len; | ||
127 | unsigned int limit; | ||
128 | unsigned int count; | ||
129 | }; | 118 | }; |
130 | 119 | ||
131 | struct ieee80211_low_level_stats { | 120 | struct ieee80211_low_level_stats { |
@@ -184,7 +173,8 @@ enum ieee80211_bss_change { | |||
184 | * @use_short_slot: use short slot time (only relevant for ERP); | 173 | * @use_short_slot: use short slot time (only relevant for ERP); |
185 | * if the hardware cannot handle this it must set the | 174 | * if the hardware cannot handle this it must set the |
186 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag | 175 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag |
187 | * @dtim_period: num of beacons before the next DTIM, for PSM | 176 | * @dtim_period: num of beacons before the next DTIM, for beaconing, |
177 | * not valid in station mode (cf. hw conf ps_dtim_period) | ||
188 | * @timestamp: beacon timestamp | 178 | * @timestamp: beacon timestamp |
189 | * @beacon_int: beacon interval | 179 | * @beacon_int: beacon interval |
190 | * @assoc_capability: capabilities taken from assoc resp | 180 | * @assoc_capability: capabilities taken from assoc resp |
@@ -219,7 +209,7 @@ struct ieee80211_bss_conf { | |||
219 | * | 209 | * |
220 | * These flags are used with the @flags member of &ieee80211_tx_info. | 210 | * These flags are used with the @flags member of &ieee80211_tx_info. |
221 | * | 211 | * |
222 | * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. | 212 | * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. |
223 | * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence | 213 | * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence |
224 | * number to this frame, taking care of not overwriting the fragment | 214 | * number to this frame, taking care of not overwriting the fragment |
225 | * number and increasing the sequence number only when the | 215 | * number and increasing the sequence number only when the |
@@ -255,9 +245,6 @@ struct ieee80211_bss_conf { | |||
255 | * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be | 245 | * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be |
256 | * set by rate control algorithms to indicate probe rate, will | 246 | * set by rate control algorithms to indicate probe rate, will |
257 | * be cleared for fragmented frames (except on the last fragment) | 247 | * be cleared for fragmented frames (except on the last fragment) |
258 | * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or | ||
259 | * set this flag in the driver; indicates that the rate control | ||
260 | * algorithm was used and should be notified of TX status | ||
261 | * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, | 248 | * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, |
262 | * used to indicate that a pending frame requires TX processing before | 249 | * used to indicate that a pending frame requires TX processing before |
263 | * it can be sent out. | 250 | * it can be sent out. |
@@ -272,6 +259,14 @@ struct ieee80211_bss_conf { | |||
272 | * transmit function after the current frame, this can be used | 259 | * transmit function after the current frame, this can be used |
273 | * by drivers to kick the DMA queue only if unset or when the | 260 | * by drivers to kick the DMA queue only if unset or when the |
274 | * queue gets full. | 261 | * queue gets full. |
262 | * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted | ||
263 | * after TX status because the destination was asleep, it must not | ||
264 | * be modified again (no seqno assignment, crypto, etc.) | ||
265 | * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still | ||
266 | * has a radiotap header at skb->data. | ||
267 | * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 | ||
268 | * MLME command (internal to mac80211 to figure out whether to send TX | ||
269 | * status to user space) | ||
275 | */ | 270 | */ |
276 | enum mac80211_tx_control_flags { | 271 | enum mac80211_tx_control_flags { |
277 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 272 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
@@ -287,12 +282,14 @@ enum mac80211_tx_control_flags { | |||
287 | IEEE80211_TX_STAT_AMPDU = BIT(10), | 282 | IEEE80211_TX_STAT_AMPDU = BIT(10), |
288 | IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), | 283 | IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), |
289 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), | 284 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), |
290 | IEEE80211_TX_INTFL_RCALGO = BIT(13), | ||
291 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), | 285 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), |
292 | IEEE80211_TX_INTFL_RETRIED = BIT(15), | 286 | IEEE80211_TX_INTFL_RETRIED = BIT(15), |
293 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), | 287 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), |
294 | IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), | 288 | IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), |
295 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), | 289 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), |
290 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), | ||
291 | IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), | ||
292 | IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), | ||
296 | }; | 293 | }; |
297 | 294 | ||
298 | /** | 295 | /** |
@@ -390,10 +387,12 @@ struct ieee80211_tx_rate { | |||
390 | * @control: union for control data | 387 | * @control: union for control data |
391 | * @status: union for status data | 388 | * @status: union for status data |
392 | * @driver_data: array of driver_data pointers | 389 | * @driver_data: array of driver_data pointers |
393 | * @ampdu_ack_len: number of aggregated frames. | 390 | * @ampdu_ack_len: number of acked aggregated frames. |
394 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 391 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. |
395 | * @ampdu_ack_map: block ack bit map for the aggregation. | 392 | * @ampdu_ack_map: block ack bit map for the aggregation. |
396 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 393 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. |
394 | * @ampdu_len: number of aggregated frames. | ||
395 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | ||
397 | * @ack_signal: signal strength of the ACK frame | 396 | * @ack_signal: signal strength of the ACK frame |
398 | */ | 397 | */ |
399 | struct ieee80211_tx_info { | 398 | struct ieee80211_tx_info { |
@@ -428,7 +427,8 @@ struct ieee80211_tx_info { | |||
428 | u8 ampdu_ack_len; | 427 | u8 ampdu_ack_len; |
429 | u64 ampdu_ack_map; | 428 | u64 ampdu_ack_map; |
430 | int ack_signal; | 429 | int ack_signal; |
431 | /* 8 bytes free */ | 430 | u8 ampdu_len; |
431 | /* 7 bytes free */ | ||
432 | } status; | 432 | } status; |
433 | struct { | 433 | struct { |
434 | struct ieee80211_tx_rate driver_rates[ | 434 | struct ieee80211_tx_rate driver_rates[ |
@@ -494,7 +494,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
494 | * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. | 494 | * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. |
495 | * Use together with %RX_FLAG_MMIC_STRIPPED. | 495 | * Use together with %RX_FLAG_MMIC_STRIPPED. |
496 | * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. | 496 | * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. |
497 | * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header. | ||
498 | * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, | 497 | * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, |
499 | * verification has been done by the hardware. | 498 | * verification has been done by the hardware. |
500 | * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. | 499 | * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. |
@@ -511,11 +510,13 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
511 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 510 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
512 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 511 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
513 | * @RX_FLAG_SHORT_GI: Short guard interval was used | 512 | * @RX_FLAG_SHORT_GI: Short guard interval was used |
513 | * @RX_FLAG_INTERNAL_CMTR: set internally after frame was reported | ||
514 | * on cooked monitor to avoid double-reporting it for multiple | ||
515 | * virtual interfaces | ||
514 | */ | 516 | */ |
515 | enum mac80211_rx_flags { | 517 | enum mac80211_rx_flags { |
516 | RX_FLAG_MMIC_ERROR = 1<<0, | 518 | RX_FLAG_MMIC_ERROR = 1<<0, |
517 | RX_FLAG_DECRYPTED = 1<<1, | 519 | RX_FLAG_DECRYPTED = 1<<1, |
518 | RX_FLAG_RADIOTAP = 1<<2, | ||
519 | RX_FLAG_MMIC_STRIPPED = 1<<3, | 520 | RX_FLAG_MMIC_STRIPPED = 1<<3, |
520 | RX_FLAG_IV_STRIPPED = 1<<4, | 521 | RX_FLAG_IV_STRIPPED = 1<<4, |
521 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 522 | RX_FLAG_FAILED_FCS_CRC = 1<<5, |
@@ -525,6 +526,7 @@ enum mac80211_rx_flags { | |||
525 | RX_FLAG_HT = 1<<9, | 526 | RX_FLAG_HT = 1<<9, |
526 | RX_FLAG_40MHZ = 1<<10, | 527 | RX_FLAG_40MHZ = 1<<10, |
527 | RX_FLAG_SHORT_GI = 1<<11, | 528 | RX_FLAG_SHORT_GI = 1<<11, |
529 | RX_FLAG_INTERNAL_CMTR = 1<<12, | ||
528 | }; | 530 | }; |
529 | 531 | ||
530 | /** | 532 | /** |
@@ -542,7 +544,6 @@ enum mac80211_rx_flags { | |||
542 | * unspecified depending on the hardware capabilities flags | 544 | * unspecified depending on the hardware capabilities flags |
543 | * @IEEE80211_HW_SIGNAL_* | 545 | * @IEEE80211_HW_SIGNAL_* |
544 | * @noise: noise when receiving this frame, in dBm. | 546 | * @noise: noise when receiving this frame, in dBm. |
545 | * @qual: overall signal quality indication, in percent (0-100). | ||
546 | * @antenna: antenna used | 547 | * @antenna: antenna used |
547 | * @rate_idx: index of data rate into band's supported rates or MCS index if | 548 | * @rate_idx: index of data rate into band's supported rates or MCS index if |
548 | * HT rates are use (RX_FLAG_HT) | 549 | * HT rates are use (RX_FLAG_HT) |
@@ -554,7 +555,6 @@ struct ieee80211_rx_status { | |||
554 | int freq; | 555 | int freq; |
555 | int signal; | 556 | int signal; |
556 | int noise; | 557 | int noise; |
557 | int qual; | ||
558 | int antenna; | 558 | int antenna; |
559 | int rate_idx; | 559 | int rate_idx; |
560 | int flag; | 560 | int flag; |
@@ -565,8 +565,16 @@ struct ieee80211_rx_status { | |||
565 | * | 565 | * |
566 | * Flags to define PHY configuration options | 566 | * Flags to define PHY configuration options |
567 | * | 567 | * |
568 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 568 | * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this |
569 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) | 569 | * to determine for example whether to calculate timestamps for packets |
570 | * or not, do not use instead of filter flags! | ||
571 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only). | ||
572 | * This is the power save mode defined by IEEE 802.11-2007 section 11.2, | ||
573 | * meaning that the hardware still wakes up for beacons, is able to | ||
574 | * transmit frames and receive the possible acknowledgment frames. | ||
575 | * Not to be confused with hardware specific wakeup/sleep states, | ||
576 | * driver is responsible for that. See the section "Powersave support" | ||
577 | * for more. | ||
570 | * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set | 578 | * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set |
571 | * the driver should be prepared to handle configuration requests but | 579 | * the driver should be prepared to handle configuration requests but |
572 | * may turn the device off as much as possible. Typically, this flag will | 580 | * may turn the device off as much as possible. Typically, this flag will |
@@ -574,7 +582,7 @@ struct ieee80211_rx_status { | |||
574 | * it can also be unset in that case when monitor interfaces are active. | 582 | * it can also be unset in that case when monitor interfaces are active. |
575 | */ | 583 | */ |
576 | enum ieee80211_conf_flags { | 584 | enum ieee80211_conf_flags { |
577 | IEEE80211_CONF_RADIOTAP = (1<<0), | 585 | IEEE80211_CONF_MONITOR = (1<<0), |
578 | IEEE80211_CONF_PS = (1<<1), | 586 | IEEE80211_CONF_PS = (1<<1), |
579 | IEEE80211_CONF_IDLE = (1<<2), | 587 | IEEE80211_CONF_IDLE = (1<<2), |
580 | }; | 588 | }; |
@@ -584,16 +592,18 @@ enum ieee80211_conf_flags { | |||
584 | * enum ieee80211_conf_changed - denotes which configuration changed | 592 | * enum ieee80211_conf_changed - denotes which configuration changed |
585 | * | 593 | * |
586 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed | 594 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed |
587 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed | 595 | * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed |
588 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed | 596 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed |
589 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed | 597 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed |
590 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed | 598 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed |
591 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed | 599 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed |
592 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed | 600 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed |
601 | * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed | ||
593 | */ | 602 | */ |
594 | enum ieee80211_conf_changed { | 603 | enum ieee80211_conf_changed { |
604 | IEEE80211_CONF_CHANGE_SMPS = BIT(1), | ||
595 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), | 605 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), |
596 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), | 606 | IEEE80211_CONF_CHANGE_MONITOR = BIT(3), |
597 | IEEE80211_CONF_CHANGE_PS = BIT(4), | 607 | IEEE80211_CONF_CHANGE_PS = BIT(4), |
598 | IEEE80211_CONF_CHANGE_POWER = BIT(5), | 608 | IEEE80211_CONF_CHANGE_POWER = BIT(5), |
599 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), | 609 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), |
@@ -602,6 +612,25 @@ enum ieee80211_conf_changed { | |||
602 | }; | 612 | }; |
603 | 613 | ||
604 | /** | 614 | /** |
615 | * enum ieee80211_smps_mode - spatial multiplexing power save mode | ||
616 | * | ||
617 | * @IEEE80211_SMPS_AUTOMATIC: automatic | ||
618 | * @IEEE80211_SMPS_OFF: off | ||
619 | * @IEEE80211_SMPS_STATIC: static | ||
620 | * @IEEE80211_SMPS_DYNAMIC: dynamic | ||
621 | * @IEEE80211_SMPS_NUM_MODES: internal, don't use | ||
622 | */ | ||
623 | enum ieee80211_smps_mode { | ||
624 | IEEE80211_SMPS_AUTOMATIC, | ||
625 | IEEE80211_SMPS_OFF, | ||
626 | IEEE80211_SMPS_STATIC, | ||
627 | IEEE80211_SMPS_DYNAMIC, | ||
628 | |||
629 | /* keep last */ | ||
630 | IEEE80211_SMPS_NUM_MODES, | ||
631 | }; | ||
632 | |||
633 | /** | ||
605 | * struct ieee80211_conf - configuration of the device | 634 | * struct ieee80211_conf - configuration of the device |
606 | * | 635 | * |
607 | * This struct indicates how the driver shall configure the hardware. | 636 | * This struct indicates how the driver shall configure the hardware. |
@@ -614,6 +643,9 @@ enum ieee80211_conf_changed { | |||
614 | * value will be only achievable between DTIM frames, the hardware | 643 | * value will be only achievable between DTIM frames, the hardware |
615 | * needs to check for the multicast traffic bit in DTIM beacons. | 644 | * needs to check for the multicast traffic bit in DTIM beacons. |
616 | * This variable is valid only when the CONF_PS flag is set. | 645 | * This variable is valid only when the CONF_PS flag is set. |
646 | * @ps_dtim_period: The DTIM period of the AP we're connected to, for use | ||
647 | * in power saving. Power saving will not be enabled until a beacon | ||
648 | * has been received and the DTIM period is known. | ||
617 | * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the | 649 | * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the |
618 | * powersave documentation below. This variable is valid only when | 650 | * powersave documentation below. This variable is valid only when |
619 | * the CONF_PS flag is set. | 651 | * the CONF_PS flag is set. |
@@ -629,6 +661,10 @@ enum ieee80211_conf_changed { | |||
629 | * @short_frame_max_tx_count: Maximum number of transmissions for a "short" | 661 | * @short_frame_max_tx_count: Maximum number of transmissions for a "short" |
630 | * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the | 662 | * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the |
631 | * number of transmissions not the number of retries | 663 | * number of transmissions not the number of retries |
664 | * | ||
665 | * @smps_mode: spatial multiplexing powersave mode; note that | ||
666 | * %IEEE80211_SMPS_STATIC is used when the device is not | ||
667 | * configured for an HT channel | ||
632 | */ | 668 | */ |
633 | struct ieee80211_conf { | 669 | struct ieee80211_conf { |
634 | u32 flags; | 670 | u32 flags; |
@@ -636,11 +672,13 @@ struct ieee80211_conf { | |||
636 | int max_sleep_period; | 672 | int max_sleep_period; |
637 | 673 | ||
638 | u16 listen_interval; | 674 | u16 listen_interval; |
675 | u8 ps_dtim_period; | ||
639 | 676 | ||
640 | u8 long_frame_max_tx_count, short_frame_max_tx_count; | 677 | u8 long_frame_max_tx_count, short_frame_max_tx_count; |
641 | 678 | ||
642 | struct ieee80211_channel *channel; | 679 | struct ieee80211_channel *channel; |
643 | enum nl80211_channel_type channel_type; | 680 | enum nl80211_channel_type channel_type; |
681 | enum ieee80211_smps_mode smps_mode; | ||
644 | }; | 682 | }; |
645 | 683 | ||
646 | /** | 684 | /** |
@@ -652,12 +690,14 @@ struct ieee80211_conf { | |||
652 | * @type: type of this virtual interface | 690 | * @type: type of this virtual interface |
653 | * @bss_conf: BSS configuration for this interface, either our own | 691 | * @bss_conf: BSS configuration for this interface, either our own |
654 | * or the BSS we're associated to | 692 | * or the BSS we're associated to |
693 | * @addr: address of this interface | ||
655 | * @drv_priv: data area for driver use, will always be aligned to | 694 | * @drv_priv: data area for driver use, will always be aligned to |
656 | * sizeof(void *). | 695 | * sizeof(void *). |
657 | */ | 696 | */ |
658 | struct ieee80211_vif { | 697 | struct ieee80211_vif { |
659 | enum nl80211_iftype type; | 698 | enum nl80211_iftype type; |
660 | struct ieee80211_bss_conf bss_conf; | 699 | struct ieee80211_bss_conf bss_conf; |
700 | u8 addr[ETH_ALEN]; | ||
661 | /* must be last */ | 701 | /* must be last */ |
662 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 702 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
663 | }; | 703 | }; |
@@ -671,33 +711,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
671 | } | 711 | } |
672 | 712 | ||
673 | /** | 713 | /** |
674 | * struct ieee80211_if_init_conf - initial configuration of an interface | ||
675 | * | ||
676 | * @vif: pointer to a driver-use per-interface structure. The pointer | ||
677 | * itself is also used for various functions including | ||
678 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). | ||
679 | * @type: one of &enum nl80211_iftype constants. Determines the type of | ||
680 | * added/removed interface. | ||
681 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | ||
682 | * until the interface is removed (i.e. it cannot be used after | ||
683 | * remove_interface() callback was called for this interface). | ||
684 | * | ||
685 | * This structure is used in add_interface() and remove_interface() | ||
686 | * callbacks of &struct ieee80211_hw. | ||
687 | * | ||
688 | * When you allow multiple interfaces to be added to your PHY, take care | ||
689 | * that the hardware can actually handle multiple MAC addresses. However, | ||
690 | * also take care that when there's no interface left with mac_addr != %NULL | ||
691 | * you remove the MAC address from the device to avoid acknowledging packets | ||
692 | * in pure monitor mode. | ||
693 | */ | ||
694 | struct ieee80211_if_init_conf { | ||
695 | enum nl80211_iftype type; | ||
696 | struct ieee80211_vif *vif; | ||
697 | void *mac_addr; | ||
698 | }; | ||
699 | |||
700 | /** | ||
701 | * enum ieee80211_key_alg - key algorithm | 714 | * enum ieee80211_key_alg - key algorithm |
702 | * @ALG_WEP: WEP40 or WEP104 | 715 | * @ALG_WEP: WEP40 or WEP104 |
703 | * @ALG_TKIP: TKIP | 716 | * @ALG_TKIP: TKIP |
@@ -792,7 +805,7 @@ enum set_key_cmd { | |||
792 | * mac80211, any ieee80211_sta pointer you get access to must | 805 | * mac80211, any ieee80211_sta pointer you get access to must |
793 | * either be protected by rcu_read_lock() explicitly or implicitly, | 806 | * either be protected by rcu_read_lock() explicitly or implicitly, |
794 | * or you must take good care to not use such a pointer after a | 807 | * or you must take good care to not use such a pointer after a |
795 | * call to your sta_notify callback that removed it. | 808 | * call to your sta_remove callback that removed it. |
796 | * | 809 | * |
797 | * @addr: MAC address | 810 | * @addr: MAC address |
798 | * @aid: AID we assigned to the station if we're an AP | 811 | * @aid: AID we assigned to the station if we're an AP |
@@ -818,8 +831,8 @@ struct ieee80211_sta { | |||
818 | * indicates addition and removal of a station to station table, | 831 | * indicates addition and removal of a station to station table, |
819 | * or if a associated station made a power state transition. | 832 | * or if a associated station made a power state transition. |
820 | * | 833 | * |
821 | * @STA_NOTIFY_ADD: a station was added to the station table | 834 | * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table |
822 | * @STA_NOTIFY_REMOVE: a station being removed from the station table | 835 | * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table |
823 | * @STA_NOTIFY_SLEEP: a station is now sleeping | 836 | * @STA_NOTIFY_SLEEP: a station is now sleeping |
824 | * @STA_NOTIFY_AWAKE: a sleeping station woke up | 837 | * @STA_NOTIFY_AWAKE: a sleeping station woke up |
825 | */ | 838 | */ |
@@ -852,6 +865,19 @@ enum ieee80211_tkip_key_type { | |||
852 | * any particular flags. There are some exceptions to this rule, | 865 | * any particular flags. There are some exceptions to this rule, |
853 | * however, so you are advised to review these flags carefully. | 866 | * however, so you are advised to review these flags carefully. |
854 | * | 867 | * |
868 | * @IEEE80211_HW_HAS_RATE_CONTROL: | ||
869 | * The hardware or firmware includes rate control, and cannot be | ||
870 | * controlled by the stack. As such, no rate control algorithm | ||
871 | * should be instantiated, and the TX rate reported to userspace | ||
872 | * will be taken from the TX status instead of the rate control | ||
873 | * algorithm. | ||
874 | * Note that this requires that the driver implement a number of | ||
875 | * callbacks so it has the correct information, it needs to have | ||
876 | * the @set_rts_threshold callback and must look at the BSS config | ||
877 | * @use_cts_prot for G/N protection, @use_short_slot for slot | ||
878 | * timing in 2.4 GHz and @use_short_preamble for preambles for | ||
879 | * CCK frames. | ||
880 | * | ||
855 | * @IEEE80211_HW_RX_INCLUDES_FCS: | 881 | * @IEEE80211_HW_RX_INCLUDES_FCS: |
856 | * Indicates that received frames passed to the stack include | 882 | * Indicates that received frames passed to the stack include |
857 | * the FCS at the end. | 883 | * the FCS at the end. |
@@ -908,8 +934,29 @@ enum ieee80211_tkip_key_type { | |||
908 | * @IEEE80211_HW_BEACON_FILTER: | 934 | * @IEEE80211_HW_BEACON_FILTER: |
909 | * Hardware supports dropping of irrelevant beacon frames to | 935 | * Hardware supports dropping of irrelevant beacon frames to |
910 | * avoid waking up cpu. | 936 | * avoid waking up cpu. |
937 | * | ||
938 | * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: | ||
939 | * Hardware supports static spatial multiplexing powersave, | ||
940 | * ie. can turn off all but one chain even on HT connections | ||
941 | * that should be using more chains. | ||
942 | * | ||
943 | * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS: | ||
944 | * Hardware supports dynamic spatial multiplexing powersave, | ||
945 | * ie. can turn off all but one chain and then wake the rest | ||
946 | * up as required after, for example, rts/cts handshake. | ||
947 | * | ||
948 | * @IEEE80211_HW_SUPPORTS_UAPSD: | ||
949 | * Hardware supports Unscheduled Automatic Power Save Delivery | ||
950 | * (U-APSD) in managed mode. The mode is configured with | ||
951 | * conf_tx() operation. | ||
952 | * | ||
953 | * @IEEE80211_HW_REPORTS_TX_ACK_STATUS: | ||
954 | * Hardware can provide ack status reports of Tx frames to | ||
955 | * the stack. | ||
956 | * | ||
911 | */ | 957 | */ |
912 | enum ieee80211_hw_flags { | 958 | enum ieee80211_hw_flags { |
959 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | ||
913 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, | 960 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, |
914 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, | 961 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, |
915 | IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, | 962 | IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, |
@@ -924,6 +971,10 @@ enum ieee80211_hw_flags { | |||
924 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, | 971 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, |
925 | IEEE80211_HW_MFP_CAPABLE = 1<<13, | 972 | IEEE80211_HW_MFP_CAPABLE = 1<<13, |
926 | IEEE80211_HW_BEACON_FILTER = 1<<14, | 973 | IEEE80211_HW_BEACON_FILTER = 1<<14, |
974 | IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, | ||
975 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, | ||
976 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, | ||
977 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | ||
927 | }; | 978 | }; |
928 | 979 | ||
929 | /** | 980 | /** |
@@ -1102,18 +1153,24 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1102 | * | 1153 | * |
1103 | * mac80211 has support for various powersave implementations. | 1154 | * mac80211 has support for various powersave implementations. |
1104 | * | 1155 | * |
1105 | * First, it can support hardware that handles all powersaving by | 1156 | * First, it can support hardware that handles all powersaving by itself, |
1106 | * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS | 1157 | * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware |
1107 | * hardware flag. In that case, it will be told about the desired | 1158 | * flag. In that case, it will be told about the desired powersave mode |
1108 | * powersave mode depending on the association status, and the driver | 1159 | * with the %IEEE80211_CONF_PS flag depending on the association status. |
1109 | * must take care of sending nullfunc frames when necessary, i.e. when | 1160 | * The hardware must take care of sending nullfunc frames when necessary, |
1110 | * entering and leaving powersave mode. The driver is required to look at | 1161 | * i.e. when entering and leaving powersave mode. The hardware is required |
1111 | * the AID in beacons and signal to the AP that it woke up when it finds | 1162 | * to look at the AID in beacons and signal to the AP that it woke up when |
1112 | * traffic directed to it. This mode supports dynamic PS by simply | 1163 | * it finds traffic directed to it. |
1113 | * enabling/disabling PS. | 1164 | * |
1114 | * | 1165 | * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in |
1115 | * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS | 1166 | * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused |
1116 | * flag to indicate that it can support dynamic PS mode itself (see below). | 1167 | * with hardware wakeup and sleep states. Driver is responsible for waking |
1168 | * up the hardware before issueing commands to the hardware and putting it | ||
1169 | * back to sleep at approriate times. | ||
1170 | * | ||
1171 | * When PS is enabled, hardware needs to wakeup for beacons and receive the | ||
1172 | * buffered multicast/broadcast frames after the beacon. Also it must be | ||
1173 | * possible to send frames and receive the acknowledment frame. | ||
1117 | * | 1174 | * |
1118 | * Other hardware designs cannot send nullfunc frames by themselves and also | 1175 | * Other hardware designs cannot send nullfunc frames by themselves and also |
1119 | * need software support for parsing the TIM bitmap. This is also supported | 1176 | * need software support for parsing the TIM bitmap. This is also supported |
@@ -1121,14 +1178,35 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1121 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still | 1178 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still |
1122 | * required to pass up beacons. The hardware is still required to handle | 1179 | * required to pass up beacons. The hardware is still required to handle |
1123 | * waking up for multicast traffic; if it cannot the driver must handle that | 1180 | * waking up for multicast traffic; if it cannot the driver must handle that |
1124 | * as best as it can, mac80211 is too slow. | 1181 | * as best as it can, mac80211 is too slow to do that. |
1125 | * | 1182 | * |
1126 | * Dynamic powersave mode is an extension to normal powersave mode in which | 1183 | * Dynamic powersave is an extension to normal powersave in which the |
1127 | * the hardware stays awake for a user-specified period of time after sending | 1184 | * hardware stays awake for a user-specified period of time after sending a |
1128 | * a frame so that reply frames need not be buffered and therefore delayed | 1185 | * frame so that reply frames need not be buffered and therefore delayed to |
1129 | * to the next wakeup. This can either be supported by hardware, in which case | 1186 | * the next wakeup. It's compromise of getting good enough latency when |
1130 | * the driver needs to look at the @dynamic_ps_timeout hardware configuration | 1187 | * there's data traffic and still saving significantly power in idle |
1131 | * value, or by the stack if all nullfunc handling is in the stack. | 1188 | * periods. |
1189 | * | ||
1190 | * Dynamic powersave is supported by simply mac80211 enabling and disabling | ||
1191 | * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS | ||
1192 | * flag and mac80211 will handle everything automatically. Additionally, | ||
1193 | * hardware having support for the dynamic PS feature may set the | ||
1194 | * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support | ||
1195 | * dynamic PS mode itself. The driver needs to look at the | ||
1196 | * @dynamic_ps_timeout hardware configuration value and use it that value | ||
1197 | * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable | ||
1198 | * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS | ||
1199 | * enabled whenever user has enabled powersave. | ||
1200 | * | ||
1201 | * Driver informs U-APSD client support by enabling | ||
1202 | * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the | ||
1203 | * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS | ||
1204 | * Nullfunc frames and stay awake until the service period has ended. To | ||
1205 | * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames | ||
1206 | * from that AC are transmitted with powersave enabled. | ||
1207 | * | ||
1208 | * Note: U-APSD client mode is not yet supported with | ||
1209 | * %IEEE80211_HW_PS_NULLFUNC_STACK. | ||
1132 | */ | 1210 | */ |
1133 | 1211 | ||
1134 | /** | 1212 | /** |
@@ -1192,6 +1270,31 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1192 | */ | 1270 | */ |
1193 | 1271 | ||
1194 | /** | 1272 | /** |
1273 | * DOC: Spatial multiplexing power save | ||
1274 | * | ||
1275 | * SMPS (Spatial multiplexing power save) is a mechanism to conserve | ||
1276 | * power in an 802.11n implementation. For details on the mechanism | ||
1277 | * and rationale, please refer to 802.11 (as amended by 802.11n-2009) | ||
1278 | * "11.2.3 SM power save". | ||
1279 | * | ||
1280 | * The mac80211 implementation is capable of sending action frames | ||
1281 | * to update the AP about the station's SMPS mode, and will instruct | ||
1282 | * the driver to enter the specific mode. It will also announce the | ||
1283 | * requested SMPS mode during the association handshake. Hardware | ||
1284 | * support for this feature is required, and can be indicated by | ||
1285 | * hardware flags. | ||
1286 | * | ||
1287 | * The default mode will be "automatic", which nl80211/cfg80211 | ||
1288 | * defines to be dynamic SMPS in (regular) powersave, and SMPS | ||
1289 | * turned off otherwise. | ||
1290 | * | ||
1291 | * To support this feature, the driver must set the appropriate | ||
1292 | * hardware support flags, and handle the SMPS flag to the config() | ||
1293 | * operation. It will then with this mechanism be instructed to | ||
1294 | * enter the requested SMPS mode while associated to an HT AP. | ||
1295 | */ | ||
1296 | |||
1297 | /** | ||
1195 | * DOC: Frame filtering | 1298 | * DOC: Frame filtering |
1196 | * | 1299 | * |
1197 | * mac80211 requires to see many management frames for proper | 1300 | * mac80211 requires to see many management frames for proper |
@@ -1328,7 +1431,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1328 | * When the device is started it should not have a MAC address | 1431 | * When the device is started it should not have a MAC address |
1329 | * to avoid acknowledging frames before a non-monitor device | 1432 | * to avoid acknowledging frames before a non-monitor device |
1330 | * is added. | 1433 | * is added. |
1331 | * Must be implemented. | 1434 | * Must be implemented and can sleep. |
1332 | * | 1435 | * |
1333 | * @stop: Called after last netdevice attached to the hardware | 1436 | * @stop: Called after last netdevice attached to the hardware |
1334 | * is disabled. This should turn off the hardware (at least | 1437 | * is disabled. This should turn off the hardware (at least |
@@ -1336,7 +1439,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1336 | * May be called right after add_interface if that rejects | 1439 | * May be called right after add_interface if that rejects |
1337 | * an interface. If you added any work onto the mac80211 workqueue | 1440 | * an interface. If you added any work onto the mac80211 workqueue |
1338 | * you should ensure to cancel it on this callback. | 1441 | * you should ensure to cancel it on this callback. |
1339 | * Must be implemented. | 1442 | * Must be implemented and can sleep. |
1340 | * | 1443 | * |
1341 | * @add_interface: Called when a netdevice attached to the hardware is | 1444 | * @add_interface: Called when a netdevice attached to the hardware is |
1342 | * enabled. Because it is not called for monitor mode devices, @start | 1445 | * enabled. Because it is not called for monitor mode devices, @start |
@@ -1346,7 +1449,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1346 | * interface is given in the conf parameter. | 1449 | * interface is given in the conf parameter. |
1347 | * The callback may refuse to add an interface by returning a | 1450 | * The callback may refuse to add an interface by returning a |
1348 | * negative error code (which will be seen in userspace.) | 1451 | * negative error code (which will be seen in userspace.) |
1349 | * Must be implemented. | 1452 | * Must be implemented and can sleep. |
1350 | * | 1453 | * |
1351 | * @remove_interface: Notifies a driver that an interface is going down. | 1454 | * @remove_interface: Notifies a driver that an interface is going down. |
1352 | * The @stop callback is called after this if it is the last interface | 1455 | * The @stop callback is called after this if it is the last interface |
@@ -1355,19 +1458,20 @@ enum ieee80211_ampdu_mlme_action { | |||
1355 | * must be cleared so the device no longer acknowledges packets, | 1458 | * must be cleared so the device no longer acknowledges packets, |
1356 | * the mac_addr member of the conf structure is, however, set to the | 1459 | * the mac_addr member of the conf structure is, however, set to the |
1357 | * MAC address of the device going away. | 1460 | * MAC address of the device going away. |
1358 | * Hence, this callback must be implemented. | 1461 | * Hence, this callback must be implemented. It can sleep. |
1359 | * | 1462 | * |
1360 | * @config: Handler for configuration requests. IEEE 802.11 code calls this | 1463 | * @config: Handler for configuration requests. IEEE 802.11 code calls this |
1361 | * function to change hardware configuration, e.g., channel. | 1464 | * function to change hardware configuration, e.g., channel. |
1362 | * This function should never fail but returns a negative error code | 1465 | * This function should never fail but returns a negative error code |
1363 | * if it does. | 1466 | * if it does. The callback can sleep. |
1364 | * | 1467 | * |
1365 | * @bss_info_changed: Handler for configuration requests related to BSS | 1468 | * @bss_info_changed: Handler for configuration requests related to BSS |
1366 | * parameters that may vary during BSS's lifespan, and may affect low | 1469 | * parameters that may vary during BSS's lifespan, and may affect low |
1367 | * level driver (e.g. assoc/disassoc status, erp parameters). | 1470 | * level driver (e.g. assoc/disassoc status, erp parameters). |
1368 | * This function should not be used if no BSS has been set, unless | 1471 | * This function should not be used if no BSS has been set, unless |
1369 | * for association indication. The @changed parameter indicates which | 1472 | * for association indication. The @changed parameter indicates which |
1370 | * of the bss parameters has changed when a call is made. | 1473 | * of the bss parameters has changed when a call is made. The callback |
1474 | * can sleep. | ||
1371 | * | 1475 | * |
1372 | * @prepare_multicast: Prepare for multicast filter configuration. | 1476 | * @prepare_multicast: Prepare for multicast filter configuration. |
1373 | * This callback is optional, and its return value is passed | 1477 | * This callback is optional, and its return value is passed |
@@ -1375,20 +1479,22 @@ enum ieee80211_ampdu_mlme_action { | |||
1375 | * | 1479 | * |
1376 | * @configure_filter: Configure the device's RX filter. | 1480 | * @configure_filter: Configure the device's RX filter. |
1377 | * See the section "Frame filtering" for more information. | 1481 | * See the section "Frame filtering" for more information. |
1378 | * This callback must be implemented. | 1482 | * This callback must be implemented and can sleep. |
1379 | * | 1483 | * |
1380 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit | 1484 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit |
1381 | * must be set or cleared for a given STA. Must be atomic. | 1485 | * must be set or cleared for a given STA. Must be atomic. |
1382 | * | 1486 | * |
1383 | * @set_key: See the section "Hardware crypto acceleration" | 1487 | * @set_key: See the section "Hardware crypto acceleration" |
1384 | * This callback can sleep, and is only called between add_interface | 1488 | * This callback is only called between add_interface and |
1385 | * and remove_interface calls, i.e. while the given virtual interface | 1489 | * remove_interface calls, i.e. while the given virtual interface |
1386 | * is enabled. | 1490 | * is enabled. |
1387 | * Returns a negative error code if the key can't be added. | 1491 | * Returns a negative error code if the key can't be added. |
1492 | * The callback can sleep. | ||
1388 | * | 1493 | * |
1389 | * @update_tkip_key: See the section "Hardware crypto acceleration" | 1494 | * @update_tkip_key: See the section "Hardware crypto acceleration" |
1390 | * This callback will be called in the context of Rx. Called for drivers | 1495 | * This callback will be called in the context of Rx. Called for drivers |
1391 | * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. | 1496 | * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. |
1497 | * The callback must be atomic. | ||
1392 | * | 1498 | * |
1393 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 1499 | * @hw_scan: Ask the hardware to service the scan request, no need to start |
1394 | * the scan state machine in stack. The scan must honour the channel | 1500 | * the scan state machine in stack. The scan must honour the channel |
@@ -1402,53 +1508,64 @@ enum ieee80211_ampdu_mlme_action { | |||
1402 | * When the scan finishes, ieee80211_scan_completed() must be called; | 1508 | * When the scan finishes, ieee80211_scan_completed() must be called; |
1403 | * note that it also must be called when the scan cannot finish due to | 1509 | * note that it also must be called when the scan cannot finish due to |
1404 | * any error unless this callback returned a negative error code. | 1510 | * any error unless this callback returned a negative error code. |
1511 | * The callback can sleep. | ||
1405 | * | 1512 | * |
1406 | * @sw_scan_start: Notifier function that is called just before a software scan | 1513 | * @sw_scan_start: Notifier function that is called just before a software scan |
1407 | * is started. Can be NULL, if the driver doesn't need this notification. | 1514 | * is started. Can be NULL, if the driver doesn't need this notification. |
1515 | * The callback can sleep. | ||
1408 | * | 1516 | * |
1409 | * @sw_scan_complete: Notifier function that is called just after a software scan | 1517 | * @sw_scan_complete: Notifier function that is called just after a |
1410 | * finished. Can be NULL, if the driver doesn't need this notification. | 1518 | * software scan finished. Can be NULL, if the driver doesn't need |
1519 | * this notification. | ||
1520 | * The callback can sleep. | ||
1411 | * | 1521 | * |
1412 | * @get_stats: Return low-level statistics. | 1522 | * @get_stats: Return low-level statistics. |
1413 | * Returns zero if statistics are available. | 1523 | * Returns zero if statistics are available. |
1524 | * The callback can sleep. | ||
1414 | * | 1525 | * |
1415 | * @get_tkip_seq: If your device implements TKIP encryption in hardware this | 1526 | * @get_tkip_seq: If your device implements TKIP encryption in hardware this |
1416 | * callback should be provided to read the TKIP transmit IVs (both IV32 | 1527 | * callback should be provided to read the TKIP transmit IVs (both IV32 |
1417 | * and IV16) for the given key from hardware. | 1528 | * and IV16) for the given key from hardware. |
1529 | * The callback must be atomic. | ||
1418 | * | 1530 | * |
1419 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) | 1531 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) |
1532 | * The callback can sleep. | ||
1533 | * | ||
1534 | * @sta_add: Notifies low level driver about addition of an associated station, | ||
1535 | * AP, IBSS/WDS/mesh peer etc. This callback can sleep. | ||
1420 | * | 1536 | * |
1421 | * @sta_notify: Notifies low level driver about addition, removal or power | 1537 | * @sta_remove: Notifies low level driver about removal of an associated |
1422 | * state transition of an associated station, AP, IBSS/WDS/mesh peer etc. | 1538 | * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. |
1423 | * Must be atomic. | 1539 | * |
1540 | * @sta_notify: Notifies low level driver about power state transition of an | ||
1541 | * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. | ||
1424 | * | 1542 | * |
1425 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1543 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
1426 | * bursting) for a hardware TX queue. | 1544 | * bursting) for a hardware TX queue. |
1427 | * Returns a negative error code on failure. | 1545 | * Returns a negative error code on failure. |
1428 | * | 1546 | * The callback can sleep. |
1429 | * @get_tx_stats: Get statistics of the current TX queue status. This is used | ||
1430 | * to get number of currently queued packets (queue length), maximum queue | ||
1431 | * size (limit), and total number of packets sent using each TX queue | ||
1432 | * (count). The 'stats' pointer points to an array that has hw->queues | ||
1433 | * items. | ||
1434 | * | 1547 | * |
1435 | * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, | 1548 | * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, |
1436 | * this is only used for IBSS mode BSSID merging and debugging. Is not a | 1549 | * this is only used for IBSS mode BSSID merging and debugging. Is not a |
1437 | * required function. | 1550 | * required function. |
1551 | * The callback can sleep. | ||
1438 | * | 1552 | * |
1439 | * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. | 1553 | * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. |
1440 | * Currently, this is only used for IBSS mode debugging. Is not a | 1554 | * Currently, this is only used for IBSS mode debugging. Is not a |
1441 | * required function. | 1555 | * required function. |
1556 | * The callback can sleep. | ||
1442 | * | 1557 | * |
1443 | * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize | 1558 | * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize |
1444 | * with other STAs in the IBSS. This is only used in IBSS mode. This | 1559 | * with other STAs in the IBSS. This is only used in IBSS mode. This |
1445 | * function is optional if the firmware/hardware takes full care of | 1560 | * function is optional if the firmware/hardware takes full care of |
1446 | * TSF synchronization. | 1561 | * TSF synchronization. |
1562 | * The callback can sleep. | ||
1447 | * | 1563 | * |
1448 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. | 1564 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. |
1449 | * This is needed only for IBSS mode and the result of this function is | 1565 | * This is needed only for IBSS mode and the result of this function is |
1450 | * used to determine whether to reply to Probe Requests. | 1566 | * used to determine whether to reply to Probe Requests. |
1451 | * Returns non-zero if this device sent the last beacon. | 1567 | * Returns non-zero if this device sent the last beacon. |
1568 | * The callback can sleep. | ||
1452 | * | 1569 | * |
1453 | * @ampdu_action: Perform a certain A-MPDU action | 1570 | * @ampdu_action: Perform a certain A-MPDU action |
1454 | * The RA/TID combination determines the destination and TID we want | 1571 | * The RA/TID combination determines the destination and TID we want |
@@ -1457,21 +1574,32 @@ enum ieee80211_ampdu_mlme_action { | |||
1457 | * is the first frame we expect to perform the action on. Notice | 1574 | * is the first frame we expect to perform the action on. Notice |
1458 | * that TX/RX_STOP can pass NULL for this parameter. | 1575 | * that TX/RX_STOP can pass NULL for this parameter. |
1459 | * Returns a negative error code on failure. | 1576 | * Returns a negative error code on failure. |
1577 | * The callback must be atomic. | ||
1460 | * | 1578 | * |
1461 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also | 1579 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also |
1462 | * need to set wiphy->rfkill_poll to %true before registration, | 1580 | * need to set wiphy->rfkill_poll to %true before registration, |
1463 | * and need to call wiphy_rfkill_set_hw_state() in the callback. | 1581 | * and need to call wiphy_rfkill_set_hw_state() in the callback. |
1582 | * The callback can sleep. | ||
1583 | * | ||
1584 | * @set_coverage_class: Set slot time for given coverage class as specified | ||
1585 | * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout | ||
1586 | * accordingly. This callback is not required and may sleep. | ||
1464 | * | 1587 | * |
1465 | * @testmode_cmd: Implement a cfg80211 test mode command. | 1588 | * @testmode_cmd: Implement a cfg80211 test mode command. |
1589 | * The callback can sleep. | ||
1590 | * | ||
1591 | * @flush: Flush all pending frames from the hardware queue, making sure | ||
1592 | * that the hardware queues are empty. If the parameter @drop is set | ||
1593 | * to %true, pending frames may be dropped. The callback can sleep. | ||
1466 | */ | 1594 | */ |
1467 | struct ieee80211_ops { | 1595 | struct ieee80211_ops { |
1468 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1596 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
1469 | int (*start)(struct ieee80211_hw *hw); | 1597 | int (*start)(struct ieee80211_hw *hw); |
1470 | void (*stop)(struct ieee80211_hw *hw); | 1598 | void (*stop)(struct ieee80211_hw *hw); |
1471 | int (*add_interface)(struct ieee80211_hw *hw, | 1599 | int (*add_interface)(struct ieee80211_hw *hw, |
1472 | struct ieee80211_if_init_conf *conf); | 1600 | struct ieee80211_vif *vif); |
1473 | void (*remove_interface)(struct ieee80211_hw *hw, | 1601 | void (*remove_interface)(struct ieee80211_hw *hw, |
1474 | struct ieee80211_if_init_conf *conf); | 1602 | struct ieee80211_vif *vif); |
1475 | int (*config)(struct ieee80211_hw *hw, u32 changed); | 1603 | int (*config)(struct ieee80211_hw *hw, u32 changed); |
1476 | void (*bss_info_changed)(struct ieee80211_hw *hw, | 1604 | void (*bss_info_changed)(struct ieee80211_hw *hw, |
1477 | struct ieee80211_vif *vif, | 1605 | struct ieee80211_vif *vif, |
@@ -1489,8 +1617,10 @@ struct ieee80211_ops { | |||
1489 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | 1617 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
1490 | struct ieee80211_key_conf *key); | 1618 | struct ieee80211_key_conf *key); |
1491 | void (*update_tkip_key)(struct ieee80211_hw *hw, | 1619 | void (*update_tkip_key)(struct ieee80211_hw *hw, |
1492 | struct ieee80211_key_conf *conf, const u8 *address, | 1620 | struct ieee80211_vif *vif, |
1493 | u32 iv32, u16 *phase1key); | 1621 | struct ieee80211_key_conf *conf, |
1622 | struct ieee80211_sta *sta, | ||
1623 | u32 iv32, u16 *phase1key); | ||
1494 | int (*hw_scan)(struct ieee80211_hw *hw, | 1624 | int (*hw_scan)(struct ieee80211_hw *hw, |
1495 | struct cfg80211_scan_request *req); | 1625 | struct cfg80211_scan_request *req); |
1496 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 1626 | void (*sw_scan_start)(struct ieee80211_hw *hw); |
@@ -1500,24 +1630,29 @@ struct ieee80211_ops { | |||
1500 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, | 1630 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, |
1501 | u32 *iv32, u16 *iv16); | 1631 | u32 *iv32, u16 *iv16); |
1502 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1632 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
1633 | int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
1634 | struct ieee80211_sta *sta); | ||
1635 | int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
1636 | struct ieee80211_sta *sta); | ||
1503 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1637 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1504 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 1638 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
1505 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, | 1639 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, |
1506 | const struct ieee80211_tx_queue_params *params); | 1640 | const struct ieee80211_tx_queue_params *params); |
1507 | int (*get_tx_stats)(struct ieee80211_hw *hw, | ||
1508 | struct ieee80211_tx_queue_stats *stats); | ||
1509 | u64 (*get_tsf)(struct ieee80211_hw *hw); | 1641 | u64 (*get_tsf)(struct ieee80211_hw *hw); |
1510 | void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); | 1642 | void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); |
1511 | void (*reset_tsf)(struct ieee80211_hw *hw); | 1643 | void (*reset_tsf)(struct ieee80211_hw *hw); |
1512 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1644 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
1513 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1645 | int (*ampdu_action)(struct ieee80211_hw *hw, |
1646 | struct ieee80211_vif *vif, | ||
1514 | enum ieee80211_ampdu_mlme_action action, | 1647 | enum ieee80211_ampdu_mlme_action action, |
1515 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 1648 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
1516 | 1649 | ||
1517 | void (*rfkill_poll)(struct ieee80211_hw *hw); | 1650 | void (*rfkill_poll)(struct ieee80211_hw *hw); |
1651 | void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); | ||
1518 | #ifdef CONFIG_NL80211_TESTMODE | 1652 | #ifdef CONFIG_NL80211_TESTMODE |
1519 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); | 1653 | int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); |
1520 | #endif | 1654 | #endif |
1655 | void (*flush)(struct ieee80211_hw *hw, bool drop); | ||
1521 | }; | 1656 | }; |
1522 | 1657 | ||
1523 | /** | 1658 | /** |
@@ -1667,15 +1802,14 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw); | |||
1667 | * ieee80211_rx - receive frame | 1802 | * ieee80211_rx - receive frame |
1668 | * | 1803 | * |
1669 | * Use this function to hand received frames to mac80211. The receive | 1804 | * Use this function to hand received frames to mac80211. The receive |
1670 | * buffer in @skb must start with an IEEE 802.11 header or a radiotap | 1805 | * buffer in @skb must start with an IEEE 802.11 header. |
1671 | * header if %RX_FLAG_RADIOTAP is set in the @status flags. | ||
1672 | * | 1806 | * |
1673 | * This function may not be called in IRQ context. Calls to this function | 1807 | * This function may not be called in IRQ context. Calls to this function |
1674 | * for a single hardware must be synchronized against each other. Calls | 1808 | * for a single hardware must be synchronized against each other. Calls to |
1675 | * to this function and ieee80211_rx_irqsafe() may not be mixed for a | 1809 | * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be |
1676 | * single hardware. | 1810 | * mixed for a single hardware. |
1677 | * | 1811 | * |
1678 | * Note that right now, this function must be called with softirqs disabled. | 1812 | * In process context use instead ieee80211_rx_ni(). |
1679 | * | 1813 | * |
1680 | * @hw: the hardware this frame came in on | 1814 | * @hw: the hardware this frame came in on |
1681 | * @skb: the buffer to receive, owned by mac80211 after this call | 1815 | * @skb: the buffer to receive, owned by mac80211 after this call |
@@ -1688,8 +1822,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1688 | * Like ieee80211_rx() but can be called in IRQ context | 1822 | * Like ieee80211_rx() but can be called in IRQ context |
1689 | * (internally defers to a tasklet.) | 1823 | * (internally defers to a tasklet.) |
1690 | * | 1824 | * |
1691 | * Calls to this function and ieee80211_rx() may not be mixed for a | 1825 | * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not |
1692 | * single hardware. | 1826 | * be mixed for a single hardware. |
1693 | * | 1827 | * |
1694 | * @hw: the hardware this frame came in on | 1828 | * @hw: the hardware this frame came in on |
1695 | * @skb: the buffer to receive, owned by mac80211 after this call | 1829 | * @skb: the buffer to receive, owned by mac80211 after this call |
@@ -1697,6 +1831,32 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1697 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); | 1831 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); |
1698 | 1832 | ||
1699 | /** | 1833 | /** |
1834 | * ieee80211_rx_ni - receive frame (in process context) | ||
1835 | * | ||
1836 | * Like ieee80211_rx() but can be called in process context | ||
1837 | * (internally disables bottom halves). | ||
1838 | * | ||
1839 | * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may | ||
1840 | * not be mixed for a single hardware. | ||
1841 | * | ||
1842 | * @hw: the hardware this frame came in on | ||
1843 | * @skb: the buffer to receive, owned by mac80211 after this call | ||
1844 | */ | ||
1845 | static inline void ieee80211_rx_ni(struct ieee80211_hw *hw, | ||
1846 | struct sk_buff *skb) | ||
1847 | { | ||
1848 | local_bh_disable(); | ||
1849 | ieee80211_rx(hw, skb); | ||
1850 | local_bh_enable(); | ||
1851 | } | ||
1852 | |||
1853 | /* | ||
1854 | * The TX headroom reserved by mac80211 for its own tx_status functions. | ||
1855 | * This is enough for the radiotap header. | ||
1856 | */ | ||
1857 | #define IEEE80211_TX_STATUS_HEADROOM 13 | ||
1858 | |||
1859 | /** | ||
1700 | * ieee80211_tx_status - transmit status callback | 1860 | * ieee80211_tx_status - transmit status callback |
1701 | * | 1861 | * |
1702 | * Call this function for all transmitted frames after they have been | 1862 | * Call this function for all transmitted frames after they have been |
@@ -1730,24 +1890,97 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
1730 | struct sk_buff *skb); | 1890 | struct sk_buff *skb); |
1731 | 1891 | ||
1732 | /** | 1892 | /** |
1733 | * ieee80211_beacon_get - beacon generation function | 1893 | * ieee80211_beacon_get_tim - beacon generation function |
1734 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1894 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1735 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 1895 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1896 | * @tim_offset: pointer to variable that will receive the TIM IE offset. | ||
1897 | * Set to 0 if invalid (in non-AP modes). | ||
1898 | * @tim_length: pointer to variable that will receive the TIM IE length, | ||
1899 | * (including the ID and length bytes!). | ||
1900 | * Set to 0 if invalid (in non-AP modes). | ||
1901 | * | ||
1902 | * If the driver implements beaconing modes, it must use this function to | ||
1903 | * obtain the beacon frame/template. | ||
1736 | * | 1904 | * |
1737 | * If the beacon frames are generated by the host system (i.e., not in | 1905 | * If the beacon frames are generated by the host system (i.e., not in |
1738 | * hardware/firmware), the low-level driver uses this function to receive | 1906 | * hardware/firmware), the driver uses this function to get each beacon |
1739 | * the next beacon frame from the 802.11 code. The low-level is responsible | 1907 | * frame from mac80211 -- it is responsible for calling this function |
1740 | * for calling this function before beacon data is needed (e.g., based on | 1908 | * before the beacon is needed (e.g. based on hardware interrupt). |
1741 | * hardware interrupt). Returned skb is used only once and low-level driver | 1909 | * |
1742 | * is responsible for freeing it. | 1910 | * If the beacon frames are generated by the device, then the driver |
1911 | * must use the returned beacon as the template and change the TIM IE | ||
1912 | * according to the current DTIM parameters/TIM bitmap. | ||
1913 | * | ||
1914 | * The driver is responsible for freeing the returned skb. | ||
1915 | */ | ||
1916 | struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | ||
1917 | struct ieee80211_vif *vif, | ||
1918 | u16 *tim_offset, u16 *tim_length); | ||
1919 | |||
1920 | /** | ||
1921 | * ieee80211_beacon_get - beacon generation function | ||
1922 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
1923 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
1924 | * | ||
1925 | * See ieee80211_beacon_get_tim(). | ||
1926 | */ | ||
1927 | static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | ||
1928 | struct ieee80211_vif *vif) | ||
1929 | { | ||
1930 | return ieee80211_beacon_get_tim(hw, vif, NULL, NULL); | ||
1931 | } | ||
1932 | |||
1933 | /** | ||
1934 | * ieee80211_pspoll_get - retrieve a PS Poll template | ||
1935 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
1936 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
1937 | * | ||
1938 | * Creates a PS Poll a template which can, for example, uploaded to | ||
1939 | * hardware. The template must be updated after association so that correct | ||
1940 | * AID, BSSID and MAC address is used. | ||
1941 | * | ||
1942 | * Note: Caller (or hardware) is responsible for setting the | ||
1943 | * &IEEE80211_FCTL_PM bit. | ||
1743 | */ | 1944 | */ |
1744 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1945 | struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, |
1745 | struct ieee80211_vif *vif); | 1946 | struct ieee80211_vif *vif); |
1746 | 1947 | ||
1747 | /** | 1948 | /** |
1949 | * ieee80211_nullfunc_get - retrieve a nullfunc template | ||
1950 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
1951 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
1952 | * | ||
1953 | * Creates a Nullfunc template which can, for example, uploaded to | ||
1954 | * hardware. The template must be updated after association so that correct | ||
1955 | * BSSID and address is used. | ||
1956 | * | ||
1957 | * Note: Caller (or hardware) is responsible for setting the | ||
1958 | * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields. | ||
1959 | */ | ||
1960 | struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, | ||
1961 | struct ieee80211_vif *vif); | ||
1962 | |||
1963 | /** | ||
1964 | * ieee80211_probereq_get - retrieve a Probe Request template | ||
1965 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
1966 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
1967 | * @ssid: SSID buffer | ||
1968 | * @ssid_len: length of SSID | ||
1969 | * @ie: buffer containing all IEs except SSID for the template | ||
1970 | * @ie_len: length of the IE buffer | ||
1971 | * | ||
1972 | * Creates a Probe Request template which can, for example, be uploaded to | ||
1973 | * hardware. | ||
1974 | */ | ||
1975 | struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | ||
1976 | struct ieee80211_vif *vif, | ||
1977 | const u8 *ssid, size_t ssid_len, | ||
1978 | const u8 *ie, size_t ie_len); | ||
1979 | |||
1980 | /** | ||
1748 | * ieee80211_rts_get - RTS frame generation function | 1981 | * ieee80211_rts_get - RTS frame generation function |
1749 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1982 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1750 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 1983 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1751 | * @frame: pointer to the frame that is going to be protected by the RTS. | 1984 | * @frame: pointer to the frame that is going to be protected by the RTS. |
1752 | * @frame_len: the frame length (in octets). | 1985 | * @frame_len: the frame length (in octets). |
1753 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 1986 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
@@ -1766,7 +1999,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
1766 | /** | 1999 | /** |
1767 | * ieee80211_rts_duration - Get the duration field for an RTS frame | 2000 | * ieee80211_rts_duration - Get the duration field for an RTS frame |
1768 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2001 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1769 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2002 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1770 | * @frame_len: the length of the frame that is going to be protected by the RTS. | 2003 | * @frame_len: the length of the frame that is going to be protected by the RTS. |
1771 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 2004 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
1772 | * | 2005 | * |
@@ -1781,7 +2014,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
1781 | /** | 2014 | /** |
1782 | * ieee80211_ctstoself_get - CTS-to-self frame generation function | 2015 | * ieee80211_ctstoself_get - CTS-to-self frame generation function |
1783 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2016 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1784 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2017 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1785 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. | 2018 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. |
1786 | * @frame_len: the frame length (in octets). | 2019 | * @frame_len: the frame length (in octets). |
1787 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 2020 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
@@ -1801,7 +2034,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | |||
1801 | /** | 2034 | /** |
1802 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame | 2035 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame |
1803 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2036 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1804 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2037 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1805 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. | 2038 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. |
1806 | * @frame_txctl: &struct ieee80211_tx_info of the frame. | 2039 | * @frame_txctl: &struct ieee80211_tx_info of the frame. |
1807 | * | 2040 | * |
@@ -1817,7 +2050,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
1817 | /** | 2050 | /** |
1818 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame | 2051 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame |
1819 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2052 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1820 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2053 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1821 | * @frame_len: the length of the frame. | 2054 | * @frame_len: the length of the frame. |
1822 | * @rate: the rate at which the frame is going to be transmitted. | 2055 | * @rate: the rate at which the frame is going to be transmitted. |
1823 | * | 2056 | * |
@@ -1832,7 +2065,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | |||
1832 | /** | 2065 | /** |
1833 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames | 2066 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames |
1834 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2067 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
1835 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2068 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
1836 | * | 2069 | * |
1837 | * Function for accessing buffered broadcast and multicast frames. If | 2070 | * Function for accessing buffered broadcast and multicast frames. If |
1838 | * hardware/firmware does not implement buffering of broadcast/multicast | 2071 | * hardware/firmware does not implement buffering of broadcast/multicast |
@@ -1987,8 +2220,7 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, | |||
1987 | 2220 | ||
1988 | /** | 2221 | /** |
1989 | * ieee80211_start_tx_ba_session - Start a tx Block Ack session. | 2222 | * ieee80211_start_tx_ba_session - Start a tx Block Ack session. |
1990 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2223 | * @sta: the station for which to start a BA session |
1991 | * @ra: receiver address of the BA session recipient | ||
1992 | * @tid: the TID to BA on. | 2224 | * @tid: the TID to BA on. |
1993 | * | 2225 | * |
1994 | * Return: success if addBA request was sent, failure otherwise | 2226 | * Return: success if addBA request was sent, failure otherwise |
@@ -1997,22 +2229,22 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, | |||
1997 | * the need to start aggregation on a certain RA/TID, the session level | 2229 | * the need to start aggregation on a certain RA/TID, the session level |
1998 | * will be managed by the mac80211. | 2230 | * will be managed by the mac80211. |
1999 | */ | 2231 | */ |
2000 | int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid); | 2232 | int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); |
2001 | 2233 | ||
2002 | /** | 2234 | /** |
2003 | * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. | 2235 | * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. |
2004 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2236 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
2005 | * @ra: receiver address of the BA session recipient. | 2237 | * @ra: receiver address of the BA session recipient. |
2006 | * @tid: the TID to BA on. | 2238 | * @tid: the TID to BA on. |
2007 | * | 2239 | * |
2008 | * This function must be called by low level driver once it has | 2240 | * This function must be called by low level driver once it has |
2009 | * finished with preparations for the BA session. | 2241 | * finished with preparations for the BA session. |
2010 | */ | 2242 | */ |
2011 | void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid); | 2243 | void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); |
2012 | 2244 | ||
2013 | /** | 2245 | /** |
2014 | * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. | 2246 | * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. |
2015 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2247 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
2016 | * @ra: receiver address of the BA session recipient. | 2248 | * @ra: receiver address of the BA session recipient. |
2017 | * @tid: the TID to BA on. | 2249 | * @tid: the TID to BA on. |
2018 | * | 2250 | * |
@@ -2020,13 +2252,12 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid); | |||
2020 | * finished with preparations for the BA session. | 2252 | * finished with preparations for the BA session. |
2021 | * This version of the function is IRQ-safe. | 2253 | * This version of the function is IRQ-safe. |
2022 | */ | 2254 | */ |
2023 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | 2255 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, |
2024 | u16 tid); | 2256 | u16 tid); |
2025 | 2257 | ||
2026 | /** | 2258 | /** |
2027 | * ieee80211_stop_tx_ba_session - Stop a Block Ack session. | 2259 | * ieee80211_stop_tx_ba_session - Stop a Block Ack session. |
2028 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2260 | * @sta: the station whose BA session to stop |
2029 | * @ra: receiver address of the BA session recipient | ||
2030 | * @tid: the TID to stop BA. | 2261 | * @tid: the TID to stop BA. |
2031 | * @initiator: if indicates initiator DELBA frame will be sent. | 2262 | * @initiator: if indicates initiator DELBA frame will be sent. |
2032 | * | 2263 | * |
@@ -2036,24 +2267,23 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | |||
2036 | * the need to stop aggregation on a certain RA/TID, the session level | 2267 | * the need to stop aggregation on a certain RA/TID, the session level |
2037 | * will be managed by the mac80211. | 2268 | * will be managed by the mac80211. |
2038 | */ | 2269 | */ |
2039 | int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | 2270 | int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid, |
2040 | u8 *ra, u16 tid, | ||
2041 | enum ieee80211_back_parties initiator); | 2271 | enum ieee80211_back_parties initiator); |
2042 | 2272 | ||
2043 | /** | 2273 | /** |
2044 | * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. | 2274 | * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. |
2045 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2275 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
2046 | * @ra: receiver address of the BA session recipient. | 2276 | * @ra: receiver address of the BA session recipient. |
2047 | * @tid: the desired TID to BA on. | 2277 | * @tid: the desired TID to BA on. |
2048 | * | 2278 | * |
2049 | * This function must be called by low level driver once it has | 2279 | * This function must be called by low level driver once it has |
2050 | * finished with preparations for the BA session tear down. | 2280 | * finished with preparations for the BA session tear down. |
2051 | */ | 2281 | */ |
2052 | void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); | 2282 | void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); |
2053 | 2283 | ||
2054 | /** | 2284 | /** |
2055 | * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. | 2285 | * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. |
2056 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 2286 | * @vif: &struct ieee80211_vif pointer from the add_interface callback |
2057 | * @ra: receiver address of the BA session recipient. | 2287 | * @ra: receiver address of the BA session recipient. |
2058 | * @tid: the desired TID to BA on. | 2288 | * @tid: the desired TID to BA on. |
2059 | * | 2289 | * |
@@ -2061,25 +2291,78 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); | |||
2061 | * finished with preparations for the BA session tear down. | 2291 | * finished with preparations for the BA session tear down. |
2062 | * This version of the function is IRQ-safe. | 2292 | * This version of the function is IRQ-safe. |
2063 | */ | 2293 | */ |
2064 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | 2294 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, |
2065 | u16 tid); | 2295 | u16 tid); |
2066 | 2296 | ||
2067 | /** | 2297 | /** |
2068 | * ieee80211_find_sta - find a station | 2298 | * ieee80211_find_sta - find a station |
2069 | * | 2299 | * |
2070 | * @hw: pointer as obtained from ieee80211_alloc_hw() | 2300 | * @vif: virtual interface to look for station on |
2071 | * @addr: station's address | 2301 | * @addr: station's address |
2072 | * | 2302 | * |
2073 | * This function must be called under RCU lock and the | 2303 | * This function must be called under RCU lock and the |
2074 | * resulting pointer is only valid under RCU lock as well. | 2304 | * resulting pointer is only valid under RCU lock as well. |
2075 | */ | 2305 | */ |
2076 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | 2306 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, |
2077 | const u8 *addr); | 2307 | const u8 *addr); |
2078 | 2308 | ||
2079 | /** | 2309 | /** |
2310 | * ieee80211_find_sta_by_hw - find a station on hardware | ||
2311 | * | ||
2312 | * @hw: pointer as obtained from ieee80211_alloc_hw() | ||
2313 | * @addr: station's address | ||
2314 | * | ||
2315 | * This function must be called under RCU lock and the | ||
2316 | * resulting pointer is only valid under RCU lock as well. | ||
2317 | * | ||
2318 | * NOTE: This function should not be used! When mac80211 is converted | ||
2319 | * internally to properly keep track of stations on multiple | ||
2320 | * virtual interfaces, it will not always know which station to | ||
2321 | * return here since a single address might be used by multiple | ||
2322 | * logical stations (e.g. consider a station connecting to another | ||
2323 | * BSSID on the same AP hardware without disconnecting first). | ||
2324 | * | ||
2325 | * DO NOT USE THIS FUNCTION. | ||
2326 | */ | ||
2327 | struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, | ||
2328 | const u8 *addr); | ||
2329 | |||
2330 | /** | ||
2331 | * ieee80211_sta_block_awake - block station from waking up | ||
2332 | * @hw: the hardware | ||
2333 | * @pubsta: the station | ||
2334 | * @block: whether to block or unblock | ||
2335 | * | ||
2336 | * Some devices require that all frames that are on the queues | ||
2337 | * for a specific station that went to sleep are flushed before | ||
2338 | * a poll response or frames after the station woke up can be | ||
2339 | * delivered to that it. Note that such frames must be rejected | ||
2340 | * by the driver as filtered, with the appropriate status flag. | ||
2341 | * | ||
2342 | * This function allows implementing this mode in a race-free | ||
2343 | * manner. | ||
2344 | * | ||
2345 | * To do this, a driver must keep track of the number of frames | ||
2346 | * still enqueued for a specific station. If this number is not | ||
2347 | * zero when the station goes to sleep, the driver must call | ||
2348 | * this function to force mac80211 to consider the station to | ||
2349 | * be asleep regardless of the station's actual state. Once the | ||
2350 | * number of outstanding frames reaches zero, the driver must | ||
2351 | * call this function again to unblock the station. That will | ||
2352 | * cause mac80211 to be able to send ps-poll responses, and if | ||
2353 | * the station queried in the meantime then frames will also | ||
2354 | * be sent out as a result of this. Additionally, the driver | ||
2355 | * will be notified that the station woke up some time after | ||
2356 | * it is unblocked, regardless of whether the station actually | ||
2357 | * woke up while blocked or not. | ||
2358 | */ | ||
2359 | void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | ||
2360 | struct ieee80211_sta *pubsta, bool block); | ||
2361 | |||
2362 | /** | ||
2080 | * ieee80211_beacon_loss - inform hardware does not receive beacons | 2363 | * ieee80211_beacon_loss - inform hardware does not receive beacons |
2081 | * | 2364 | * |
2082 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. | 2365 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
2083 | * | 2366 | * |
2084 | * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and | 2367 | * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and |
2085 | * IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 2368 | * IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
@@ -2113,8 +2396,12 @@ enum rate_control_changed { | |||
2113 | * @short_preamble: whether mac80211 will request short-preamble transmission | 2396 | * @short_preamble: whether mac80211 will request short-preamble transmission |
2114 | * if the selected rate supports it | 2397 | * if the selected rate supports it |
2115 | * @max_rate_idx: user-requested maximum rate (not MCS for now) | 2398 | * @max_rate_idx: user-requested maximum rate (not MCS for now) |
2399 | * (deprecated; this will be removed once drivers get updated to use | ||
2400 | * rate_idx_mask) | ||
2401 | * @rate_idx_mask: user-requested rate mask (not MCS for now) | ||
2116 | * @skb: the skb that will be transmitted, the control information in it needs | 2402 | * @skb: the skb that will be transmitted, the control information in it needs |
2117 | * to be filled in | 2403 | * to be filled in |
2404 | * @ap: whether this frame is sent out in AP mode | ||
2118 | */ | 2405 | */ |
2119 | struct ieee80211_tx_rate_control { | 2406 | struct ieee80211_tx_rate_control { |
2120 | struct ieee80211_hw *hw; | 2407 | struct ieee80211_hw *hw; |
@@ -2124,6 +2411,8 @@ struct ieee80211_tx_rate_control { | |||
2124 | struct ieee80211_tx_rate reported_rate; | 2411 | struct ieee80211_tx_rate reported_rate; |
2125 | bool rts, short_preamble; | 2412 | bool rts, short_preamble; |
2126 | u8 max_rate_idx; | 2413 | u8 max_rate_idx; |
2414 | u32 rate_idx_mask; | ||
2415 | bool ap; | ||
2127 | }; | 2416 | }; |
2128 | 2417 | ||
2129 | struct rate_control_ops { | 2418 | struct rate_control_ops { |
@@ -2137,7 +2426,8 @@ struct rate_control_ops { | |||
2137 | struct ieee80211_sta *sta, void *priv_sta); | 2426 | struct ieee80211_sta *sta, void *priv_sta); |
2138 | void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, | 2427 | void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, |
2139 | struct ieee80211_sta *sta, | 2428 | struct ieee80211_sta *sta, |
2140 | void *priv_sta, u32 changed); | 2429 | void *priv_sta, u32 changed, |
2430 | enum nl80211_channel_type oper_chan_type); | ||
2141 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, | 2431 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, |
2142 | void *priv_sta); | 2432 | void *priv_sta); |
2143 | 2433 | ||