Skip to content

Commit 41cbb0f

Browse files
lucacoelhojmberg-intel
authored andcommitted
mac80211: add support for HE
Add support for HE in mac80211 conforming with P802.11ax_D1.4. Johannes: Fix another bug with the buf_size comparison in agg-rx.c. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Ido Yariv <idox.yariv@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent b8042b3 commit 41cbb0f

14 files changed

Lines changed: 716 additions & 45 deletions

File tree

‎include/net/mac80211.h‎

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/ieee80211.h>
2424
#include <net/cfg80211.h>
2525
#include <net/codel.h>
26+
#include <net/ieee80211_radiotap.h>
2627
#include <asm/unaligned.h>
2728

2829
/**
@@ -162,6 +163,8 @@ enum ieee80211_ac_numbers {
162163
* @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
163164
* @acm: is mandatory admission control required for the access category
164165
* @uapsd: is U-APSD mode enabled for the queue
166+
* @mu_edca: is the MU EDCA configured
167+
* @mu_edca_param_rec: MU EDCA Parameter Record for HE
165168
*/
166169
struct ieee80211_tx_queue_params {
167170
u16 txop;
@@ -170,6 +173,8 @@ struct ieee80211_tx_queue_params {
170173
u8 aifs;
171174
bool acm;
172175
bool uapsd;
176+
bool mu_edca;
177+
struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;
173178
};
174179

175180
struct ieee80211_low_level_stats {
@@ -463,6 +468,15 @@ struct ieee80211_mu_group_data {
463468
* This structure keeps information about a BSS (and an association
464469
* to that BSS) that can change during the lifetime of the BSS.
465470
*
471+
* @bss_color: 6-bit value to mark inter-BSS frame, if BSS supports HE
472+
* @htc_trig_based_pkt_ext: default PE in 4us units, if BSS supports HE
473+
* @multi_sta_back_32bit: supports BA bitmap of 32-bits in Multi-STA BACK
474+
* @uora_exists: is the UORA element advertised by AP
475+
* @ack_enabled: indicates support to receive a multi-TID that solicits either
476+
* ACK, BACK or both
477+
* @uora_ocw_range: UORA element's OCW Range field
478+
* @frame_time_rts_th: HE duration RTS threshold, in units of 32us
479+
* @he_support: does this BSS support HE
466480
* @assoc: association status
467481
* @ibss_joined: indicates whether this station is part of an IBSS
468482
* or not
@@ -550,6 +564,14 @@ struct ieee80211_mu_group_data {
550564
*/
551565
struct ieee80211_bss_conf {
552566
const u8 *bssid;
567+
u8 bss_color;
568+
u8 htc_trig_based_pkt_ext;
569+
bool multi_sta_back_32bit;
570+
bool uora_exists;
571+
bool ack_enabled;
572+
u8 uora_ocw_range;
573+
u16 frame_time_rts_th;
574+
bool he_support;
553575
/* association related data */
554576
bool assoc, ibss_joined;
555577
bool ibss_creator;
@@ -1106,6 +1128,18 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
11061128
* @RX_FLAG_AMPDU_EOF_BIT: Value of the EOF bit in the A-MPDU delimiter for this
11071129
* frame
11081130
* @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known
1131+
* @RX_FLAG_RADIOTAP_HE: HE radiotap data is present
1132+
* (&struct ieee80211_radiotap_he, mac80211 will fill in
1133+
* - DATA3_DATA_MCS
1134+
* - DATA3_DATA_DCM
1135+
* - DATA3_CODING
1136+
* - DATA5_GI
1137+
* - DATA5_DATA_BW_RU_ALLOC
1138+
* - DATA6_NSTS
1139+
* - DATA3_STBC
1140+
* from the RX info data, so leave those zeroed when building this data)
1141+
* @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
1142+
* (&struct ieee80211_radiotap_he_mu)
11091143
*/
11101144
enum mac80211_rx_flags {
11111145
RX_FLAG_MMIC_ERROR = BIT(0),
@@ -1134,6 +1168,8 @@ enum mac80211_rx_flags {
11341168
RX_FLAG_ICV_STRIPPED = BIT(23),
11351169
RX_FLAG_AMPDU_EOF_BIT = BIT(24),
11361170
RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(25),
1171+
RX_FLAG_RADIOTAP_HE = BIT(26),
1172+
RX_FLAG_RADIOTAP_HE_MU = BIT(27),
11371173
};
11381174

11391175
/**
@@ -1164,6 +1200,7 @@ enum mac80211_rx_encoding {
11641200
RX_ENC_LEGACY = 0,
11651201
RX_ENC_HT,
11661202
RX_ENC_VHT,
1203+
RX_ENC_HE,
11671204
};
11681205

11691206
/**
@@ -1198,6 +1235,9 @@ enum mac80211_rx_encoding {
11981235
* @encoding: &enum mac80211_rx_encoding
11991236
* @bw: &enum rate_info_bw
12001237
* @enc_flags: uses bits from &enum mac80211_rx_encoding_flags
1238+
* @he_ru: HE RU, from &enum nl80211_he_ru_alloc
1239+
* @he_gi: HE GI, from &enum nl80211_he_gi
1240+
* @he_dcm: HE DCM value
12011241
* @rx_flags: internal RX flags for mac80211
12021242
* @ampdu_reference: A-MPDU reference number, must be a different value for
12031243
* each A-MPDU but the same for each subframe within one A-MPDU
@@ -1211,7 +1251,8 @@ struct ieee80211_rx_status {
12111251
u32 flag;
12121252
u16 freq;
12131253
u8 enc_flags;
1214-
u8 encoding:2, bw:3;
1254+
u8 encoding:2, bw:3, he_ru:3;
1255+
u8 he_gi:2, he_dcm:1;
12151256
u8 rate_idx;
12161257
u8 nss;
12171258
u8 rx_flags;
@@ -1770,6 +1811,7 @@ struct ieee80211_sta_rates {
17701811
* @supp_rates: Bitmap of supported rates (per band)
17711812
* @ht_cap: HT capabilities of this STA; restricted to our own capabilities
17721813
* @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
1814+
* @he_cap: HE capabilities of this STA
17731815
* @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU
17741816
* that this station is allowed to transmit to us.
17751817
* Can be modified by driver.
@@ -1805,7 +1847,8 @@ struct ieee80211_sta {
18051847
u16 aid;
18061848
struct ieee80211_sta_ht_cap ht_cap;
18071849
struct ieee80211_sta_vht_cap vht_cap;
1808-
u8 max_rx_aggregation_subframes;
1850+
struct ieee80211_sta_he_cap he_cap;
1851+
u16 max_rx_aggregation_subframes;
18091852
bool wme;
18101853
u8 uapsd_queues;
18111854
u8 max_sp;
@@ -2196,10 +2239,11 @@ enum ieee80211_hw_flags {
21962239
* it shouldn't be set.
21972240
*
21982241
* @max_tx_aggregation_subframes: maximum number of subframes in an
2199-
* aggregate an HT driver will transmit. Though ADDBA will advertise
2200-
* a constant value of 64 as some older APs can crash if the window
2201-
* size is smaller (an example is LinkSys WRT120N with FW v1.0.07
2202-
* build 002 Jun 18 2012).
2242+
* aggregate an HT/HE device will transmit. In HT AddBA we'll
2243+
* advertise a constant value of 64 as some older APs crash if
2244+
* the window size is smaller (an example is LinkSys WRT120N
2245+
* with FW v1.0.07 build 002 Jun 18 2012).
2246+
* For AddBA to HE capable peers this value will be used.
22032247
*
22042248
* @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
22052249
* of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
@@ -2216,6 +2260,8 @@ enum ieee80211_hw_flags {
22162260
* the default is _GI | _BANDWIDTH.
22172261
* Use the %IEEE80211_RADIOTAP_VHT_KNOWN_\* values.
22182262
*
2263+
* @radiotap_he: HE radiotap validity flags
2264+
*
22192265
* @radiotap_timestamp: Information for the radiotap timestamp field; if the
22202266
* 'units_pos' member is set to a non-negative value it must be set to
22212267
* a combination of a IEEE80211_RADIOTAP_TIMESTAMP_UNIT_* and a
@@ -2263,8 +2309,8 @@ struct ieee80211_hw {
22632309
u8 max_rates;
22642310
u8 max_report_rates;
22652311
u8 max_rate_tries;
2266-
u8 max_rx_aggregation_subframes;
2267-
u8 max_tx_aggregation_subframes;
2312+
u16 max_rx_aggregation_subframes;
2313+
u16 max_tx_aggregation_subframes;
22682314
u8 max_tx_fragments;
22692315
u8 offchannel_tx_hw_queue;
22702316
u8 radiotap_mcs_details;
@@ -2904,7 +2950,7 @@ struct ieee80211_ampdu_params {
29042950
struct ieee80211_sta *sta;
29052951
u16 tid;
29062952
u16 ssn;
2907-
u8 buf_size;
2953+
u16 buf_size;
29082954
bool amsdu;
29092955
u16 timeout;
29102956
};

‎net/mac80211/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mac80211-y := \
1212
scan.o offchannel.o \
1313
ht.o agg-tx.o agg-rx.o \
1414
vht.o \
15+
he.o \
1516
ibss.o \
1617
iface.o \
1718
rate.o \

‎net/mac80211/agg-rx.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
245245
};
246246
int i, ret = -EOPNOTSUPP;
247247
u16 status = WLAN_STATUS_REQUEST_DECLINED;
248+
u16 max_buf_size;
248249

249250
if (tid >= IEEE80211_FIRST_TSPEC_TSID) {
250251
ht_dbg(sta->sdata,
@@ -268,13 +269,18 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
268269
goto end;
269270
}
270271

272+
if (sta->sta.he_cap.has_he)
273+
max_buf_size = IEEE80211_MAX_AMPDU_BUF;
274+
else
275+
max_buf_size = IEEE80211_MAX_AMPDU_BUF_HT;
276+
271277
/* sanity check for incoming parameters:
272278
* check if configuration can support the BA policy
273279
* and if buffer size does not exceeds max value */
274280
/* XXX: check own ht delayed BA capability?? */
275281
if (((ba_policy != 1) &&
276282
(!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) ||
277-
(buf_size > IEEE80211_MAX_AMPDU_BUF_HT)) {
283+
(buf_size > max_buf_size)) {
278284
status = WLAN_STATUS_INVALID_QOS_PARAM;
279285
ht_dbg_ratelimited(sta->sdata,
280286
"AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n",
@@ -283,7 +289,7 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
283289
}
284290
/* determine default buffer size */
285291
if (buf_size == 0)
286-
buf_size = IEEE80211_MAX_AMPDU_BUF_HT;
292+
buf_size = max_buf_size;
287293

288294
/* make sure the size doesn't exceed the maximum supported by the hw */
289295
if (buf_size > sta->sta.max_rx_aggregation_subframes)

‎net/mac80211/agg-tx.c‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
463463
.timeout = 0,
464464
};
465465
int ret;
466+
u16 buf_size;
466467

467468
tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
468469

@@ -511,11 +512,22 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
511512
sta->ampdu_mlme.addba_req_num[tid]++;
512513
spin_unlock_bh(&sta->lock);
513514

515+
if (sta->sta.he_cap.has_he) {
516+
buf_size = local->hw.max_tx_aggregation_subframes;
517+
} else {
518+
/*
519+
* We really should use what the driver told us it will
520+
* transmit as the maximum, but certain APs (e.g. the
521+
* LinkSys WRT120N with FW v1.0.07 build 002 Jun 18 2012)
522+
* will crash when we use a lower number.
523+
*/
524+
buf_size = IEEE80211_MAX_AMPDU_BUF_HT;
525+
}
526+
514527
/* send AddBA request */
515528
ieee80211_send_addba_request(sdata, sta->sta.addr, tid,
516529
tid_tx->dialog_token, params.ssn,
517-
IEEE80211_MAX_AMPDU_BUF_HT,
518-
tid_tx->timeout);
530+
buf_size, tid_tx->timeout);
519531
}
520532

521533
/*
@@ -905,8 +917,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
905917
{
906918
struct tid_ampdu_tx *tid_tx;
907919
struct ieee80211_txq *txq;
908-
u16 capab, tid;
909-
u8 buf_size;
920+
u16 capab, tid, buf_size;
910921
bool amsdu;
911922

912923
capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab);

‎net/mac80211/cfg.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,11 @@ static int sta_apply_parameters(struct ieee80211_local *local,
14121412
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
14131413
params->vht_capa, sta);
14141414

1415+
if (params->he_capa)
1416+
ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband,
1417+
(void *)params->he_capa,
1418+
params->he_capa_len, sta);
1419+
14151420
if (params->opmode_notif_used) {
14161421
/* returned value is only needed for rc update, but the
14171422
* rc isn't initialized here yet, so ignore it

‎net/mac80211/he.c‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* HE handling
3+
*
4+
* Copyright(c) 2017 Intel Deutschland GmbH
5+
*
6+
* This program is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License version 2 as
8+
* published by the Free Software Foundation.
9+
*/
10+
11+
#include "ieee80211_i.h"
12+
13+
void
14+
ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
15+
struct ieee80211_supported_band *sband,
16+
const u8 *he_cap_ie, u8 he_cap_len,
17+
struct sta_info *sta)
18+
{
19+
struct ieee80211_sta_he_cap *he_cap = &sta->sta.he_cap;
20+
struct ieee80211_he_cap_elem *he_cap_ie_elem = (void *)he_cap_ie;
21+
u8 he_ppe_size;
22+
u8 mcs_nss_size;
23+
u8 he_total_size;
24+
25+
memset(he_cap, 0, sizeof(*he_cap));
26+
27+
if (!he_cap_ie || !ieee80211_get_he_sta_cap(sband))
28+
return;
29+
30+
/* Make sure size is OK */
31+
mcs_nss_size = ieee80211_he_mcs_nss_size(he_cap_ie_elem);
32+
he_ppe_size =
33+
ieee80211_he_ppe_size(he_cap_ie[sizeof(he_cap->he_cap_elem) +
34+
mcs_nss_size],
35+
he_cap_ie_elem->phy_cap_info);
36+
he_total_size = sizeof(he_cap->he_cap_elem) + mcs_nss_size +
37+
he_ppe_size;
38+
if (he_cap_len < he_total_size)
39+
return;
40+
41+
memcpy(&he_cap->he_cap_elem, he_cap_ie, sizeof(he_cap->he_cap_elem));
42+
43+
/* HE Tx/Rx HE MCS NSS Support Field */
44+
memcpy(&he_cap->he_mcs_nss_supp,
45+
&he_cap_ie[sizeof(he_cap->he_cap_elem)], mcs_nss_size);
46+
47+
/* Check if there are (optional) PPE Thresholds */
48+
if (he_cap->he_cap_elem.phy_cap_info[6] &
49+
IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT)
50+
memcpy(he_cap->ppe_thres,
51+
&he_cap_ie[sizeof(he_cap->he_cap_elem) + mcs_nss_size],
52+
he_ppe_size);
53+
54+
he_cap->has_he = true;
55+
}

‎net/mac80211/ieee80211_i.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ enum ieee80211_sta_flags {
365365
IEEE80211_STA_DISABLE_160MHZ = BIT(13),
366366
IEEE80211_STA_DISABLE_WMM = BIT(14),
367367
IEEE80211_STA_ENABLE_RRM = BIT(15),
368+
IEEE80211_STA_DISABLE_HE = BIT(16),
368369
};
369370

370371
struct ieee80211_mgd_auth_data {
@@ -1454,6 +1455,10 @@ struct ieee802_11_elems {
14541455
const struct ieee80211_vht_cap *vht_cap_elem;
14551456
const struct ieee80211_vht_operation *vht_operation;
14561457
const struct ieee80211_meshconf_ie *mesh_config;
1458+
const u8 *he_cap;
1459+
const struct ieee80211_he_operation *he_operation;
1460+
const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
1461+
const u8 *uora_element;
14571462
const u8 *mesh_id;
14581463
const u8 *peering;
14591464
const __le16 *awake_window;
@@ -1483,6 +1488,7 @@ struct ieee802_11_elems {
14831488
u8 ext_supp_rates_len;
14841489
u8 wmm_info_len;
14851490
u8 wmm_param_len;
1491+
u8 he_cap_len;
14861492
u8 mesh_id_len;
14871493
u8 peering_len;
14881494
u8 preq_len;
@@ -1825,6 +1831,13 @@ void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
18251831
enum nl80211_chan_width
18261832
ieee80211_sta_rx_bw_to_chan_width(struct sta_info *sta);
18271833

1834+
/* HE */
1835+
void
1836+
ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
1837+
struct ieee80211_supported_band *sband,
1838+
const u8 *he_cap_ie, u8 he_cap_len,
1839+
struct sta_info *sta);
1840+
18281841
/* Spectrum management */
18291842
void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
18301843
struct ieee80211_mgmt *mgmt,
@@ -2076,6 +2089,9 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
20762089
u32 cap);
20772090
u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
20782091
const struct cfg80211_chan_def *chandef);
2092+
u8 *ieee80211_ie_build_he_cap(u8 *pos,
2093+
const struct ieee80211_sta_he_cap *he_cap,
2094+
u8 *end);
20792095
int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
20802096
const struct ieee80211_supported_band *sband,
20812097
const u8 *srates, int srates_len, u32 *rates);

0 commit comments

Comments
 (0)