hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/include/net/mac80211.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * mac80211 <-> driver interface
34 *
....@@ -6,11 +7,7 @@
67 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
78 * Copyright 2013-2014 Intel Mobile Communications GmbH
89 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
9
- * Copyright (C) 2018 Intel Corporation
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License version 2 as
13
- * published by the Free Software Foundation.
10
+ * Copyright (C) 2018 - 2020 Intel Corporation
1411 */
1512
1613 #ifndef MAC80211_H
....@@ -21,6 +18,7 @@
2118 #include <linux/if_ether.h>
2219 #include <linux/skbuff.h>
2320 #include <linux/ieee80211.h>
21
+#include <linux/android_kabi.h>
2422 #include <net/cfg80211.h>
2523 #include <net/codel.h>
2624 #include <net/ieee80211_radiotap.h>
....@@ -101,15 +99,22 @@
10199 * Drivers indicate that they use this model by implementing the .wake_tx_queue
102100 * driver operation.
103101 *
104
- * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
105
- * single per-vif queue for multicast data frames.
102
+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with
103
+ * another per-sta for non-data/non-mgmt and bufferable management frames, and
104
+ * a single per-vif queue for multicast data frames.
106105 *
107106 * The driver is expected to initialize its private per-queue data for stations
108107 * and interfaces in the .add_interface and .sta_add ops.
109108 *
110
- * The driver can't access the queue directly. To dequeue a frame, it calls
111
- * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
112
- * calls the .wake_tx_queue driver op.
109
+ * The driver can't access the queue directly. To dequeue a frame from a
110
+ * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a
111
+ * queue, it calls the .wake_tx_queue driver op.
112
+ *
113
+ * Drivers can optionally delegate responsibility for scheduling queues to
114
+ * mac80211, to take advantage of airtime fairness accounting. In this case, to
115
+ * obtain the next queue to pull frames from, the driver calls
116
+ * ieee80211_next_txq(). The driver is then expected to return the txq using
117
+ * ieee80211_return_txq().
113118 *
114119 * For AP powersave TIM handling, the driver only needs to indicate if it has
115120 * buffered packets in the driver specific data structures by calling
....@@ -226,7 +231,7 @@
226231
227232 bool radar_enabled;
228233
229
- u8 drv_priv[0] __aligned(sizeof(void *));
234
+ u8 drv_priv[] __aligned(sizeof(void *));
230235 };
231236
232237 /**
....@@ -308,6 +313,14 @@
308313 * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected
309314 * keep alive) changed.
310315 * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
316
+ * @BSS_CHANGED_FTM_RESPONDER: fine timing measurement request responder
317
+ * functionality changed for this BSS (AP mode).
318
+ * @BSS_CHANGED_TWT: TWT status changed
319
+ * @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed.
320
+ * @BSS_CHANGED_HE_BSS_COLOR: BSS Color has changed
321
+ * @BSS_CHANGED_FILS_DISCOVERY: FILS discovery status changed.
322
+ * @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response
323
+ * status changed.
311324 *
312325 */
313326 enum ieee80211_bss_change {
....@@ -337,6 +350,12 @@
337350 BSS_CHANGED_MU_GROUPS = 1<<23,
338351 BSS_CHANGED_KEEP_ALIVE = 1<<24,
339352 BSS_CHANGED_MCAST_RATE = 1<<25,
353
+ BSS_CHANGED_FTM_RESPONDER = 1<<26,
354
+ BSS_CHANGED_TWT = 1<<27,
355
+ BSS_CHANGED_HE_OBSS_PD = 1<<28,
356
+ BSS_CHANGED_HE_BSS_COLOR = 1<<29,
357
+ BSS_CHANGED_FILS_DISCOVERY = 1<<30,
358
+ BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31,
340359
341360 /* when adding here, make sure to change ieee80211_reconfig */
342361 };
....@@ -463,12 +482,38 @@
463482 };
464483
465484 /**
485
+ * struct ieee80211_ftm_responder_params - FTM responder parameters
486
+ *
487
+ * @lci: LCI subelement content
488
+ * @civicloc: CIVIC location subelement content
489
+ * @lci_len: LCI data length
490
+ * @civicloc_len: Civic data length
491
+ */
492
+struct ieee80211_ftm_responder_params {
493
+ const u8 *lci;
494
+ const u8 *civicloc;
495
+ size_t lci_len;
496
+ size_t civicloc_len;
497
+};
498
+
499
+/**
500
+ * struct ieee80211_fils_discovery - FILS discovery parameters from
501
+ * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
502
+ *
503
+ * @min_interval: Minimum packet interval in TUs (0 - 10000)
504
+ * @max_interval: Maximum packet interval in TUs (0 - 10000)
505
+ */
506
+struct ieee80211_fils_discovery {
507
+ u32 min_interval;
508
+ u32 max_interval;
509
+};
510
+
511
+/**
466512 * struct ieee80211_bss_conf - holds the BSS's changing parameters
467513 *
468514 * This structure keeps information about a BSS (and an association
469515 * to that BSS) that can change during the lifetime of the BSS.
470516 *
471
- * @bss_color: 6-bit value to mark inter-BSS frame, if BSS supports HE
472517 * @htc_trig_based_pkt_ext: default PE in 4us units, if BSS supports HE
473518 * @multi_sta_back_32bit: supports BA bitmap of 32-bits in Multi-STA BACK
474519 * @uora_exists: is the UORA element advertised by AP
....@@ -477,6 +522,11 @@
477522 * @uora_ocw_range: UORA element's OCW Range field
478523 * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
479524 * @he_support: does this BSS support HE
525
+ * @twt_requester: does this BSS support TWT requester (relevant for managed
526
+ * mode only, set if the AP advertises TWT responder role)
527
+ * @twt_responder: does this BSS support TWT requester (relevant for managed
528
+ * mode only, set if the AP advertises TWT responder role)
529
+ * @twt_protected: does this BSS support protected TWT frames
480530 * @assoc: association status
481531 * @ibss_joined: indicates whether this station is part of an IBSS
482532 * or not
....@@ -543,7 +593,7 @@
543593 * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
544594 * @ssid_len: Length of SSID given in @ssid.
545595 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
546
- * @txpower: TX power in dBm
596
+ * @txpower: TX power in dBm. INT_MIN means not configured.
547597 * @txpower_type: TX power adjustment used to control per packet Transmit
548598 * Power Control (TPC) in lower driver for the current vif. In particular
549599 * TPC is enabled if value passed in %txpower_type is
....@@ -561,10 +611,29 @@
561611 * @protected_keep_alive: if set, indicates that the station should send an RSN
562612 * protected frame to the AP to reset the idle timer at the AP for the
563613 * station.
614
+ * @ftm_responder: whether to enable or disable fine timing measurement FTM
615
+ * responder functionality.
616
+ * @ftmr_params: configurable lci/civic parameter when enabling FTM responder.
617
+ * @nontransmitted: this BSS is a nontransmitted BSS profile
618
+ * @transmitter_bssid: the address of transmitter AP
619
+ * @bssid_index: index inside the multiple BSSID set
620
+ * @bssid_indicator: 2^bssid_indicator is the maximum number of APs in set
621
+ * @ema_ap: AP supports enhancements of discovery and advertisement of
622
+ * nontransmitted BSSIDs
623
+ * @profile_periodicity: the least number of beacon frames need to be received
624
+ * in order to discover all the nontransmitted BSSIDs in the set.
625
+ * @he_oper: HE operation information of the AP we are connected to
626
+ * @he_obss_pd: OBSS Packet Detection parameters.
627
+ * @he_bss_color: BSS coloring settings, if BSS supports HE
628
+ * @fils_discovery: FILS discovery configuration
629
+ * @unsol_bcast_probe_resp_interval: Unsolicited broadcast probe response
630
+ * interval.
631
+ * @s1g: BSS is S1G BSS (affects Association Request format).
632
+ * @beacon_tx_rate: The configured beacon transmit rate that needs to be passed
633
+ * to driver when rate control is offloaded to firmware.
564634 */
565635 struct ieee80211_bss_conf {
566636 const u8 *bssid;
567
- u8 bss_color;
568637 u8 htc_trig_based_pkt_ext;
569638 bool multi_sta_back_32bit;
570639 bool uora_exists;
....@@ -572,6 +641,9 @@
572641 u8 uora_ocw_range;
573642 u16 frame_time_rts_th;
574643 bool he_support;
644
+ bool twt_requester;
645
+ bool twt_responder;
646
+ bool twt_protected;
575647 /* association related data */
576648 bool assoc, ibss_joined;
577649 bool ibss_creator;
....@@ -611,6 +683,27 @@
611683 bool allow_p2p_go_ps;
612684 u16 max_idle_period;
613685 bool protected_keep_alive;
686
+ bool ftm_responder;
687
+ struct ieee80211_ftm_responder_params *ftmr_params;
688
+ /* Multiple BSSID data */
689
+ bool nontransmitted;
690
+ u8 transmitter_bssid[ETH_ALEN];
691
+ u8 bssid_index;
692
+ u8 bssid_indicator;
693
+ bool ema_ap;
694
+ u8 profile_periodicity;
695
+ struct {
696
+ u32 params;
697
+ u16 nss_set;
698
+ } he_oper;
699
+ struct ieee80211_he_obss_pd he_obss_pd;
700
+ struct cfg80211_he_bss_color he_bss_color;
701
+ struct ieee80211_fils_discovery fils_discovery;
702
+ u32 unsol_bcast_probe_resp_interval;
703
+ bool s1g;
704
+ struct cfg80211_bitrate_mask beacon_tx_rate;
705
+
706
+ ANDROID_KABI_RESERVE(1);
614707 };
615708
616709 /**
....@@ -657,9 +750,8 @@
657750 * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate
658751 * that a frame can be transmitted while the queues are stopped for
659752 * off-channel operation.
660
- * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
661
- * used to indicate that a pending frame requires TX processing before
662
- * it can be sent out.
753
+ * @IEEE80211_TX_CTL_HW_80211_ENCAP: This frame uses hardware encapsulation
754
+ * (header conversion)
663755 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
664756 * used to indicate that a frame was already retried due to PS
665757 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
....@@ -728,7 +820,7 @@
728820 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
729821 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
730822 IEEE80211_TX_INTFL_OFFCHAN_TX_OK = BIT(13),
731
- IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
823
+ IEEE80211_TX_CTL_HW_80211_ENCAP = BIT(14),
732824 IEEE80211_TX_INTFL_RETRIED = BIT(15),
733825 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
734826 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
....@@ -749,6 +841,8 @@
749841
750842 #define IEEE80211_TX_CTL_STBC_SHIFT 23
751843
844
+#define IEEE80211_TX_RC_S1G_MCS IEEE80211_TX_RC_VHT_MCS
845
+
752846 /**
753847 * enum mac80211_tx_control_flags - flags to describe transmit control
754848 *
....@@ -759,6 +853,12 @@
759853 * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
760854 * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
761855 * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path
856
+ * @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup
857
+ * @IEEE80211_TX_INTCFL_NEED_TXPROCESSING: completely internal to mac80211,
858
+ * used to indicate that a pending frame requires TX processing before
859
+ * it can be sent out.
860
+ * @IEEE80211_TX_CTRL_NO_SEQNO: Do not overwrite the sequence number that
861
+ * has already been assigned to this frame.
762862 *
763863 * These flags are used in tx_info->control.flags.
764864 */
....@@ -768,6 +868,9 @@
768868 IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
769869 IEEE80211_TX_CTRL_AMSDU = BIT(3),
770870 IEEE80211_TX_CTRL_FAST_XMIT = BIT(4),
871
+ IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP = BIT(5),
872
+ IEEE80211_TX_INTCFL_NEED_TXPROCESSING = BIT(6),
873
+ IEEE80211_TX_CTRL_NO_SEQNO = BIT(7),
771874 };
772875
773876 /*
....@@ -909,8 +1012,34 @@
9091012 * @band: the band to transmit on (use for checking for races)
9101013 * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
9111014 * @ack_frame_id: internal frame ID for TX status, used internally
912
- * @control: union for control data
913
- * @status: union for status data
1015
+ * @tx_time_est: TX time estimate in units of 4us, used internally
1016
+ * @control: union part for control data
1017
+ * @control.rates: TX rates array to try
1018
+ * @control.rts_cts_rate_idx: rate for RTS or CTS
1019
+ * @control.use_rts: use RTS
1020
+ * @control.use_cts_prot: use RTS/CTS
1021
+ * @control.short_preamble: use short preamble (CCK only)
1022
+ * @control.skip_table: skip externally configured rate table
1023
+ * @control.jiffies: timestamp for expiry on powersave clients
1024
+ * @control.vif: virtual interface (may be NULL)
1025
+ * @control.hw_key: key to encrypt with (may be NULL)
1026
+ * @control.flags: control flags, see &enum mac80211_tx_control_flags
1027
+ * @control.enqueue_time: enqueue time (for iTXQs)
1028
+ * @driver_rates: alias to @control.rates to reserve space
1029
+ * @pad: padding
1030
+ * @rate_driver_data: driver use area if driver needs @control.rates
1031
+ * @status: union part for status data
1032
+ * @status.rates: attempted rates
1033
+ * @status.ack_signal: ACK signal
1034
+ * @status.ampdu_ack_len: AMPDU ack length
1035
+ * @status.ampdu_len: AMPDU length
1036
+ * @status.antenna: (legacy, kept only for iwlegacy)
1037
+ * @status.tx_time: airtime consumed for transmission; note this is only
1038
+ * used for WMM AC, not for airtime fairness
1039
+ * @status.is_valid_ack_signal: ACK signal is valid
1040
+ * @status.status_driver_data: driver use area
1041
+ * @ack: union part for pure ACK data
1042
+ * @ack.cookie: cookie for the ACK
9141043 * @driver_data: array of driver_data pointers
9151044 * @ampdu_ack_len: number of acked aggregated frames.
9161045 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
....@@ -921,11 +1050,11 @@
9211050 struct ieee80211_tx_info {
9221051 /* common information */
9231052 u32 flags;
924
- u8 band;
925
-
926
- u8 hw_queue;
927
-
928
- u16 ack_frame_id;
1053
+ u32 band:3,
1054
+ ack_frame_id:13,
1055
+ hw_queue:4,
1056
+ tx_time_est:10;
1057
+ /* 2 free bits */
9291058
9301059 union {
9311060 struct {
....@@ -971,22 +1100,45 @@
9711100 void *rate_driver_data[
9721101 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
9731102 };
1103
+
1104
+ ANDROID_KABI_RESERVE(1);
1105
+
9741106 void *driver_data[
9751107 IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
9761108 };
9771109 };
9781110
1111
+static inline u16
1112
+ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
1113
+{
1114
+ /* We only have 10 bits in tx_time_est, so store airtime
1115
+ * in increments of 4us and clamp the maximum to 2**12-1
1116
+ */
1117
+ info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
1118
+ return info->tx_time_est << 2;
1119
+}
1120
+
1121
+static inline u16
1122
+ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
1123
+{
1124
+ return info->tx_time_est << 2;
1125
+}
1126
+
9791127 /**
980
- * struct ieee80211_tx_status - extended tx staus info for rate control
1128
+ * struct ieee80211_tx_status - extended tx status info for rate control
9811129 *
9821130 * @sta: Station that the packet was transmitted for
9831131 * @info: Basic tx status information
9841132 * @skb: Packet skb (can be NULL if not provided by the driver)
1133
+ * @rate: The TX rate that was used when sending the packet
1134
+ * @free_list: list where processed skbs are stored to be free'd by the driver
9851135 */
9861136 struct ieee80211_tx_status {
9871137 struct ieee80211_sta *sta;
9881138 struct ieee80211_tx_info *info;
9891139 struct sk_buff *skb;
1140
+ struct rate_info *rate;
1141
+ struct list_head *free_list;
9901142 };
9911143
9921144 /**
....@@ -1130,6 +1282,7 @@
11301282 * @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known
11311283 * @RX_FLAG_RADIOTAP_HE: HE radiotap data is present
11321284 * (&struct ieee80211_radiotap_he, mac80211 will fill in
1285
+ *
11331286 * - DATA3_DATA_MCS
11341287 * - DATA3_DATA_DCM
11351288 * - DATA3_CODING
....@@ -1137,9 +1290,15 @@
11371290 * - DATA5_DATA_BW_RU_ALLOC
11381291 * - DATA6_NSTS
11391292 * - DATA3_STBC
1293
+ *
11401294 * from the RX info data, so leave those zeroed when building this data)
11411295 * @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
11421296 * (&struct ieee80211_radiotap_he_mu)
1297
+ * @RX_FLAG_RADIOTAP_LSIG: L-SIG radiotap data is present
1298
+ * @RX_FLAG_NO_PSDU: use the frame only for radiotap reporting, with
1299
+ * the "0-length PSDU" field included there. The value for it is
1300
+ * in &struct ieee80211_rx_status. Note that if this value isn't
1301
+ * known the frame shouldn't be reported.
11431302 */
11441303 enum mac80211_rx_flags {
11451304 RX_FLAG_MMIC_ERROR = BIT(0),
....@@ -1170,6 +1329,8 @@
11701329 RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(25),
11711330 RX_FLAG_RADIOTAP_HE = BIT(26),
11721331 RX_FLAG_RADIOTAP_HE_MU = BIT(27),
1332
+ RX_FLAG_RADIOTAP_LSIG = BIT(28),
1333
+ RX_FLAG_NO_PSDU = BIT(29),
11731334 };
11741335
11751336 /**
....@@ -1180,7 +1341,7 @@
11801341 * @RX_ENC_FLAG_HT_GF: This frame was received in a HT-greenfield transmission,
11811342 * if the driver fills this value it should add
11821343 * %IEEE80211_RADIOTAP_MCS_HAVE_FMT
1183
- * to hw.radiotap_mcs_details to advertise that fact
1344
+ * to @hw.radiotap_mcs_details to advertise that fact.
11841345 * @RX_ENC_FLAG_LDPC: LDPC was used
11851346 * @RX_ENC_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
11861347 * @RX_ENC_FLAG_BF: packet was beamformed
....@@ -1220,6 +1381,7 @@
12201381 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
12211382 * This field must be set for management frames, but isn't strictly needed
12221383 * for data (other) frames - for those it only affects radiotap reporting.
1384
+ * @freq_offset: @freq has a positive offset of 500Khz.
12231385 * @signal: signal strength when receiving this frame, either in dBm, in dB or
12241386 * unspecified depending on the hardware capabilities flags
12251387 * @IEEE80211_HW_SIGNAL_*
....@@ -1242,6 +1404,7 @@
12421404 * @ampdu_reference: A-MPDU reference number, must be a different value for
12431405 * each A-MPDU but the same for each subframe within one A-MPDU
12441406 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
1407
+ * @zero_length_psdu_type: radiotap type of the 0-length PSDU
12451408 */
12461409 struct ieee80211_rx_status {
12471410 u64 mactime;
....@@ -1249,7 +1412,7 @@
12491412 u32 device_timestamp;
12501413 u32 ampdu_reference;
12511414 u32 flag;
1252
- u16 freq;
1415
+ u16 freq: 13, freq_offset: 1;
12531416 u8 enc_flags;
12541417 u8 encoding:2, bw:3, he_ru:3;
12551418 u8 he_gi:2, he_dcm:1;
....@@ -1262,7 +1425,15 @@
12621425 u8 chains;
12631426 s8 chain_signal[IEEE80211_MAX_CHAINS];
12641427 u8 ampdu_delimiter_crc;
1428
+ u8 zero_length_psdu_type;
12651429 };
1430
+
1431
+static inline u32
1432
+ieee80211_rx_status_to_khz(struct ieee80211_rx_status *rx_status)
1433
+{
1434
+ return MHZ_TO_KHZ(rx_status->freq) +
1435
+ (rx_status->freq_offset ? 500 : 0);
1436
+}
12661437
12671438 /**
12681439 * struct ieee80211_vendor_radiotap - vendor radiotap data information
....@@ -1418,6 +1589,8 @@
14181589 struct cfg80211_chan_def chandef;
14191590 bool radar_enabled;
14201591 enum ieee80211_smps_mode smps_mode;
1592
+
1593
+ ANDROID_KABI_RESERVE(1);
14211594 };
14221595
14231596 /**
....@@ -1436,6 +1609,9 @@
14361609 * scheduled channel switch, as indicated by the AP.
14371610 * @chandef: the new channel to switch to
14381611 * @count: the number of TBTT's until the channel switch event
1612
+ * @delay: maximum delay between the time the AP transmitted the last beacon in
1613
+ * current channel and the expected time of the first beacon in the new
1614
+ * channel, expressed in TU.
14391615 */
14401616 struct ieee80211_channel_switch {
14411617 u64 timestamp;
....@@ -1443,6 +1619,7 @@
14431619 bool block_tx;
14441620 struct cfg80211_chan_def chandef;
14451621 u8 count;
1622
+ u32 delay;
14461623 };
14471624
14481625 /**
....@@ -1469,6 +1646,21 @@
14691646 IEEE80211_VIF_GET_NOA_UPDATE = BIT(3),
14701647 };
14711648
1649
+
1650
+/**
1651
+ * enum ieee80211_offload_flags - virtual interface offload flags
1652
+ *
1653
+ * @IEEE80211_OFFLOAD_ENCAP_ENABLED: tx encapsulation offload is enabled
1654
+ * The driver supports sending frames passed as 802.3 frames by mac80211.
1655
+ * It must also support sending 802.11 packets for the same interface.
1656
+ * @IEEE80211_OFFLOAD_ENCAP_4ADDR: support 4-address mode encapsulation offload
1657
+ */
1658
+
1659
+enum ieee80211_offload_flags {
1660
+ IEEE80211_OFFLOAD_ENCAP_ENABLED = BIT(0),
1661
+ IEEE80211_OFFLOAD_ENCAP_4ADDR = BIT(1),
1662
+};
1663
+
14721664 /**
14731665 * struct ieee80211_vif - per-interface data
14741666 *
....@@ -1489,6 +1681,11 @@
14891681 * these need to be set (or cleared) when the interface is added
14901682 * or, if supported by the driver, the interface type is changed
14911683 * at runtime, mac80211 will never touch this field
1684
+ * @offloaad_flags: hardware offload capabilities/flags for this interface.
1685
+ * These are initialized by mac80211 before calling .add_interface,
1686
+ * .change_interface or .update_vif_offload and updated by the driver
1687
+ * within these ops, based on supported features or runtime change
1688
+ * restrictions.
14921689 * @hw_queue: hardware queue for each AC
14931690 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
14941691 * @chanctx_conf: The channel context this interface is assigned to, or %NULL
....@@ -1501,9 +1698,15 @@
15011698 * monitor interface (if that is requested.)
15021699 * @probe_req_reg: probe requests should be reported to mac80211 for this
15031700 * interface.
1701
+ * @rx_mcast_action_reg: multicast Action frames should be reported to mac80211
1702
+ * for this interface.
15041703 * @drv_priv: data area for driver use, will always be aligned to
15051704 * sizeof(void \*).
15061705 * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
1706
+ * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped,
1707
+ * protected by fq->lock.
1708
+ * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see
1709
+ * &enum ieee80211_offload_flags.
15071710 */
15081711 struct ieee80211_vif {
15091712 enum nl80211_iftype type;
....@@ -1521,15 +1724,21 @@
15211724 struct ieee80211_chanctx_conf __rcu *chanctx_conf;
15221725
15231726 u32 driver_flags;
1727
+ u32 offload_flags;
15241728
15251729 #ifdef CONFIG_MAC80211_DEBUGFS
15261730 struct dentry *debugfs_dir;
15271731 #endif
15281732
1529
- unsigned int probe_req_reg;
1733
+ bool probe_req_reg;
1734
+ bool rx_mcast_action_reg;
1735
+
1736
+ bool txqs_stopped[IEEE80211_NUM_ACS];
1737
+
1738
+ ANDROID_KABI_RESERVE(1);
15301739
15311740 /* must be last */
1532
- u8 drv_priv[0] __aligned(sizeof(void *));
1741
+ u8 drv_priv[] __aligned(sizeof(void *));
15331742 };
15341743
15351744 static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
....@@ -1599,13 +1808,17 @@
15991808 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
16001809 * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
16011810 * driver for a CCMP/GCMP key to indicate that is requires IV generation
1602
- * only for managment frames (MFP).
1811
+ * only for management frames (MFP).
16031812 * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
16041813 * driver for a key to indicate that sufficient tailroom must always
16051814 * be reserved for ICV or MIC, even when HW encryption is enabled.
16061815 * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for
16071816 * a TKIP key if it only requires MIC space. Do not set together with
16081817 * @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
1818
+ * @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation.
1819
+ * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver
1820
+ * for a AES_CMAC key to indicate that it requires sequence number
1821
+ * generation only
16091822 */
16101823 enum ieee80211_key_flags {
16111824 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0),
....@@ -1617,6 +1830,8 @@
16171830 IEEE80211_KEY_FLAG_RX_MGMT = BIT(6),
16181831 IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7),
16191832 IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(8),
1833
+ IEEE80211_KEY_FLAG_NO_AUTO_TX = BIT(9),
1834
+ IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(10),
16201835 };
16211836
16221837 /**
....@@ -1651,7 +1866,7 @@
16511866 s8 keyidx;
16521867 u16 flags;
16531868 u8 keylen;
1654
- u8 key[0];
1869
+ u8 key[];
16551870 };
16561871
16571872 #define IEEE80211_MAX_PN_LEN 16
....@@ -1797,6 +2012,24 @@
17972012 };
17982013
17992014 /**
2015
+ * struct ieee80211_sta_txpwr - station txpower configuration
2016
+ *
2017
+ * Used to configure txpower for station.
2018
+ *
2019
+ * @power: indicates the tx power, in dBm, to be used when sending data frames
2020
+ * to the STA.
2021
+ * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
2022
+ * will be less than or equal to specified from userspace, whereas if TPC
2023
+ * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
2024
+ * NL80211_TX_POWER_FIXED is not a valid configuration option for
2025
+ * per peer TPC.
2026
+ */
2027
+struct ieee80211_sta_txpwr {
2028
+ s16 power;
2029
+ enum nl80211_tx_power_setting type;
2030
+};
2031
+
2032
+/**
18002033 * struct ieee80211_sta - station table entry
18012034 *
18022035 * A station table entry represents a station we are possibly
....@@ -1812,6 +2045,7 @@
18122045 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
18132046 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
18142047 * @he_cap: HE capabilities of this STA
2048
+ * @he_6ghz_capa: on 6 GHz, holds the HE 6 GHz band capabilities
18152049 * @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU
18162050 * that this station is allowed to transmit to us.
18172051 * Can be modified by driver.
....@@ -1839,7 +2073,10 @@
18392073 * unlimited.
18402074 * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
18412075 * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
1842
- * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
2076
+ * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
2077
+ * @txpwr: the station tx power configuration
2078
+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that
2079
+ * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames
18432080 */
18442081 struct ieee80211_sta {
18452082 u32 supp_rates[NUM_NL80211_BANDS];
....@@ -1848,6 +2085,7 @@
18482085 struct ieee80211_sta_ht_cap ht_cap;
18492086 struct ieee80211_sta_vht_cap vht_cap;
18502087 struct ieee80211_sta_he_cap he_cap;
2088
+ struct ieee80211_he_6ghz_capa he_6ghz_capa;
18512089 u16 max_rx_aggregation_subframes;
18522090 bool wme;
18532091 u8 uapsd_queues;
....@@ -1869,7 +2107,7 @@
18692107 *
18702108 * * If the skb is transmitted as part of a BA agreement, the
18712109 * A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
1872
- * * If the skb is not part of a BA aggreement, the A-MSDU maximal
2110
+ * * If the skb is not part of a BA agreement, the A-MSDU maximal
18732111 * size is min(max_amsdu_len, 7935) bytes.
18742112 *
18752113 * Both additional HT limits must be enforced by the low level
....@@ -1879,11 +2117,15 @@
18792117 u16 max_amsdu_len;
18802118 bool support_p2p_ps;
18812119 u16 max_rc_amsdu_len;
2120
+ u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS];
2121
+ struct ieee80211_sta_txpwr txpwr;
18822122
1883
- struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
2123
+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
2124
+
2125
+ ANDROID_KABI_RESERVE(1);
18842126
18852127 /* must be last */
1886
- u8 drv_priv[0] __aligned(sizeof(void *));
2128
+ u8 drv_priv[] __aligned(sizeof(void *));
18872129 };
18882130
18892131 /**
....@@ -1914,7 +2156,8 @@
19142156 *
19152157 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
19162158 * @sta: station table entry, %NULL for per-vif queue
1917
- * @tid: the TID for this queue (unused for per-vif queue)
2159
+ * @tid: the TID for this queue (unused for per-vif queue),
2160
+ * %IEEE80211_NUM_TIDS for non-data (if enabled)
19182161 * @ac: the AC for this queue
19192162 * @drv_priv: driver private area, sized by hw->txq_data_size
19202163 *
....@@ -1928,7 +2171,7 @@
19282171 u8 ac;
19292172
19302173 /* must be last */
1931
- u8 drv_priv[0] __aligned(sizeof(void *));
2174
+ u8 drv_priv[] __aligned(sizeof(void *));
19322175 };
19332176
19342177 /**
....@@ -2127,6 +2370,34 @@
21272370 * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't
21282371 * support QoS NDP for AP probing - that's most likely a driver bug.
21292372 *
2373
+ * @IEEE80211_HW_BUFF_MMPDU_TXQ: use the TXQ for bufferable MMPDUs, this of
2374
+ * course requires the driver to use TXQs to start with.
2375
+ *
2376
+ * @IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW: (Hardware) rate control supports VHT
2377
+ * extended NSS BW (dot11VHTExtendedNSSBWCapable). This flag will be set if
2378
+ * the selected rate control algorithm sets %RATE_CTRL_CAPA_VHT_EXT_NSS_BW
2379
+ * but if the rate control is built-in then it must be set by the driver.
2380
+ * See also the documentation for that flag.
2381
+ *
2382
+ * @IEEE80211_HW_STA_MMPDU_TXQ: use the extra non-TID per-station TXQ for all
2383
+ * MMPDUs on station interfaces. This of course requires the driver to use
2384
+ * TXQs to start with.
2385
+ *
2386
+ * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU
2387
+ * length in tx status information
2388
+ *
2389
+ * @IEEE80211_HW_SUPPORTS_MULTI_BSSID: Hardware supports multi BSSID
2390
+ *
2391
+ * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
2392
+ * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
2393
+ *
2394
+ * @IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT: The card and driver is only
2395
+ * aggregating MPDUs with the same keyid, allowing mac80211 to keep Tx
2396
+ * A-MPDU sessions active while rekeying with Extended Key ID.
2397
+ *
2398
+ * @IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD: Hardware supports tx encapsulation
2399
+ * offload
2400
+ *
21302401 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
21312402 */
21322403 enum ieee80211_hw_flags {
....@@ -2172,6 +2443,14 @@
21722443 IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
21732444 IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
21742445 IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP,
2446
+ IEEE80211_HW_BUFF_MMPDU_TXQ,
2447
+ IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
2448
+ IEEE80211_HW_STA_MMPDU_TXQ,
2449
+ IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
2450
+ IEEE80211_HW_SUPPORTS_MULTI_BSSID,
2451
+ IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
2452
+ IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT,
2453
+ IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
21752454
21762455 /* keep last, obviously */
21772456 NUM_IEEE80211_HW_FLAGS
....@@ -2263,12 +2542,14 @@
22632542 * @radiotap_he: HE radiotap validity flags
22642543 *
22652544 * @radiotap_timestamp: Information for the radiotap timestamp field; if the
2266
- * 'units_pos' member is set to a non-negative value it must be set to
2267
- * a combination of a IEEE80211_RADIOTAP_TIMESTAMP_UNIT_* and a
2268
- * IEEE80211_RADIOTAP_TIMESTAMP_SPOS_* value, and then the timestamp
2545
+ * @units_pos member is set to a non-negative value then the timestamp
22692546 * field will be added and populated from the &struct ieee80211_rx_status
2270
- * device_timestamp. If the 'accuracy' member is non-negative, it's put
2271
- * into the accuracy radiotap field and the accuracy known flag is set.
2547
+ * device_timestamp.
2548
+ * @radiotap_timestamp.units_pos: Must be set to a combination of a
2549
+ * IEEE80211_RADIOTAP_TIMESTAMP_UNIT_* and a
2550
+ * IEEE80211_RADIOTAP_TIMESTAMP_SPOS_* value.
2551
+ * @radiotap_timestamp.accuracy: If non-negative, fills the accuracy in the
2552
+ * radiotap field and the accuracy known flag will be set.
22722553 *
22732554 * @netdev_features: netdev features to be set in each netdev created
22742555 * from this HW. Note that not all features are usable with mac80211,
....@@ -2290,6 +2571,15 @@
22902571 * supported by HW.
22912572 * @max_nan_de_entries: maximum number of NAN DE functions supported by the
22922573 * device.
2574
+ *
2575
+ * @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from
2576
+ * them are encountered. The default should typically not be changed,
2577
+ * unless the driver has good reasons for needing more buffers.
2578
+ *
2579
+ * @weight_multiplier: Driver specific airtime weight multiplier used while
2580
+ * refilling deficit of each TXQ.
2581
+ *
2582
+ * @max_mtu: the max mtu could be set.
22932583 */
22942584 struct ieee80211_hw {
22952585 struct ieee80211_conf conf;
....@@ -2325,6 +2615,11 @@
23252615 u8 n_cipher_schemes;
23262616 const struct ieee80211_cipher_scheme *cipher_schemes;
23272617 u8 max_nan_de_entries;
2618
+ u8 tx_sk_pacing_shift;
2619
+ u8 weight_multiplier;
2620
+ u32 max_mtu;
2621
+
2622
+ ANDROID_KABI_RESERVE(1);
23282623 };
23292624
23302625 static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
....@@ -2448,7 +2743,7 @@
24482743 * @hw: the hardware
24492744 * @skb: the skb
24502745 *
2451
- * Free a transmit skb. Use this funtion when some failure
2746
+ * Free a transmit skb. Use this function when some failure
24522747 * to transmit happened and thus status cannot be reported.
24532748 */
24542749 void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
....@@ -2506,6 +2801,19 @@
25062801 * The set_default_unicast_key() call updates the default WEP key index
25072802 * configured to the hardware for WEP encryption type. This is required
25082803 * for devices that support offload of data packets (e.g. ARP responses).
2804
+ *
2805
+ * Mac80211 drivers should set the @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 flag
2806
+ * when they are able to replace in-use PTK keys according to the following
2807
+ * requirements:
2808
+ * 1) They do not hand over frames decrypted with the old key to
2809
+ mac80211 once the call to set_key() with command %DISABLE_KEY has been
2810
+ completed when also setting @IEEE80211_KEY_FLAG_GENERATE_IV for any key,
2811
+ 2) either drop or continue to use the old key for any outgoing frames queued
2812
+ at the time of the key deletion (including re-transmits),
2813
+ 3) never send out a frame queued prior to the set_key() %SET_KEY command
2814
+ encrypted with the new key and
2815
+ 4) never send out a frame unencrypted when it should be encrypted.
2816
+ Mac80211 will not queue any new frames for a deleted key to the driver.
25092817 */
25102818
25112819 /**
....@@ -2879,6 +3187,8 @@
28793187 * @FIF_PSPOLL: pass PS Poll frames
28803188 *
28813189 * @FIF_PROBE_REQ: pass probe request frames
3190
+ *
3191
+ * @FIF_MCAST_ACTION: pass multicast Action frames
28823192 */
28833193 enum ieee80211_filter_flags {
28843194 FIF_ALLMULTI = 1<<1,
....@@ -2889,6 +3199,7 @@
28893199 FIF_OTHER_BSS = 1<<6,
28903200 FIF_PSPOLL = 1<<7,
28913201 FIF_PROBE_REQ = 1<<8,
3202
+ FIF_MCAST_ACTION = 1<<9,
28923203 };
28933204
28943205 /**
....@@ -2904,7 +3215,12 @@
29043215 *
29053216 * @IEEE80211_AMPDU_RX_START: start RX aggregation
29063217 * @IEEE80211_AMPDU_RX_STOP: stop RX aggregation
2907
- * @IEEE80211_AMPDU_TX_START: start TX aggregation
3218
+ * @IEEE80211_AMPDU_TX_START: start TX aggregation, the driver must either
3219
+ * call ieee80211_start_tx_ba_cb_irqsafe() or
3220
+ * call ieee80211_start_tx_ba_cb_irqsafe() with status
3221
+ * %IEEE80211_AMPDU_TX_START_DELAY_ADDBA to delay addba after
3222
+ * ieee80211_start_tx_ba_cb_irqsafe is called, or just return the special
3223
+ * status %IEEE80211_AMPDU_TX_START_IMMEDIATE.
29083224 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
29093225 * @IEEE80211_AMPDU_TX_STOP_CONT: stop TX aggregation but continue transmitting
29103226 * queued packets, now unaggregated. After all packets are transmitted the
....@@ -2927,6 +3243,9 @@
29273243 IEEE80211_AMPDU_TX_STOP_FLUSH_CONT,
29283244 IEEE80211_AMPDU_TX_OPERATIONAL,
29293245 };
3246
+
3247
+#define IEEE80211_AMPDU_TX_START_IMMEDIATE 1
3248
+#define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2
29303249
29313250 /**
29323251 * struct ieee80211_ampdu_params - AMPDU action parameters
....@@ -2992,13 +3311,13 @@
29923311 *
29933312 * With the support for multi channel contexts and multi channel operations,
29943313 * remain on channel operations might be limited/deferred/aborted by other
2995
- * flows/operations which have higher priority (and vise versa).
3314
+ * flows/operations which have higher priority (and vice versa).
29963315 * Specifying the ROC type can be used by devices to prioritize the ROC
29973316 * operations compared to other operations/flows.
29983317 *
29993318 * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC.
30003319 * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required
3001
- * for sending managment frames offchannel.
3320
+ * for sending management frames offchannel.
30023321 */
30033322 enum ieee80211_roc_type {
30043323 IEEE80211_ROC_TYPE_NORMAL = 0,
....@@ -3006,7 +3325,7 @@
30063325 };
30073326
30083327 /**
3009
- * enum ieee80211_reconfig_complete_type - reconfig type
3328
+ * enum ieee80211_reconfig_type - reconfig type
30103329 *
30113330 * This enum is used by the reconfig_complete() callback to indicate what
30123331 * reconfiguration type was completed.
....@@ -3164,6 +3483,11 @@
31643483 * When the scan finishes, ieee80211_scan_completed() must be called;
31653484 * note that it also must be called when the scan cannot finish due to
31663485 * any error unless this callback returned a negative error code.
3486
+ * This callback is also allowed to return the special return value 1,
3487
+ * this indicates that hardware scan isn't desirable right now and a
3488
+ * software scan should be done instead. A driver wishing to use this
3489
+ * capability must ensure its (hardware) scan capabilities aren't
3490
+ * advertised as more capable than mac80211's software scan is.
31673491 * The callback can sleep.
31683492 *
31693493 * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan.
....@@ -3230,6 +3554,10 @@
32303554 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
32313555 * in AP mode, this callback will not be called when the flag
32323556 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
3557
+ *
3558
+ * @sta_set_txpwr: Configure the station tx power. This callback set the tx
3559
+ * power for the station.
3560
+ * This callback can sleep.
32333561 *
32343562 * @sta_state: Notifies low level driver about state transition of a
32353563 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
....@@ -3481,7 +3809,7 @@
34813809 * decremented, and when they reach 1 the driver must call
34823810 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
34833811 * get the csa counter decremented by mac80211, but must check if it is
3484
- * 1 using ieee80211_csa_is_complete() after the beacon has been
3812
+ * 1 using ieee80211_beacon_counter_is_complete() after the beacon has been
34853813 * transmitted and then call ieee80211_csa_finish().
34863814 * If the CSA count starts as zero or 1, this function will not be called,
34873815 * since there won't be any time to beacon before the switch anyway.
....@@ -3492,7 +3820,12 @@
34923820 * @post_channel_switch: This is an optional callback that is called
34933821 * after a channel switch procedure is completed, allowing the
34943822 * driver to go back to a normal configuration.
3495
- *
3823
+ * @abort_channel_switch: This is an optional callback that is called
3824
+ * when channel switch procedure was completed, allowing the
3825
+ * driver to go back to a normal configuration.
3826
+ * @channel_switch_rx_beacon: This is an optional callback that is called
3827
+ * when channel switch procedure is in progress and additional beacon with
3828
+ * CSA IE was received, allowing driver to track changes in count.
34963829 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
34973830 * information in bss_conf is set up and the beacon can be retrieved. A
34983831 * channel context is bound before this is called.
....@@ -3542,6 +3875,22 @@
35423875 * @del_nan_func: Remove a NAN function. The driver must call
35433876 * ieee80211_nan_func_terminated() with
35443877 * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
3878
+ * @can_aggregate_in_amsdu: Called in order to determine if HW supports
3879
+ * aggregating two specific frames in the same A-MSDU. The relation
3880
+ * between the skbs should be symmetric and transitive. Note that while
3881
+ * skb is always a real frame, head may or may not be an A-MSDU.
3882
+ * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3883
+ * Statistics should be cumulative, currently no way to reset is provided.
3884
+ *
3885
+ * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
3886
+ * @abort_pmsr: abort peer measurement (this call can sleep)
3887
+ * @set_tid_config: Apply TID specific configurations. This callback may sleep.
3888
+ * @reset_tid_config: Reset TID specific configuration for the peer.
3889
+ * This callback may sleep.
3890
+ * @update_vif_offload: Update virtual interface offload flags
3891
+ * This callback may sleep.
3892
+ * @sta_set_4addr: Called to notify the driver when a station starts/stops using
3893
+ * 4-address mode
35453894 */
35463895 struct ieee80211_ops {
35473896 void (*tx)(struct ieee80211_hw *hw,
....@@ -3629,6 +3978,9 @@
36293978 #endif
36303979 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
36313980 enum sta_notify_cmd, struct ieee80211_sta *sta);
3981
+ int (*sta_set_txpwr)(struct ieee80211_hw *hw,
3982
+ struct ieee80211_vif *vif,
3983
+ struct ieee80211_sta *sta);
36323984 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
36333985 struct ieee80211_sta *sta,
36343986 enum ieee80211_sta_state old_state,
....@@ -3683,7 +4035,10 @@
36834035 *
36844036 * Even ``189`` would be wrong since 1 could be lost again.
36854037 *
3686
- * Returns a negative error code on failure.
4038
+ * Returns a negative error code on failure. The driver may return
4039
+ * %IEEE80211_AMPDU_TX_START_IMMEDIATE for %IEEE80211_AMPDU_TX_START
4040
+ * if the session can start immediately.
4041
+ *
36874042 * The callback can sleep.
36884043 */
36894044 int (*ampdu_action)(struct ieee80211_hw *hw,
....@@ -3693,11 +4048,13 @@
36934048 struct survey_info *survey);
36944049 void (*rfkill_poll)(struct ieee80211_hw *hw);
36954050 void (*set_coverage_class)(struct ieee80211_hw *hw, s16 coverage_class);
4051
+#ifdef CONFIG_NL80211_TESTMODE
36964052 int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
36974053 void *data, int len);
36984054 int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb,
36994055 struct netlink_callback *cb,
37004056 void *data, int len);
4057
+#endif
37014058 void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
37024059 u32 queues, bool drop);
37034060 void (*channel_switch)(struct ieee80211_hw *hw,
....@@ -3711,7 +4068,8 @@
37114068 struct ieee80211_channel *chan,
37124069 int duration,
37134070 enum ieee80211_roc_type type);
3714
- int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
4071
+ int (*cancel_remain_on_channel)(struct ieee80211_hw *hw,
4072
+ struct ieee80211_vif *vif);
37154073 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
37164074 void (*get_ringparam)(struct ieee80211_hw *hw,
37174075 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
....@@ -3784,6 +4142,11 @@
37844142
37854143 int (*post_channel_switch)(struct ieee80211_hw *hw,
37864144 struct ieee80211_vif *vif);
4145
+ void (*abort_channel_switch)(struct ieee80211_hw *hw,
4146
+ struct ieee80211_vif *vif);
4147
+ void (*channel_switch_rx_beacon)(struct ieee80211_hw *hw,
4148
+ struct ieee80211_vif *vif,
4149
+ struct ieee80211_channel_switch *ch_switch);
37874150
37884151 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
37894152 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
....@@ -3822,6 +4185,32 @@
38224185 void (*del_nan_func)(struct ieee80211_hw *hw,
38234186 struct ieee80211_vif *vif,
38244187 u8 instance_id);
4188
+ bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw,
4189
+ struct sk_buff *head,
4190
+ struct sk_buff *skb);
4191
+ int (*get_ftm_responder_stats)(struct ieee80211_hw *hw,
4192
+ struct ieee80211_vif *vif,
4193
+ struct cfg80211_ftm_responder_stats *ftm_stats);
4194
+ int (*start_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4195
+ struct cfg80211_pmsr_request *request);
4196
+ void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4197
+ struct cfg80211_pmsr_request *request);
4198
+ int (*set_tid_config)(struct ieee80211_hw *hw,
4199
+ struct ieee80211_vif *vif,
4200
+ struct ieee80211_sta *sta,
4201
+ struct cfg80211_tid_config *tid_conf);
4202
+ int (*reset_tid_config)(struct ieee80211_hw *hw,
4203
+ struct ieee80211_vif *vif,
4204
+ struct ieee80211_sta *sta, u8 tids);
4205
+ void (*update_vif_offload)(struct ieee80211_hw *hw,
4206
+ struct ieee80211_vif *vif);
4207
+ void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4208
+ struct ieee80211_sta *sta, bool enabled);
4209
+
4210
+ ANDROID_KABI_RESERVE(1);
4211
+ ANDROID_KABI_RESERVE(2);
4212
+ ANDROID_KABI_RESERVE(3);
4213
+ ANDROID_KABI_RESERVE(4);
38254214 };
38264215
38274216 /**
....@@ -4058,6 +4447,31 @@
40584447 void ieee80211_restart_hw(struct ieee80211_hw *hw);
40594448
40604449 /**
4450
+ * ieee80211_rx_list - receive frame and store processed skbs in a list
4451
+ *
4452
+ * Use this function to hand received frames to mac80211. The receive
4453
+ * buffer in @skb must start with an IEEE 802.11 header. In case of a
4454
+ * paged @skb is used, the driver is recommended to put the ieee80211
4455
+ * header of the frame on the linear part of the @skb to avoid memory
4456
+ * allocation and/or memcpy by the stack.
4457
+ *
4458
+ * This function may not be called in IRQ context. Calls to this function
4459
+ * for a single hardware must be synchronized against each other. Calls to
4460
+ * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
4461
+ * mixed for a single hardware. Must not run concurrently with
4462
+ * ieee80211_tx_status() or ieee80211_tx_status_ni().
4463
+ *
4464
+ * This function must be called with BHs disabled and RCU read lock
4465
+ *
4466
+ * @hw: the hardware this frame came in on
4467
+ * @sta: the station the frame was received from, or %NULL
4468
+ * @skb: the buffer to receive, owned by mac80211 after this call
4469
+ * @list: the destination list
4470
+ */
4471
+void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
4472
+ struct sk_buff *skb, struct list_head *list);
4473
+
4474
+/**
40614475 * ieee80211_rx_napi - receive frame from NAPI context
40624476 *
40634477 * Use this function to hand received frames to mac80211. The receive
....@@ -4291,6 +4705,21 @@
42914705 u32 thr);
42924706
42934707 /**
4708
+ * ieee80211_tx_rate_update - transmit rate update callback
4709
+ *
4710
+ * Drivers should call this functions with a non-NULL pub sta
4711
+ * This function can be used in drivers that does not have provision
4712
+ * in updating the tx rate in data path.
4713
+ *
4714
+ * @hw: the hardware the frame was transmitted by
4715
+ * @pubsta: the station to update the tx rate for.
4716
+ * @info: tx status information
4717
+ */
4718
+void ieee80211_tx_rate_update(struct ieee80211_hw *hw,
4719
+ struct ieee80211_sta *pubsta,
4720
+ struct ieee80211_tx_info *info);
4721
+
4722
+/**
42944723 * ieee80211_tx_status - transmit status callback
42954724 *
42964725 * Call this function for all transmitted frames after they have been
....@@ -4390,6 +4819,26 @@
43904819 struct sk_buff *skb);
43914820
43924821 /**
4822
+ * ieee80211_tx_status_8023 - transmit status callback for 802.3 frame format
4823
+ *
4824
+ * Call this function for all transmitted data frames after their transmit
4825
+ * completion. This callback should only be called for data frames which
4826
+ * are using driver's (or hardware's) offload capability of encap/decap
4827
+ * 802.11 frames.
4828
+ *
4829
+ * This function may not be called in IRQ context. Calls to this function
4830
+ * for a single hardware must be synchronized against each other and all
4831
+ * calls in the same tx status family.
4832
+ *
4833
+ * @hw: the hardware the frame was transmitted by
4834
+ * @vif: the interface for which the frame was transmitted
4835
+ * @skb: the frame that was transmitted, owned by mac80211 after this call
4836
+ */
4837
+void ieee80211_tx_status_8023(struct ieee80211_hw *hw,
4838
+ struct ieee80211_vif *vif,
4839
+ struct sk_buff *skb);
4840
+
4841
+/**
43934842 * ieee80211_report_low_ack - report non-responding station
43944843 *
43954844 * When operating in AP-mode, call this function to report a non-responding
....@@ -4400,21 +4849,21 @@
44004849 */
44014850 void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
44024851
4403
-#define IEEE80211_MAX_CSA_COUNTERS_NUM 2
4852
+#define IEEE80211_MAX_CNTDWN_COUNTERS_NUM 2
44044853
44054854 /**
44064855 * struct ieee80211_mutable_offsets - mutable beacon offsets
44074856 * @tim_offset: position of TIM element
44084857 * @tim_length: size of TIM element
4409
- * @csa_counter_offs: array of IEEE80211_MAX_CSA_COUNTERS_NUM offsets
4410
- * to CSA counters. This array can contain zero values which
4858
+ * @cntdwn_counter_offs: array of IEEE80211_MAX_CNTDWN_COUNTERS_NUM offsets
4859
+ * to countdown counters. This array can contain zero values which
44114860 * should be ignored.
44124861 */
44134862 struct ieee80211_mutable_offsets {
44144863 u16 tim_offset;
44154864 u16 tim_length;
44164865
4417
- u16 csa_counter_offs[IEEE80211_MAX_CSA_COUNTERS_NUM];
4866
+ u16 cntdwn_counter_offs[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
44184867 };
44194868
44204869 /**
....@@ -4483,31 +4932,31 @@
44834932 }
44844933
44854934 /**
4486
- * ieee80211_csa_update_counter - request mac80211 to decrement the csa counter
4935
+ * ieee80211_beacon_update_cntdwn - request mac80211 to decrement the beacon countdown
44874936 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
44884937 *
4489
- * The csa counter should be updated after each beacon transmission.
4938
+ * The beacon counter should be updated after each beacon transmission.
44904939 * This function is called implicitly when
44914940 * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the
44924941 * beacon frames are generated by the device, the driver should call this
4493
- * function after each beacon transmission to sync mac80211's csa counters.
4942
+ * function after each beacon transmission to sync mac80211's beacon countdown.
44944943 *
4495
- * Return: new csa counter value
4944
+ * Return: new countdown value
44964945 */
4497
-u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif);
4946
+u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif);
44984947
44994948 /**
4500
- * ieee80211_csa_set_counter - request mac80211 to set csa counter
4949
+ * ieee80211_beacon_set_cntdwn - request mac80211 to set beacon countdown
45014950 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
45024951 * @counter: the new value for the counter
45034952 *
4504
- * The csa counter can be changed by the device, this API should be
4953
+ * The beacon countdown can be changed by the device, this API should be
45054954 * used by the device driver to update csa counter in mac80211.
45064955 *
4507
- * It should never be used together with ieee80211_csa_update_counter(),
4956
+ * It should never be used together with ieee80211_beacon_update_cntdwn(),
45084957 * as it will cause a race condition around the counter value.
45094958 */
4510
-void ieee80211_csa_set_counter(struct ieee80211_vif *vif, u8 counter);
4959
+void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter);
45114960
45124961 /**
45134962 * ieee80211_csa_finish - notify mac80211 about channel switch
....@@ -4520,13 +4969,12 @@
45204969 void ieee80211_csa_finish(struct ieee80211_vif *vif);
45214970
45224971 /**
4523
- * ieee80211_csa_is_complete - find out if counters reached 1
4972
+ * ieee80211_beacon_cntdwn_is_complete - find out if countdown reached 1
45244973 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
45254974 *
4526
- * This function returns whether the channel switch counters reached zero.
4975
+ * This function returns whether the countdown reached zero.
45274976 */
4528
-bool ieee80211_csa_is_complete(struct ieee80211_vif *vif);
4529
-
4977
+bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif);
45304978
45314979 /**
45324980 * ieee80211_proberesp_get - retrieve a Probe Response template
....@@ -4981,11 +5429,15 @@
49815429 * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
49825430 * interfaces, even if they haven't been re-added to the driver yet.
49835431 * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up).
5432
+ * @IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER: Skip any interfaces where SDATA
5433
+ * is not in the driver. This may fix crashes during firmware recovery
5434
+ * for instance.
49845435 */
49855436 enum ieee80211_interface_iteration_flags {
49865437 IEEE80211_IFACE_ITER_NORMAL = 0,
49875438 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0),
49885439 IEEE80211_IFACE_ITER_ACTIVE = BIT(1),
5440
+ IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2),
49895441 };
49905442
49915443 /**
....@@ -5283,6 +5735,46 @@
52835735 void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
52845736
52855737 /**
5738
+ * ieee80211_sta_register_airtime - register airtime usage for a sta/tid
5739
+ *
5740
+ * Register airtime usage for a given sta on a given tid. The driver must call
5741
+ * this function to notify mac80211 that a station used a certain amount of
5742
+ * airtime. This information will be used by the TXQ scheduler to schedule
5743
+ * stations in a way that ensures airtime fairness.
5744
+ *
5745
+ * The reported airtime should as a minimum include all time that is spent
5746
+ * transmitting to the remote station, including overhead and padding, but not
5747
+ * including time spent waiting for a TXOP. If the time is not reported by the
5748
+ * hardware it can in some cases be calculated from the rate and known frame
5749
+ * composition. When possible, the time should include any failed transmission
5750
+ * attempts.
5751
+ *
5752
+ * The driver can either call this function synchronously for every packet or
5753
+ * aggregate, or asynchronously as airtime usage information becomes available.
5754
+ * TX and RX airtime can be reported together, or separately by setting one of
5755
+ * them to 0.
5756
+ *
5757
+ * @pubsta: the station
5758
+ * @tid: the TID to register airtime for
5759
+ * @tx_airtime: airtime used during TX (in usec)
5760
+ * @rx_airtime: airtime used during RX (in usec)
5761
+ */
5762
+void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
5763
+ u32 tx_airtime, u32 rx_airtime);
5764
+
5765
+/**
5766
+ * ieee80211_txq_airtime_check - check if a txq can send frame to device
5767
+ *
5768
+ * @hw: pointer obtained from ieee80211_alloc_hw()
5769
+ * @txq: pointer obtained from station or virtual interface
5770
+ *
5771
+ * Return true if the AQL's airtime limit has not been reached and the txq can
5772
+ * continue to send more packets to the device. Otherwise return false.
5773
+ */
5774
+bool
5775
+ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
5776
+
5777
+/**
52865778 * ieee80211_iter_keys - iterate keys programmed into the device
52875779 * @hw: pointer obtained from ieee80211_alloc_hw()
52885780 * @vif: virtual interface to iterate, may be %NULL for all
....@@ -5335,7 +5827,7 @@
53355827
53365828 /**
53375829 * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
5338
- * @hw: pointre obtained from ieee80211_alloc_hw().
5830
+ * @hw: pointer obtained from ieee80211_alloc_hw().
53395831 * @iter: iterator function
53405832 * @iter_data: data passed to iterator function
53415833 *
....@@ -5642,9 +6134,26 @@
56426134 bool bss;
56436135 };
56446136
6137
+/**
6138
+ * enum rate_control_capabilities - rate control capabilities
6139
+ */
6140
+enum rate_control_capabilities {
6141
+ /**
6142
+ * @RATE_CTRL_CAPA_VHT_EXT_NSS_BW:
6143
+ * Support for extended NSS BW support (dot11VHTExtendedNSSCapable)
6144
+ * Note that this is only looked at if the minimum number of chains
6145
+ * that the AP uses is < the number of TX chains the hardware has,
6146
+ * otherwise the NSS difference doesn't bother us.
6147
+ */
6148
+ RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0),
6149
+};
6150
+
56456151 struct rate_control_ops {
6152
+ unsigned long capa;
56466153 const char *name;
5647
- void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
6154
+ void *(*alloc)(struct ieee80211_hw *hw);
6155
+ void (*add_debugfs)(struct ieee80211_hw *hw, void *priv,
6156
+ struct dentry *debugfsdir);
56486157 void (*free)(void *priv);
56496158
56506159 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
....@@ -5669,9 +6178,13 @@
56696178
56706179 void (*add_sta_debugfs)(void *priv, void *priv_sta,
56716180 struct dentry *dir);
5672
- void (*remove_sta_debugfs)(void *priv, void *priv_sta);
56736181
56746182 u32 (*get_expected_throughput)(void *priv_sta);
6183
+
6184
+ ANDROID_KABI_RESERVE(1);
6185
+ ANDROID_KABI_RESERVE(2);
6186
+ ANDROID_KABI_RESERVE(3);
6187
+ ANDROID_KABI_RESERVE(4);
56756188 };
56766189
56776190 static inline int rate_supported(struct ieee80211_sta *sta,
....@@ -5680,29 +6193,6 @@
56806193 {
56816194 return (sta == NULL || sta->supp_rates[band] & BIT(index));
56826195 }
5683
-
5684
-/**
5685
- * rate_control_send_low - helper for drivers for management/no-ack frames
5686
- *
5687
- * Rate control algorithms that agree to use the lowest rate to
5688
- * send management frames and NO_ACK data with the respective hw
5689
- * retries should use this in the beginning of their mac80211 get_rate
5690
- * callback. If true is returned the rate control can simply return.
5691
- * If false is returned we guarantee that sta and sta and priv_sta is
5692
- * not null.
5693
- *
5694
- * Rate control algorithms wishing to do more intelligent selection of
5695
- * rate for multicast/broadcast frames may choose to not use this.
5696
- *
5697
- * @sta: &struct ieee80211_sta pointer to the target destination. Note
5698
- * that this may be null.
5699
- * @priv_sta: private rate control structure. This may be null.
5700
- * @txrc: rate control information we sholud populate for mac80211.
5701
- */
5702
-bool rate_control_send_low(struct ieee80211_sta *sta,
5703
- void *priv_sta,
5704
- struct ieee80211_tx_rate_control *txrc);
5705
-
57066196
57076197 static inline s8
57086198 rate_lowest_index(struct ieee80211_supported_band *sband,
....@@ -5868,6 +6358,20 @@
58686358 int band, struct ieee80211_sta **sta);
58696359
58706360 /**
6361
+ * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
6362
+ * of injected frames.
6363
+ *
6364
+ * To accurately parse and take into account rate and retransmission fields,
6365
+ * you must initialize the chandef field in the ieee80211_tx_info structure
6366
+ * of the skb before calling this function.
6367
+ *
6368
+ * @skb: packet injected by userspace
6369
+ * @dev: the &struct device of this 802.11 device
6370
+ */
6371
+bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
6372
+ struct net_device *dev);
6373
+
6374
+/**
58716375 * struct ieee80211_noa_data - holds temporary data for tracking P2P NoA state
58726376 *
58736377 * @next_tsf: TSF timestamp of the next absent state change
....@@ -5915,7 +6419,7 @@
59156419 void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
59166420
59176421 /**
5918
- * ieee80211_tdls_oper - request userspace to perform a TDLS operation
6422
+ * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
59196423 * @vif: virtual interface
59206424 * @peer: the peer's destination address
59216425 * @oper: the requested TDLS operation
....@@ -5969,12 +6473,140 @@
59696473 * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
59706474 *
59716475 * @hw: pointer as obtained from ieee80211_alloc_hw()
5972
- * @txq: pointer obtained from station or virtual interface
6476
+ * @txq: pointer obtained from station or virtual interface, or from
6477
+ * ieee80211_next_txq()
59736478 *
59746479 * Returns the skb if successful, %NULL if no frame was available.
6480
+ *
6481
+ * Note that this must be called in an rcu_read_lock() critical section,
6482
+ * which can only be released after the SKB was handled. Some pointers in
6483
+ * skb->cb, e.g. the key pointer, are protected by RCU and thus the
6484
+ * critical section must persist not just for the duration of this call
6485
+ * but for the duration of the frame handling.
6486
+ * However, also note that while in the wake_tx_queue() method,
6487
+ * rcu_read_lock() is already held.
6488
+ *
6489
+ * softirqs must also be disabled when this function is called.
6490
+ * In process context, use ieee80211_tx_dequeue_ni() instead.
59756491 */
59766492 struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
59776493 struct ieee80211_txq *txq);
6494
+
6495
+/**
6496
+ * ieee80211_tx_dequeue_ni - dequeue a packet from a software tx queue
6497
+ * (in process context)
6498
+ *
6499
+ * Like ieee80211_tx_dequeue() but can be called in process context
6500
+ * (internally disables bottom halves).
6501
+ *
6502
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6503
+ * @txq: pointer obtained from station or virtual interface, or from
6504
+ * ieee80211_next_txq()
6505
+ */
6506
+static inline struct sk_buff *ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw,
6507
+ struct ieee80211_txq *txq)
6508
+{
6509
+ struct sk_buff *skb;
6510
+
6511
+ local_bh_disable();
6512
+ skb = ieee80211_tx_dequeue(hw, txq);
6513
+ local_bh_enable();
6514
+
6515
+ return skb;
6516
+}
6517
+
6518
+/**
6519
+ * ieee80211_next_txq - get next tx queue to pull packets from
6520
+ *
6521
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6522
+ * @ac: AC number to return packets from.
6523
+ *
6524
+ * Returns the next txq if successful, %NULL if no queue is eligible. If a txq
6525
+ * is returned, it should be returned with ieee80211_return_txq() after the
6526
+ * driver has finished scheduling it.
6527
+ */
6528
+struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
6529
+
6530
+/**
6531
+ * ieee80211_txq_schedule_start - start new scheduling round for TXQs
6532
+ *
6533
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6534
+ * @ac: AC number to acquire locks for
6535
+ *
6536
+ * Should be called before ieee80211_next_txq() or ieee80211_return_txq().
6537
+ * The driver must not call multiple TXQ scheduling rounds concurrently.
6538
+ */
6539
+void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac);
6540
+
6541
+/* (deprecated) */
6542
+static inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
6543
+{
6544
+}
6545
+
6546
+void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
6547
+ struct ieee80211_txq *txq, bool force);
6548
+
6549
+/**
6550
+ * ieee80211_schedule_txq - schedule a TXQ for transmission
6551
+ *
6552
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6553
+ * @txq: pointer obtained from station or virtual interface
6554
+ *
6555
+ * Schedules a TXQ for transmission if it is not already scheduled,
6556
+ * even if mac80211 does not have any packets buffered.
6557
+ *
6558
+ * The driver may call this function if it has buffered packets for
6559
+ * this TXQ internally.
6560
+ */
6561
+static inline void
6562
+ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
6563
+{
6564
+ __ieee80211_schedule_txq(hw, txq, true);
6565
+}
6566
+
6567
+/**
6568
+ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
6569
+ *
6570
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6571
+ * @txq: pointer obtained from station or virtual interface
6572
+ * @force: schedule txq even if mac80211 does not have any buffered packets.
6573
+ *
6574
+ * The driver may set force=true if it has buffered packets for this TXQ
6575
+ * internally.
6576
+ */
6577
+static inline void
6578
+ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
6579
+ bool force)
6580
+{
6581
+ __ieee80211_schedule_txq(hw, txq, force);
6582
+}
6583
+
6584
+/**
6585
+ * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
6586
+ *
6587
+ * This function is used to check whether given txq is allowed to transmit by
6588
+ * the airtime scheduler, and can be used by drivers to access the airtime
6589
+ * fairness accounting without going using the scheduling order enfored by
6590
+ * next_txq().
6591
+ *
6592
+ * Returns %true if the airtime scheduler thinks the TXQ should be allowed to
6593
+ * transmit, and %false if it should be throttled. This function can also have
6594
+ * the side effect of rotating the TXQ in the scheduler rotation, which will
6595
+ * eventually bring the deficit to positive and allow the station to transmit
6596
+ * again.
6597
+ *
6598
+ * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
6599
+ * aligned against driver's own round-robin scheduler list. i.e it rotates
6600
+ * the TXQ list till it makes the requested node becomes the first entry
6601
+ * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this
6602
+ * function returns %true, the driver is expected to schedule packets
6603
+ * for transmission, and then return the TXQ through ieee80211_return_txq().
6604
+ *
6605
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6606
+ * @txq: pointer obtained from station or virtual interface
6607
+ */
6608
+bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
6609
+ struct ieee80211_txq *txq);
59786610
59796611 /**
59806612 * ieee80211_txq_get_depth - get pending frame/byte count of given txq
....@@ -6022,4 +6654,69 @@
60226654 struct cfg80211_nan_match_params *match,
60236655 gfp_t gfp);
60246656
6657
+/**
6658
+ * ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
6659
+ *
6660
+ * This function calculates the estimated airtime usage of a frame based on the
6661
+ * rate information in the RX status struct and the frame length.
6662
+ *
6663
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6664
+ * @status: &struct ieee80211_rx_status containing the transmission rate
6665
+ * information.
6666
+ * @len: frame length in bytes
6667
+ */
6668
+u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
6669
+ struct ieee80211_rx_status *status,
6670
+ int len);
6671
+
6672
+/**
6673
+ * ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
6674
+ *
6675
+ * This function calculates the estimated airtime usage of a frame based on the
6676
+ * rate information in the TX info struct and the frame length.
6677
+ *
6678
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
6679
+ * @info: &struct ieee80211_tx_info of the frame.
6680
+ * @len: frame length in bytes
6681
+ */
6682
+u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
6683
+ struct ieee80211_tx_info *info,
6684
+ int len);
6685
+/**
6686
+ * ieee80211_set_hw_80211_encap - enable hardware encapsulation offloading.
6687
+ *
6688
+ * This function is used to notify mac80211 that a vif can be passed raw 802.3
6689
+ * frames. The driver needs to then handle the 802.11 encapsulation inside the
6690
+ * hardware or firmware.
6691
+ *
6692
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6693
+ * @enable: indicate if the feature should be turned on or off
6694
+ */
6695
+bool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable);
6696
+
6697
+/**
6698
+ * ieee80211_get_fils_discovery_tmpl - Get FILS discovery template.
6699
+ * @hw: pointer obtained from ieee80211_alloc_hw().
6700
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6701
+ *
6702
+ * The driver is responsible for freeing the returned skb.
6703
+ *
6704
+ * Return: FILS discovery template. %NULL on error.
6705
+ */
6706
+struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
6707
+ struct ieee80211_vif *vif);
6708
+
6709
+/**
6710
+ * ieee80211_get_unsol_bcast_probe_resp_tmpl - Get unsolicited broadcast
6711
+ * probe response template.
6712
+ * @hw: pointer obtained from ieee80211_alloc_hw().
6713
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6714
+ *
6715
+ * The driver is responsible for freeing the returned skb.
6716
+ *
6717
+ * Return: Unsolicited broadcast probe response template. %NULL on error.
6718
+ */
6719
+struct sk_buff *
6720
+ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
6721
+ struct ieee80211_vif *vif);
60256722 #endif /* MAC80211_H */