aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h581
1 files changed, 525 insertions, 56 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b0787a1dea90..e6d6a66a8f71 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -97,6 +97,20 @@ enum ieee80211_max_queues {
97}; 97};
98 98
99/** 99/**
100 * enum ieee80211_ac_numbers - AC numbers as used in mac80211
101 * @IEEE80211_AC_VO: voice
102 * @IEEE80211_AC_VI: video
103 * @IEEE80211_AC_BE: best effort
104 * @IEEE80211_AC_BK: background
105 */
106enum ieee80211_ac_numbers {
107 IEEE80211_AC_VO = 0,
108 IEEE80211_AC_VI = 1,
109 IEEE80211_AC_BE = 2,
110 IEEE80211_AC_BK = 3,
111};
112
113/**
100 * struct ieee80211_tx_queue_params - transmit queue configuration 114 * struct ieee80211_tx_queue_params - transmit queue configuration
101 * 115 *
102 * The information provided in this structure is required for QoS 116 * The information provided in this structure is required for QoS
@@ -149,6 +163,7 @@ struct ieee80211_low_level_stats {
149 * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed. 163 * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed.
150 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note 164 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
151 * that it is only ever disabled for station mode. 165 * that it is only ever disabled for station mode.
166 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
152 */ 167 */
153enum ieee80211_bss_change { 168enum ieee80211_bss_change {
154 BSS_CHANGED_ASSOC = 1<<0, 169 BSS_CHANGED_ASSOC = 1<<0,
@@ -165,6 +180,7 @@ enum ieee80211_bss_change {
165 BSS_CHANGED_IBSS = 1<<11, 180 BSS_CHANGED_IBSS = 1<<11,
166 BSS_CHANGED_ARP_FILTER = 1<<12, 181 BSS_CHANGED_ARP_FILTER = 1<<12,
167 BSS_CHANGED_QOS = 1<<13, 182 BSS_CHANGED_QOS = 1<<13,
183 BSS_CHANGED_IDLE = 1<<14,
168 184
169 /* when adding here, make sure to change ieee80211_reconfig */ 185 /* when adding here, make sure to change ieee80211_reconfig */
170}; 186};
@@ -203,6 +219,7 @@ enum ieee80211_bss_change {
203 * @basic_rates: bitmap of basic rates, each bit stands for an 219 * @basic_rates: bitmap of basic rates, each bit stands for an
204 * index into the rate table configured by the driver in 220 * index into the rate table configured by the driver in
205 * the current band. 221 * the current band.
222 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
206 * @bssid: The BSSID for this BSS 223 * @bssid: The BSSID for this BSS
207 * @enable_beacon: whether beaconing should be enabled or not 224 * @enable_beacon: whether beaconing should be enabled or not
208 * @channel_type: Channel type for this BSS -- the hardware might be 225 * @channel_type: Channel type for this BSS -- the hardware might be
@@ -223,6 +240,9 @@ enum ieee80211_bss_change {
223 * hardware must not perform any ARP filtering. Note, that the filter will 240 * hardware must not perform any ARP filtering. Note, that the filter will
224 * be enabled also in promiscuous mode. 241 * be enabled also in promiscuous mode.
225 * @qos: This is a QoS-enabled BSS. 242 * @qos: This is a QoS-enabled BSS.
243 * @idle: This interface is idle. There's also a global idle flag in the
244 * hardware config which may be more appropriate depending on what
245 * your driver/device needs to do.
226 */ 246 */
227struct ieee80211_bss_conf { 247struct ieee80211_bss_conf {
228 const u8 *bssid; 248 const u8 *bssid;
@@ -239,6 +259,7 @@ struct ieee80211_bss_conf {
239 u16 assoc_capability; 259 u16 assoc_capability;
240 u64 timestamp; 260 u64 timestamp;
241 u32 basic_rates; 261 u32 basic_rates;
262 int mcast_rate[IEEE80211_NUM_BANDS];
242 u16 ht_operation_mode; 263 u16 ht_operation_mode;
243 s32 cqm_rssi_thold; 264 s32 cqm_rssi_thold;
244 u32 cqm_rssi_hyst; 265 u32 cqm_rssi_hyst;
@@ -247,6 +268,7 @@ struct ieee80211_bss_conf {
247 u8 arp_addr_cnt; 268 u8 arp_addr_cnt;
248 bool arp_filter_enabled; 269 bool arp_filter_enabled;
249 bool qos; 270 bool qos;
271 bool idle;
250}; 272};
251 273
252/** 274/**
@@ -315,6 +337,16 @@ struct ieee80211_bss_conf {
315 * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame 337 * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
316 * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this 338 * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
317 * frame and selects the maximum number of streams that it can use. 339 * frame and selects the maximum number of streams that it can use.
340 * @IEEE80211_TX_CTL_TX_OFFCHAN: Marks this packet to be transmitted on
341 * the off-channel channel when a remain-on-channel offload is done
342 * in hardware -- normal packets still flow and are expected to be
343 * handled properly by the device.
344 * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
345 * testing. It will be sent out with incorrect Michael MIC key to allow
346 * TKIP countermeasures to be tested.
347 *
348 * Note: If you have to add new flags to the enumeration, then don't
349 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
318 */ 350 */
319enum mac80211_tx_control_flags { 351enum mac80211_tx_control_flags {
320 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 352 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -340,10 +372,25 @@ enum mac80211_tx_control_flags {
340 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 372 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
341 IEEE80211_TX_CTL_LDPC = BIT(22), 373 IEEE80211_TX_CTL_LDPC = BIT(22),
342 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), 374 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
375 IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25),
376 IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26),
343}; 377};
344 378
345#define IEEE80211_TX_CTL_STBC_SHIFT 23 379#define IEEE80211_TX_CTL_STBC_SHIFT 23
346 380
381/*
382 * This definition is used as a mask to clear all temporary flags, which are
383 * set by the tx handlers for each transmission attempt by the mac80211 stack.
384 */
385#define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \
386 IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \
387 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
388 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
389 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
390 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_PSPOLL_RESPONSE | \
391 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
392 IEEE80211_TX_CTL_STBC)
393
347/** 394/**
348 * enum mac80211_rate_control_flags - per-rate flags set by the 395 * enum mac80211_rate_control_flags - per-rate flags set by the
349 * Rate Control algorithm. 396 * Rate Control algorithm.
@@ -490,6 +537,21 @@ struct ieee80211_tx_info {
490 }; 537 };
491}; 538};
492 539
540/**
541 * struct ieee80211_sched_scan_ies - scheduled scan IEs
542 *
543 * This structure is used to pass the appropriate IEs to be used in scheduled
544 * scans for all bands. It contains both the IEs passed from the userspace
545 * and the ones generated by mac80211.
546 *
547 * @ie: array with the IEs for each supported band
548 * @len: array with the total length of the IEs for each band
549 */
550struct ieee80211_sched_scan_ies {
551 u8 *ie[IEEE80211_NUM_BANDS];
552 size_t len[IEEE80211_NUM_BANDS];
553};
554
493static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) 555static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
494{ 556{
495 return (struct ieee80211_tx_info *)skb->cb; 557 return (struct ieee80211_tx_info *)skb->cb;
@@ -552,16 +614,14 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
552 * the frame. 614 * the frame.
553 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on 615 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
554 * the frame. 616 * the frame.
555 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) 617 * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime
556 * is valid. This is useful in monitor mode and necessary for beacon frames 618 * field) is valid and contains the time the first symbol of the MPDU
557 * to enable IBSS merging. 619 * was received. This is useful in monitor mode and for proper IBSS
620 * merging.
558 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 621 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
559 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 622 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
560 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 623 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
561 * @RX_FLAG_SHORT_GI: Short guard interval was used 624 * @RX_FLAG_SHORT_GI: Short guard interval was used
562 * @RX_FLAG_INTERNAL_CMTR: set internally after frame was reported
563 * on cooked monitor to avoid double-reporting it for multiple
564 * virtual interfaces
565 */ 625 */
566enum mac80211_rx_flags { 626enum mac80211_rx_flags {
567 RX_FLAG_MMIC_ERROR = 1<<0, 627 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -570,12 +630,11 @@ enum mac80211_rx_flags {
570 RX_FLAG_IV_STRIPPED = 1<<4, 630 RX_FLAG_IV_STRIPPED = 1<<4,
571 RX_FLAG_FAILED_FCS_CRC = 1<<5, 631 RX_FLAG_FAILED_FCS_CRC = 1<<5,
572 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 632 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
573 RX_FLAG_TSFT = 1<<7, 633 RX_FLAG_MACTIME_MPDU = 1<<7,
574 RX_FLAG_SHORTPRE = 1<<8, 634 RX_FLAG_SHORTPRE = 1<<8,
575 RX_FLAG_HT = 1<<9, 635 RX_FLAG_HT = 1<<9,
576 RX_FLAG_40MHZ = 1<<10, 636 RX_FLAG_40MHZ = 1<<10,
577 RX_FLAG_SHORT_GI = 1<<11, 637 RX_FLAG_SHORT_GI = 1<<11,
578 RX_FLAG_INTERNAL_CMTR = 1<<12,
579}; 638};
580 639
581/** 640/**
@@ -596,6 +655,7 @@ enum mac80211_rx_flags {
596 * @rate_idx: index of data rate into band's supported rates or MCS index if 655 * @rate_idx: index of data rate into band's supported rates or MCS index if
597 * HT rates are use (RX_FLAG_HT) 656 * HT rates are use (RX_FLAG_HT)
598 * @flag: %RX_FLAG_* 657 * @flag: %RX_FLAG_*
658 * @rx_flags: internal RX flags for mac80211
599 */ 659 */
600struct ieee80211_rx_status { 660struct ieee80211_rx_status {
601 u64 mactime; 661 u64 mactime;
@@ -605,6 +665,7 @@ struct ieee80211_rx_status {
605 int antenna; 665 int antenna;
606 int rate_idx; 666 int rate_idx;
607 int flag; 667 int flag;
668 unsigned int rx_flags;
608}; 669};
609 670
610/** 671/**
@@ -763,6 +824,8 @@ struct ieee80211_channel_switch {
763 * @bss_conf: BSS configuration for this interface, either our own 824 * @bss_conf: BSS configuration for this interface, either our own
764 * or the BSS we're associated to 825 * or the BSS we're associated to
765 * @addr: address of this interface 826 * @addr: address of this interface
827 * @p2p: indicates whether this AP or STA interface is a p2p
828 * interface, i.e. a GO or p2p-sta respectively
766 * @drv_priv: data area for driver use, will always be aligned to 829 * @drv_priv: data area for driver use, will always be aligned to
767 * sizeof(void *). 830 * sizeof(void *).
768 */ 831 */
@@ -770,6 +833,7 @@ struct ieee80211_vif {
770 enum nl80211_iftype type; 833 enum nl80211_iftype type;
771 struct ieee80211_bss_conf bss_conf; 834 struct ieee80211_bss_conf bss_conf;
772 u8 addr[ETH_ALEN]; 835 u8 addr[ETH_ALEN];
836 bool p2p;
773 /* must be last */ 837 /* must be last */
774 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 838 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
775}; 839};
@@ -783,20 +847,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
783} 847}
784 848
785/** 849/**
786 * enum ieee80211_key_alg - key algorithm
787 * @ALG_WEP: WEP40 or WEP104
788 * @ALG_TKIP: TKIP
789 * @ALG_CCMP: CCMP (AES)
790 * @ALG_AES_CMAC: AES-128-CMAC
791 */
792enum ieee80211_key_alg {
793 ALG_WEP,
794 ALG_TKIP,
795 ALG_CCMP,
796 ALG_AES_CMAC,
797};
798
799/**
800 * enum ieee80211_key_flags - key flags 850 * enum ieee80211_key_flags - key flags
801 * 851 *
802 * These flags are used for communication about keys between the driver 852 * These flags are used for communication about keys between the driver
@@ -833,7 +883,7 @@ enum ieee80211_key_flags {
833 * @hw_key_idx: To be set by the driver, this is the key index the driver 883 * @hw_key_idx: To be set by the driver, this is the key index the driver
834 * wants to be given when a frame is transmitted and needs to be 884 * wants to be given when a frame is transmitted and needs to be
835 * encrypted in hardware. 885 * encrypted in hardware.
836 * @alg: The key algorithm. 886 * @cipher: The key's cipher suite selector.
837 * @flags: key flags, see &enum ieee80211_key_flags. 887 * @flags: key flags, see &enum ieee80211_key_flags.
838 * @keyidx: the key index (0-3) 888 * @keyidx: the key index (0-3)
839 * @keylen: key material length 889 * @keylen: key material length
@@ -846,7 +896,7 @@ enum ieee80211_key_flags {
846 * @iv_len: The IV length for this key type 896 * @iv_len: The IV length for this key type
847 */ 897 */
848struct ieee80211_key_conf { 898struct ieee80211_key_conf {
849 enum ieee80211_key_alg alg; 899 u32 cipher;
850 u8 icv_len; 900 u8 icv_len;
851 u8 iv_len; 901 u8 iv_len;
852 u8 hw_key_idx; 902 u8 hw_key_idx;
@@ -1032,6 +1082,20 @@ enum ieee80211_tkip_key_type {
1032 * @IEEE80211_HW_NEED_DTIM_PERIOD: 1082 * @IEEE80211_HW_NEED_DTIM_PERIOD:
1033 * This device needs to know the DTIM period for the BSS before 1083 * This device needs to know the DTIM period for the BSS before
1034 * associating. 1084 * associating.
1085 *
1086 * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports
1087 * per-station GTKs as used by IBSS RSN or during fast transition. If
1088 * the device doesn't support per-station GTKs, but can be asked not
1089 * to decrypt group addressed frames, then IBSS RSN support is still
1090 * possible but software crypto will be used. Advertise the wiphy flag
1091 * only in that case.
1092 *
1093 * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device
1094 * autonomously manages the PS status of connected stations. When
1095 * this flag is set mac80211 will not trigger PS mode for connected
1096 * stations based on the PM bit of incoming frames.
1097 * Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure
1098 * the PS mode of connected stations.
1035 */ 1099 */
1036enum ieee80211_hw_flags { 1100enum ieee80211_hw_flags {
1037 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1101 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1055,6 +1119,8 @@ enum ieee80211_hw_flags {
1055 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1119 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1056 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1120 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1057 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, 1121 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20,
1122 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1123 IEEE80211_HW_AP_LINK_PS = 1<<22,
1058}; 1124};
1059 1125
1060/** 1126/**
@@ -1100,8 +1166,26 @@ enum ieee80211_hw_flags {
1100 * @sta_data_size: size (in bytes) of the drv_priv data area 1166 * @sta_data_size: size (in bytes) of the drv_priv data area
1101 * within &struct ieee80211_sta. 1167 * within &struct ieee80211_sta.
1102 * 1168 *
1103 * @max_rates: maximum number of alternate rate retry stages 1169 * @max_rates: maximum number of alternate rate retry stages the hw
1170 * can handle.
1171 * @max_report_rates: maximum number of alternate rate retry stages
1172 * the hw can report back.
1104 * @max_rate_tries: maximum number of tries for each stage 1173 * @max_rate_tries: maximum number of tries for each stage
1174 *
1175 * @napi_weight: weight used for NAPI polling. You must specify an
1176 * appropriate value here if a napi_poll operation is provided
1177 * by your driver.
1178 *
1179 * @max_rx_aggregation_subframes: maximum buffer size (number of
1180 * sub-frames) to be used for A-MPDU block ack receiver
1181 * aggregation.
1182 * This is only relevant if the device has restrictions on the
1183 * number of subframes, if it relies on mac80211 to do reordering
1184 * it shouldn't be set.
1185 *
1186 * @max_tx_aggregation_subframes: maximum number of subframes in an
1187 * aggregate an HT driver will transmit, used by the peer as a
1188 * hint to size its reorder buffer.
1105 */ 1189 */
1106struct ieee80211_hw { 1190struct ieee80211_hw {
1107 struct ieee80211_conf conf; 1191 struct ieee80211_conf conf;
@@ -1113,11 +1197,15 @@ struct ieee80211_hw {
1113 int channel_change_time; 1197 int channel_change_time;
1114 int vif_data_size; 1198 int vif_data_size;
1115 int sta_data_size; 1199 int sta_data_size;
1200 int napi_weight;
1116 u16 queues; 1201 u16 queues;
1117 u16 max_listen_interval; 1202 u16 max_listen_interval;
1118 s8 max_signal; 1203 s8 max_signal;
1119 u8 max_rates; 1204 u8 max_rates;
1205 u8 max_report_rates;
1120 u8 max_rate_tries; 1206 u8 max_rate_tries;
1207 u8 max_rx_aggregation_subframes;
1208 u8 max_tx_aggregation_subframes;
1121}; 1209};
1122 1210
1123/** 1211/**
@@ -1221,7 +1309,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1221 * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key 1309 * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
1222 * handler. 1310 * handler.
1223 * The update_tkip_key() call updates the driver with the new phase 1 key. 1311 * The update_tkip_key() call updates the driver with the new phase 1 key.
1224 * This happens everytime the iv16 wraps around (every 65536 packets). The 1312 * This happens every time the iv16 wraps around (every 65536 packets). The
1225 * set_key() call will happen only once for each key (unless the AP did 1313 * set_key() call will happen only once for each key (unless the AP did
1226 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is 1314 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
1227 * provided by update_tkip_key only. The trigger that makes mac80211 call this 1315 * provided by update_tkip_key only. The trigger that makes mac80211 call this
@@ -1245,8 +1333,8 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1245 * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in 1333 * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
1246 * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused 1334 * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
1247 * with hardware wakeup and sleep states. Driver is responsible for waking 1335 * with hardware wakeup and sleep states. Driver is responsible for waking
1248 * up the hardware before issueing commands to the hardware and putting it 1336 * up the hardware before issuing commands to the hardware and putting it
1249 * back to sleep at approriate times. 1337 * back to sleep at appropriate times.
1250 * 1338 *
1251 * When PS is enabled, hardware needs to wakeup for beacons and receive the 1339 * When PS is enabled, hardware needs to wakeup for beacons and receive the
1252 * buffered multicast/broadcast frames after the beacon. Also it must be 1340 * buffered multicast/broadcast frames after the beacon. Also it must be
@@ -1267,7 +1355,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1267 * there's data traffic and still saving significantly power in idle 1355 * there's data traffic and still saving significantly power in idle
1268 * periods. 1356 * periods.
1269 * 1357 *
1270 * Dynamic powersave is supported by simply mac80211 enabling and disabling 1358 * Dynamic powersave is simply supported by mac80211 enabling and disabling
1271 * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS 1359 * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
1272 * flag and mac80211 will handle everything automatically. Additionally, 1360 * flag and mac80211 will handle everything automatically. Additionally,
1273 * hardware having support for the dynamic PS feature may set the 1361 * hardware having support for the dynamic PS feature may set the
@@ -1452,12 +1540,14 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1452 * honour this flag if possible. 1540 * honour this flag if possible.
1453 * 1541 *
1454 * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS 1542 * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS
1455 * is not set then only those addressed to this station. 1543 * is not set then only those addressed to this station.
1456 * 1544 *
1457 * @FIF_OTHER_BSS: pass frames destined to other BSSes 1545 * @FIF_OTHER_BSS: pass frames destined to other BSSes
1458 * 1546 *
1459 * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only 1547 * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
1460 * those addressed to this station. 1548 * those addressed to this station.
1549 *
1550 * @FIF_PROBE_REQ: pass probe request frames
1461 */ 1551 */
1462enum ieee80211_filter_flags { 1552enum ieee80211_filter_flags {
1463 FIF_PROMISC_IN_BSS = 1<<0, 1553 FIF_PROMISC_IN_BSS = 1<<0,
@@ -1468,6 +1558,7 @@ enum ieee80211_filter_flags {
1468 FIF_CONTROL = 1<<5, 1558 FIF_CONTROL = 1<<5,
1469 FIF_OTHER_BSS = 1<<6, 1559 FIF_OTHER_BSS = 1<<6,
1470 FIF_PSPOLL = 1<<7, 1560 FIF_PSPOLL = 1<<7,
1561 FIF_PROBE_REQ = 1<<8,
1471}; 1562};
1472 1563
1473/** 1564/**
@@ -1530,6 +1621,18 @@ enum ieee80211_ampdu_mlme_action {
1530 * you should ensure to cancel it on this callback. 1621 * you should ensure to cancel it on this callback.
1531 * Must be implemented and can sleep. 1622 * Must be implemented and can sleep.
1532 * 1623 *
1624 * @suspend: Suspend the device; mac80211 itself will quiesce before and
1625 * stop transmitting and doing any other configuration, and then
1626 * ask the device to suspend. This is only invoked when WoWLAN is
1627 * configured, otherwise the device is deconfigured completely and
1628 * reconfigured at resume time.
1629 *
1630 * @resume: If WoWLAN was configured, this indicates that mac80211 is
1631 * now resuming its operation, after this the device must be fully
1632 * functional again. If this returns an error, the only way out is
1633 * to also unregister the device. If it returns 1, then mac80211
1634 * will also go through the regular complete restart on resume.
1635 *
1533 * @add_interface: Called when a netdevice attached to the hardware is 1636 * @add_interface: Called when a netdevice attached to the hardware is
1534 * enabled. Because it is not called for monitor mode devices, @start 1637 * enabled. Because it is not called for monitor mode devices, @start
1535 * and @stop must be implemented. 1638 * and @stop must be implemented.
@@ -1540,6 +1643,12 @@ enum ieee80211_ampdu_mlme_action {
1540 * negative error code (which will be seen in userspace.) 1643 * negative error code (which will be seen in userspace.)
1541 * Must be implemented and can sleep. 1644 * Must be implemented and can sleep.
1542 * 1645 *
1646 * @change_interface: Called when a netdevice changes type. This callback
1647 * is optional, but only if it is supported can interface types be
1648 * switched while the interface is UP. The callback may sleep.
1649 * Note that while an interface is being switched, it will not be
1650 * found by the interface iteration callbacks.
1651 *
1543 * @remove_interface: Notifies a driver that an interface is going down. 1652 * @remove_interface: Notifies a driver that an interface is going down.
1544 * The @stop callback is called after this if it is the last interface 1653 * The @stop callback is called after this if it is the last interface
1545 * and no monitor interfaces are present. 1654 * and no monitor interfaces are present.
@@ -1599,6 +1708,13 @@ enum ieee80211_ampdu_mlme_action {
1599 * any error unless this callback returned a negative error code. 1708 * any error unless this callback returned a negative error code.
1600 * The callback can sleep. 1709 * The callback can sleep.
1601 * 1710 *
1711 * @sched_scan_start: Ask the hardware to start scanning repeatedly at
1712 * specific intervals. The driver must call the
1713 * ieee80211_sched_scan_results() function whenever it finds results.
1714 * This process will continue until sched_scan_stop is called.
1715 *
1716 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
1717 *
1602 * @sw_scan_start: Notifier function that is called just before a software scan 1718 * @sw_scan_start: Notifier function that is called just before a software scan
1603 * is started. Can be NULL, if the driver doesn't need this notification. 1719 * is started. Can be NULL, if the driver doesn't need this notification.
1604 * The callback can sleep. 1720 * The callback can sleep.
@@ -1617,6 +1733,11 @@ enum ieee80211_ampdu_mlme_action {
1617 * and IV16) for the given key from hardware. 1733 * and IV16) for the given key from hardware.
1618 * The callback must be atomic. 1734 * The callback must be atomic.
1619 * 1735 *
1736 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
1737 * if the device does fragmentation by itself; if this callback is
1738 * implemented then the stack will not do fragmentation.
1739 * The callback can sleep.
1740 *
1620 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1741 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1621 * The callback can sleep. 1742 * The callback can sleep.
1622 * 1743 *
@@ -1627,7 +1748,9 @@ enum ieee80211_ampdu_mlme_action {
1627 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. 1748 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1628 * 1749 *
1629 * @sta_notify: Notifies low level driver about power state transition of an 1750 * @sta_notify: Notifies low level driver about power state transition of an
1630 * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. 1751 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
1752 * in AP mode, this callback will not be called when the flag
1753 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
1631 * 1754 *
1632 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1755 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1633 * bursting) for a hardware TX queue. 1756 * bursting) for a hardware TX queue.
@@ -1662,6 +1785,21 @@ enum ieee80211_ampdu_mlme_action {
1662 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1785 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1663 * is the first frame we expect to perform the action on. Notice 1786 * is the first frame we expect to perform the action on. Notice
1664 * that TX/RX_STOP can pass NULL for this parameter. 1787 * that TX/RX_STOP can pass NULL for this parameter.
1788 * The @buf_size parameter is only valid when the action is set to
1789 * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder
1790 * buffer size (number of subframes) for this session -- the driver
1791 * may neither send aggregates containing more subframes than this
1792 * nor send aggregates in a way that lost frames would exceed the
1793 * buffer size. If just limiting the aggregate size, this would be
1794 * possible with a buf_size of 8:
1795 * - TX: 1.....7
1796 * - RX: 2....7 (lost frame #1)
1797 * - TX: 8..1...
1798 * which is invalid since #1 was now re-transmitted well past the
1799 * buffer size of 8. Correct ways to retransmit #1 would be:
1800 * - TX: 1 or 18 or 81
1801 * Even "189" would be wrong since 1 could be lost again.
1802 *
1665 * Returns a negative error code on failure. 1803 * Returns a negative error code on failure.
1666 * The callback can sleep. 1804 * The callback can sleep.
1667 * 1805 *
@@ -1687,13 +1825,55 @@ enum ieee80211_ampdu_mlme_action {
1687 * switch operation for CSAs received from the AP may implement this 1825 * switch operation for CSAs received from the AP may implement this
1688 * callback. They must then call ieee80211_chswitch_done() to indicate 1826 * callback. They must then call ieee80211_chswitch_done() to indicate
1689 * completion of the channel switch. 1827 * completion of the channel switch.
1828 *
1829 * @napi_poll: Poll Rx queue for incoming data frames.
1830 *
1831 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1832 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1833 * reject TX/RX mask combinations they cannot support by returning -EINVAL
1834 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1835 *
1836 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
1837 *
1838 * @remain_on_channel: Starts an off-channel period on the given channel, must
1839 * call back to ieee80211_ready_on_channel() when on that channel. Note
1840 * that normal channel traffic is not stopped as this is intended for hw
1841 * offload. Frames to transmit on the off-channel channel are transmitted
1842 * normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the
1843 * duration (which will always be non-zero) expires, the driver must call
1844 * ieee80211_remain_on_channel_expired(). This callback may sleep.
1845 * @cancel_remain_on_channel: Requests that an ongoing off-channel period is
1846 * aborted before it expires. This callback may sleep.
1847 * @offchannel_tx: Transmit frame on another channel, wait for a response
1848 * and return. Reliable TX status must be reported for the frame. If the
1849 * return value is 1, then the @remain_on_channel will be used with a
1850 * regular transmission (if supported.)
1851 * @offchannel_tx_cancel_wait: cancel wait associated with offchannel TX
1852 *
1853 * @set_ringparam: Set tx and rx ring sizes.
1854 *
1855 * @get_ringparam: Get tx and rx ring current and maximum sizes.
1856 *
1857 * @tx_frames_pending: Check if there is any pending frame in the hardware
1858 * queues before entering power save.
1859 *
1860 * @set_bitrate_mask: Set a mask of rates to be used for rate control selection
1861 * when transmitting a frame. Currently only legacy rates are handled.
1862 * The callback can sleep.
1690 */ 1863 */
1691struct ieee80211_ops { 1864struct ieee80211_ops {
1692 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1865 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1693 int (*start)(struct ieee80211_hw *hw); 1866 int (*start)(struct ieee80211_hw *hw);
1694 void (*stop)(struct ieee80211_hw *hw); 1867 void (*stop)(struct ieee80211_hw *hw);
1868#ifdef CONFIG_PM
1869 int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
1870 int (*resume)(struct ieee80211_hw *hw);
1871#endif
1695 int (*add_interface)(struct ieee80211_hw *hw, 1872 int (*add_interface)(struct ieee80211_hw *hw,
1696 struct ieee80211_vif *vif); 1873 struct ieee80211_vif *vif);
1874 int (*change_interface)(struct ieee80211_hw *hw,
1875 struct ieee80211_vif *vif,
1876 enum nl80211_iftype new_type, bool p2p);
1697 void (*remove_interface)(struct ieee80211_hw *hw, 1877 void (*remove_interface)(struct ieee80211_hw *hw,
1698 struct ieee80211_vif *vif); 1878 struct ieee80211_vif *vif);
1699 int (*config)(struct ieee80211_hw *hw, u32 changed); 1879 int (*config)(struct ieee80211_hw *hw, u32 changed);
@@ -1719,12 +1899,19 @@ struct ieee80211_ops {
1719 u32 iv32, u16 *phase1key); 1899 u32 iv32, u16 *phase1key);
1720 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1900 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1721 struct cfg80211_scan_request *req); 1901 struct cfg80211_scan_request *req);
1902 int (*sched_scan_start)(struct ieee80211_hw *hw,
1903 struct ieee80211_vif *vif,
1904 struct cfg80211_sched_scan_request *req,
1905 struct ieee80211_sched_scan_ies *ies);
1906 void (*sched_scan_stop)(struct ieee80211_hw *hw,
1907 struct ieee80211_vif *vif);
1722 void (*sw_scan_start)(struct ieee80211_hw *hw); 1908 void (*sw_scan_start)(struct ieee80211_hw *hw);
1723 void (*sw_scan_complete)(struct ieee80211_hw *hw); 1909 void (*sw_scan_complete)(struct ieee80211_hw *hw);
1724 int (*get_stats)(struct ieee80211_hw *hw, 1910 int (*get_stats)(struct ieee80211_hw *hw,
1725 struct ieee80211_low_level_stats *stats); 1911 struct ieee80211_low_level_stats *stats);
1726 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1912 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1727 u32 *iv32, u16 *iv16); 1913 u32 *iv32, u16 *iv16);
1914 int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
1728 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1915 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1729 int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1916 int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1730 struct ieee80211_sta *sta); 1917 struct ieee80211_sta *sta);
@@ -1741,7 +1928,8 @@ struct ieee80211_ops {
1741 int (*ampdu_action)(struct ieee80211_hw *hw, 1928 int (*ampdu_action)(struct ieee80211_hw *hw,
1742 struct ieee80211_vif *vif, 1929 struct ieee80211_vif *vif,
1743 enum ieee80211_ampdu_mlme_action action, 1930 enum ieee80211_ampdu_mlme_action action,
1744 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1931 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
1932 u8 buf_size);
1745 int (*get_survey)(struct ieee80211_hw *hw, int idx, 1933 int (*get_survey)(struct ieee80211_hw *hw, int idx,
1746 struct survey_info *survey); 1934 struct survey_info *survey);
1747 void (*rfkill_poll)(struct ieee80211_hw *hw); 1935 void (*rfkill_poll)(struct ieee80211_hw *hw);
@@ -1752,6 +1940,26 @@ struct ieee80211_ops {
1752 void (*flush)(struct ieee80211_hw *hw, bool drop); 1940 void (*flush)(struct ieee80211_hw *hw, bool drop);
1753 void (*channel_switch)(struct ieee80211_hw *hw, 1941 void (*channel_switch)(struct ieee80211_hw *hw,
1754 struct ieee80211_channel_switch *ch_switch); 1942 struct ieee80211_channel_switch *ch_switch);
1943 int (*napi_poll)(struct ieee80211_hw *hw, int budget);
1944 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
1945 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
1946
1947 int (*remain_on_channel)(struct ieee80211_hw *hw,
1948 struct ieee80211_channel *chan,
1949 enum nl80211_channel_type channel_type,
1950 int duration);
1951 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
1952 int (*offchannel_tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
1953 struct ieee80211_channel *chan,
1954 enum nl80211_channel_type channel_type,
1955 unsigned int wait);
1956 int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw);
1957 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
1958 void (*get_ringparam)(struct ieee80211_hw *hw,
1959 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1960 bool (*tx_frames_pending)(struct ieee80211_hw *hw);
1961 int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1962 const struct cfg80211_bitrate_mask *mask);
1755}; 1963};
1756 1964
1757/** 1965/**
@@ -1780,11 +1988,39 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
1780 */ 1988 */
1781int ieee80211_register_hw(struct ieee80211_hw *hw); 1989int ieee80211_register_hw(struct ieee80211_hw *hw);
1782 1990
1991/**
1992 * struct ieee80211_tpt_blink - throughput blink description
1993 * @throughput: throughput in Kbit/sec
1994 * @blink_time: blink time in milliseconds
1995 * (full cycle, ie. one off + one on period)
1996 */
1997struct ieee80211_tpt_blink {
1998 int throughput;
1999 int blink_time;
2000};
2001
2002/**
2003 * enum ieee80211_tpt_led_trigger_flags - throughput trigger flags
2004 * @IEEE80211_TPT_LEDTRIG_FL_RADIO: enable blinking with radio
2005 * @IEEE80211_TPT_LEDTRIG_FL_WORK: enable blinking when working
2006 * @IEEE80211_TPT_LEDTRIG_FL_CONNECTED: enable blinking when at least one
2007 * interface is connected in some way, including being an AP
2008 */
2009enum ieee80211_tpt_led_trigger_flags {
2010 IEEE80211_TPT_LEDTRIG_FL_RADIO = BIT(0),
2011 IEEE80211_TPT_LEDTRIG_FL_WORK = BIT(1),
2012 IEEE80211_TPT_LEDTRIG_FL_CONNECTED = BIT(2),
2013};
2014
1783#ifdef CONFIG_MAC80211_LEDS 2015#ifdef CONFIG_MAC80211_LEDS
1784extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); 2016extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
1785extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); 2017extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
1786extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); 2018extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
1787extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw); 2019extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
2020extern char *__ieee80211_create_tpt_led_trigger(
2021 struct ieee80211_hw *hw, unsigned int flags,
2022 const struct ieee80211_tpt_blink *blink_table,
2023 unsigned int blink_table_len);
1788#endif 2024#endif
1789/** 2025/**
1790 * ieee80211_get_tx_led_name - get name of TX LED 2026 * ieee80211_get_tx_led_name - get name of TX LED
@@ -1863,6 +2099,30 @@ static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
1863} 2099}
1864 2100
1865/** 2101/**
2102 * ieee80211_create_tpt_led_trigger - create throughput LED trigger
2103 * @hw: the hardware to create the trigger for
2104 * @flags: trigger flags, see &enum ieee80211_tpt_led_trigger_flags
2105 * @blink_table: the blink table -- needs to be ordered by throughput
2106 * @blink_table_len: size of the blink table
2107 *
2108 * This function returns %NULL (in case of error, or if no LED
2109 * triggers are configured) or the name of the new trigger.
2110 * This function must be called before ieee80211_register_hw().
2111 */
2112static inline char *
2113ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
2114 const struct ieee80211_tpt_blink *blink_table,
2115 unsigned int blink_table_len)
2116{
2117#ifdef CONFIG_MAC80211_LEDS
2118 return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table,
2119 blink_table_len);
2120#else
2121 return NULL;
2122#endif
2123}
2124
2125/**
1866 * ieee80211_unregister_hw - Unregister a hardware device 2126 * ieee80211_unregister_hw - Unregister a hardware device
1867 * 2127 *
1868 * This function instructs mac80211 to free allocated resources 2128 * This function instructs mac80211 to free allocated resources
@@ -1897,6 +2157,22 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
1897 */ 2157 */
1898void ieee80211_restart_hw(struct ieee80211_hw *hw); 2158void ieee80211_restart_hw(struct ieee80211_hw *hw);
1899 2159
2160/** ieee80211_napi_schedule - schedule NAPI poll
2161 *
2162 * Use this function to schedule NAPI polling on a device.
2163 *
2164 * @hw: the hardware to start polling
2165 */
2166void ieee80211_napi_schedule(struct ieee80211_hw *hw);
2167
2168/** ieee80211_napi_complete - complete NAPI polling
2169 *
2170 * Use this function to finish NAPI polling on a device.
2171 *
2172 * @hw: the hardware to stop polling
2173 */
2174void ieee80211_napi_complete(struct ieee80211_hw *hw);
2175
1900/** 2176/**
1901 * ieee80211_rx - receive frame 2177 * ieee80211_rx - receive frame
1902 * 2178 *
@@ -1952,6 +2228,48 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
1952 local_bh_enable(); 2228 local_bh_enable();
1953} 2229}
1954 2230
2231/**
2232 * ieee80211_sta_ps_transition - PS transition for connected sta
2233 *
2234 * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
2235 * flag set, use this function to inform mac80211 about a connected station
2236 * entering/leaving PS mode.
2237 *
2238 * This function may not be called in IRQ context or with softirqs enabled.
2239 *
2240 * Calls to this function for a single hardware must be synchronized against
2241 * each other.
2242 *
2243 * The function returns -EINVAL when the requested PS mode is already set.
2244 *
2245 * @sta: currently connected sta
2246 * @start: start or stop PS
2247 */
2248int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
2249
2250/**
2251 * ieee80211_sta_ps_transition_ni - PS transition for connected sta
2252 * (in process context)
2253 *
2254 * Like ieee80211_sta_ps_transition() but can be called in process context
2255 * (internally disables bottom halves). Concurrent call restriction still
2256 * applies.
2257 *
2258 * @sta: currently connected sta
2259 * @start: start or stop PS
2260 */
2261static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
2262 bool start)
2263{
2264 int ret;
2265
2266 local_bh_disable();
2267 ret = ieee80211_sta_ps_transition(sta, start);
2268 local_bh_enable();
2269
2270 return ret;
2271}
2272
1955/* 2273/*
1956 * The TX headroom reserved by mac80211 for its own tx_status functions. 2274 * The TX headroom reserved by mac80211 for its own tx_status functions.
1957 * This is enough for the radiotap header. 2275 * This is enough for the radiotap header.
@@ -1959,6 +2277,19 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
1959#define IEEE80211_TX_STATUS_HEADROOM 13 2277#define IEEE80211_TX_STATUS_HEADROOM 13
1960 2278
1961/** 2279/**
2280 * ieee80211_sta_set_tim - set the TIM bit for a sleeping station
2281 * @sta: &struct ieee80211_sta pointer for the sleeping station
2282 *
2283 * If a driver buffers frames for a powersave station instead of passing
2284 * them back to mac80211 for retransmission, the station needs to be told
2285 * to wake up using the TIM bitmap in the beacon.
2286 *
2287 * This function sets the station's TIM bit - it will be cleared when the
2288 * station wakes up.
2289 */
2290void ieee80211_sta_set_tim(struct ieee80211_sta *sta);
2291
2292/**
1962 * ieee80211_tx_status - transmit status callback 2293 * ieee80211_tx_status - transmit status callback
1963 * 2294 *
1964 * Call this function for all transmitted frames after they have been 2295 * Call this function for all transmitted frames after they have been
@@ -1967,8 +2298,8 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
1967 * 2298 *
1968 * This function may not be called in IRQ context. Calls to this function 2299 * This function may not be called in IRQ context. Calls to this function
1969 * for a single hardware must be synchronized against each other. Calls 2300 * for a single hardware must be synchronized against each other. Calls
1970 * to this function and ieee80211_tx_status_irqsafe() may not be mixed 2301 * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
1971 * for a single hardware. 2302 * may not be mixed for a single hardware.
1972 * 2303 *
1973 * @hw: the hardware the frame was transmitted by 2304 * @hw: the hardware the frame was transmitted by
1974 * @skb: the frame that was transmitted, owned by mac80211 after this call 2305 * @skb: the frame that was transmitted, owned by mac80211 after this call
@@ -1977,13 +2308,33 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
1977 struct sk_buff *skb); 2308 struct sk_buff *skb);
1978 2309
1979/** 2310/**
2311 * ieee80211_tx_status_ni - transmit status callback (in process context)
2312 *
2313 * Like ieee80211_tx_status() but can be called in process context.
2314 *
2315 * Calls to this function, ieee80211_tx_status() and
2316 * ieee80211_tx_status_irqsafe() may not be mixed
2317 * for a single hardware.
2318 *
2319 * @hw: the hardware the frame was transmitted by
2320 * @skb: the frame that was transmitted, owned by mac80211 after this call
2321 */
2322static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
2323 struct sk_buff *skb)
2324{
2325 local_bh_disable();
2326 ieee80211_tx_status(hw, skb);
2327 local_bh_enable();
2328}
2329
2330/**
1980 * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback 2331 * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback
1981 * 2332 *
1982 * Like ieee80211_tx_status() but can be called in IRQ context 2333 * Like ieee80211_tx_status() but can be called in IRQ context
1983 * (internally defers to a tasklet.) 2334 * (internally defers to a tasklet.)
1984 * 2335 *
1985 * Calls to this function and ieee80211_tx_status() may not be mixed for a 2336 * Calls to this function, ieee80211_tx_status() and
1986 * single hardware. 2337 * ieee80211_tx_status_ni() may not be mixed for a single hardware.
1987 * 2338 *
1988 * @hw: the hardware the frame was transmitted by 2339 * @hw: the hardware the frame was transmitted by
1989 * @skb: the frame that was transmitted, owned by mac80211 after this call 2340 * @skb: the frame that was transmitted, owned by mac80211 after this call
@@ -1992,6 +2343,17 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1992 struct sk_buff *skb); 2343 struct sk_buff *skb);
1993 2344
1994/** 2345/**
2346 * ieee80211_report_low_ack - report non-responding station
2347 *
2348 * When operating in AP-mode, call this function to report a non-responding
2349 * connected STA.
2350 *
2351 * @sta: the non-responding connected sta
2352 * @num_packets: number of packets sent to @sta without a response
2353 */
2354void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
2355
2356/**
1995 * ieee80211_beacon_get_tim - beacon generation function 2357 * ieee80211_beacon_get_tim - beacon generation function
1996 * @hw: pointer obtained from ieee80211_alloc_hw(). 2358 * @hw: pointer obtained from ieee80211_alloc_hw().
1997 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2359 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
@@ -2252,7 +2614,8 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
2252 * 2614 *
2253 * When hardware scan offload is used (i.e. the hw_scan() callback is 2615 * When hardware scan offload is used (i.e. the hw_scan() callback is
2254 * assigned) this function needs to be called by the driver to notify 2616 * assigned) this function needs to be called by the driver to notify
2255 * mac80211 that the scan finished. 2617 * mac80211 that the scan finished. This function can be called from
2618 * any context, including hardirq context.
2256 * 2619 *
2257 * @hw: the hardware that finished the scan 2620 * @hw: the hardware that finished the scan
2258 * @aborted: set to true if scan was aborted 2621 * @aborted: set to true if scan was aborted
@@ -2260,6 +2623,28 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
2260void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted); 2623void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
2261 2624
2262/** 2625/**
2626 * ieee80211_sched_scan_results - got results from scheduled scan
2627 *
2628 * When a scheduled scan is running, this function needs to be called by the
2629 * driver whenever there are new scan results available.
2630 *
2631 * @hw: the hardware that is performing scheduled scans
2632 */
2633void ieee80211_sched_scan_results(struct ieee80211_hw *hw);
2634
2635/**
2636 * ieee80211_sched_scan_stopped - inform that the scheduled scan has stopped
2637 *
2638 * When a scheduled scan is running, this function can be called by
2639 * the driver if it needs to stop the scan to perform another task.
2640 * Usual scenarios are drivers that cannot continue the scheduled scan
2641 * while associating, for instance.
2642 *
2643 * @hw: the hardware that is performing scheduled scans
2644 */
2645void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
2646
2647/**
2263 * ieee80211_iterate_active_interfaces - iterate active interfaces 2648 * ieee80211_iterate_active_interfaces - iterate active interfaces
2264 * 2649 *
2265 * This function iterates over the interfaces associated with a given 2650 * This function iterates over the interfaces associated with a given
@@ -2267,6 +2652,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
2267 * This function allows the iterator function to sleep, when the iterator 2652 * This function allows the iterator function to sleep, when the iterator
2268 * function is atomic @ieee80211_iterate_active_interfaces_atomic can 2653 * function is atomic @ieee80211_iterate_active_interfaces_atomic can
2269 * be used. 2654 * be used.
2655 * Does not iterate over a new interface during add_interface()
2270 * 2656 *
2271 * @hw: the hardware struct of which the interfaces should be iterated over 2657 * @hw: the hardware struct of which the interfaces should be iterated over
2272 * @iterator: the iterator function to call 2658 * @iterator: the iterator function to call
@@ -2284,6 +2670,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
2284 * hardware that are currently active and calls the callback for them. 2670 * hardware that are currently active and calls the callback for them.
2285 * This function requires the iterator callback function to be atomic, 2671 * This function requires the iterator callback function to be atomic,
2286 * if that is not desired, use @ieee80211_iterate_active_interfaces instead. 2672 * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
2673 * Does not iterate over a new interface during add_interface()
2287 * 2674 *
2288 * @hw: the hardware struct of which the interfaces should be iterated over 2675 * @hw: the hardware struct of which the interfaces should be iterated over
2289 * @iterator: the iterator function to call, cannot sleep 2676 * @iterator: the iterator function to call, cannot sleep
@@ -2324,6 +2711,7 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
2324 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 2711 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
2325 * @sta: the station for which to start a BA session 2712 * @sta: the station for which to start a BA session
2326 * @tid: the TID to BA on. 2713 * @tid: the TID to BA on.
2714 * @timeout: session timeout value (in TUs)
2327 * 2715 *
2328 * Return: success if addBA request was sent, failure otherwise 2716 * Return: success if addBA request was sent, failure otherwise
2329 * 2717 *
@@ -2331,7 +2719,8 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
2331 * the need to start aggregation on a certain RA/TID, the session level 2719 * the need to start aggregation on a certain RA/TID, the session level
2332 * will be managed by the mac80211. 2720 * will be managed by the mac80211.
2333 */ 2721 */
2334int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); 2722int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
2723 u16 timeout);
2335 2724
2336/** 2725/**
2337 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. 2726 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
@@ -2385,25 +2774,28 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
2385 const u8 *addr); 2774 const u8 *addr);
2386 2775
2387/** 2776/**
2388 * ieee80211_find_sta_by_hw - find a station on hardware 2777 * ieee80211_find_sta_by_ifaddr - find a station on hardware
2389 * 2778 *
2390 * @hw: pointer as obtained from ieee80211_alloc_hw() 2779 * @hw: pointer as obtained from ieee80211_alloc_hw()
2391 * @addr: station's address 2780 * @addr: remote station's address
2781 * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'.
2392 * 2782 *
2393 * This function must be called under RCU lock and the 2783 * This function must be called under RCU lock and the
2394 * resulting pointer is only valid under RCU lock as well. 2784 * resulting pointer is only valid under RCU lock as well.
2395 * 2785 *
2396 * NOTE: This function should not be used! When mac80211 is converted 2786 * NOTE: You may pass NULL for localaddr, but then you will just get
2397 * internally to properly keep track of stations on multiple 2787 * the first STA that matches the remote address 'addr'.
2398 * virtual interfaces, it will not always know which station to 2788 * We can have multiple STA associated with multiple
2399 * return here since a single address might be used by multiple 2789 * logical stations (e.g. consider a station connecting to another
2400 * logical stations (e.g. consider a station connecting to another 2790 * BSSID on the same AP hardware without disconnecting first).
2401 * BSSID on the same AP hardware without disconnecting first). 2791 * In this case, the result of this method with localaddr NULL
2792 * is not reliable.
2402 * 2793 *
2403 * DO NOT USE THIS FUNCTION. 2794 * DO NOT USE THIS FUNCTION with localaddr NULL if at all possible.
2404 */ 2795 */
2405struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, 2796struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw,
2406 const u8 *addr); 2797 const u8 *addr,
2798 const u8 *localaddr);
2407 2799
2408/** 2800/**
2409 * ieee80211_sta_block_awake - block station from waking up 2801 * ieee80211_sta_block_awake - block station from waking up
@@ -2438,11 +2830,26 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
2438 struct ieee80211_sta *pubsta, bool block); 2830 struct ieee80211_sta *pubsta, bool block);
2439 2831
2440/** 2832/**
2833 * ieee80211_ap_probereq_get - retrieve a Probe Request template
2834 * @hw: pointer obtained from ieee80211_alloc_hw().
2835 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2836 *
2837 * Creates a Probe Request template which can, for example, be uploaded to
2838 * hardware. The template is filled with bssid, ssid and supported rate
2839 * information. This function must only be called from within the
2840 * .bss_info_changed callback function and only in managed mode. The function
2841 * is only useful when the interface is associated, otherwise it will return
2842 * NULL.
2843 */
2844struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
2845 struct ieee80211_vif *vif);
2846
2847/**
2441 * ieee80211_beacon_loss - inform hardware does not receive beacons 2848 * ieee80211_beacon_loss - inform hardware does not receive beacons
2442 * 2849 *
2443 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2850 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2444 * 2851 *
2445 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and 2852 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and
2446 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the 2853 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2447 * hardware is not receiving beacons with this function. 2854 * hardware is not receiving beacons with this function.
2448 */ 2855 */
@@ -2453,7 +2860,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
2453 * 2860 *
2454 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2861 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2455 * 2862 *
2456 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and 2863 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and
2457 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver 2864 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
2458 * needs to inform if the connection to the AP has been lost. 2865 * needs to inform if the connection to the AP has been lost.
2459 * 2866 *
@@ -2518,6 +2925,46 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
2518 */ 2925 */
2519void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success); 2926void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
2520 2927
2928/**
2929 * ieee80211_request_smps - request SM PS transition
2930 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2931 * @smps_mode: new SM PS mode
2932 *
2933 * This allows the driver to request an SM PS transition in managed
2934 * mode. This is useful when the driver has more information than
2935 * the stack about possible interference, for example by bluetooth.
2936 */
2937void ieee80211_request_smps(struct ieee80211_vif *vif,
2938 enum ieee80211_smps_mode smps_mode);
2939
2940/**
2941 * ieee80211_key_removed - disable hw acceleration for key
2942 * @key_conf: The key hw acceleration should be disabled for
2943 *
2944 * This allows drivers to indicate that the given key has been
2945 * removed from hardware acceleration, due to a new key that
2946 * was added. Don't use this if the key can continue to be used
2947 * for TX, if the key restriction is on RX only it is permitted
2948 * to keep the key for TX only and not call this function.
2949 *
2950 * Due to locking constraints, it may only be called during
2951 * @set_key. This function must be allowed to sleep, and the
2952 * key it tries to disable may still be used until it returns.
2953 */
2954void ieee80211_key_removed(struct ieee80211_key_conf *key_conf);
2955
2956/**
2957 * ieee80211_ready_on_channel - notification of remain-on-channel start
2958 * @hw: pointer as obtained from ieee80211_alloc_hw()
2959 */
2960void ieee80211_ready_on_channel(struct ieee80211_hw *hw);
2961
2962/**
2963 * ieee80211_remain_on_channel_expired - remain_on_channel duration expired
2964 * @hw: pointer as obtained from ieee80211_alloc_hw()
2965 */
2966void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw);
2967
2521/* Rate control API */ 2968/* Rate control API */
2522 2969
2523/** 2970/**
@@ -2549,7 +2996,7 @@ enum rate_control_changed {
2549 * @rate_idx_mask: user-requested rate mask (not MCS for now) 2996 * @rate_idx_mask: user-requested rate mask (not MCS for now)
2550 * @skb: the skb that will be transmitted, the control information in it needs 2997 * @skb: the skb that will be transmitted, the control information in it needs
2551 * to be filled in 2998 * to be filled in
2552 * @ap: whether this frame is sent out in AP mode 2999 * @bss: whether this frame is sent out in AP or IBSS mode
2553 */ 3000 */
2554struct ieee80211_tx_rate_control { 3001struct ieee80211_tx_rate_control {
2555 struct ieee80211_hw *hw; 3002 struct ieee80211_hw *hw;
@@ -2560,7 +3007,7 @@ struct ieee80211_tx_rate_control {
2560 bool rts, short_preamble; 3007 bool rts, short_preamble;
2561 u8 max_rate_idx; 3008 u8 max_rate_idx;
2562 u32 rate_idx_mask; 3009 u32 rate_idx_mask;
2563 bool ap; 3010 bool bss;
2564}; 3011};
2565 3012
2566struct rate_control_ops { 3013struct rate_control_ops {
@@ -2681,4 +3128,26 @@ conf_is_ht(struct ieee80211_conf *conf)
2681 return conf->channel_type != NL80211_CHAN_NO_HT; 3128 return conf->channel_type != NL80211_CHAN_NO_HT;
2682} 3129}
2683 3130
3131static inline enum nl80211_iftype
3132ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p)
3133{
3134 if (p2p) {
3135 switch (type) {
3136 case NL80211_IFTYPE_STATION:
3137 return NL80211_IFTYPE_P2P_CLIENT;
3138 case NL80211_IFTYPE_AP:
3139 return NL80211_IFTYPE_P2P_GO;
3140 default:
3141 break;
3142 }
3143 }
3144 return type;
3145}
3146
3147static inline enum nl80211_iftype
3148ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
3149{
3150 return ieee80211_iftype_p2p(vif->type, vif->p2p);
3151}
3152
2684#endif /* MAC80211_H */ 3153#endif /* MAC80211_H */