From 4a37463416254712f3a45097014a93d0b521c4f8 Mon Sep 17 00:00:00 2001 From: Peng Xu Date: Fri, 29 Sep 2017 16:32:44 -0700 Subject: [PATCH] hostapd: Update HE capabilities and HE operation definition Replace vendor-specific elements for HE capabilities and HE operation elements with the P802.11ax defined element values. This version is based on P802.11ax/D1.4. Signed-off-by: Jouni Malinen --- src/ap/beacon.c | 40 ++++++++++++++++++------------------ src/ap/ieee802_11.h | 4 ++-- src/ap/ieee802_11_he.c | 33 +++++++++-------------------- src/common/ieee802_11_defs.h | 9 ++++---- 4 files changed, 37 insertions(+), 49 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index c6bbda3cc..18374f678 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -394,10 +394,10 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax) { - buflen += 4 + sizeof (struct ieee80211_he_capabilities) + - 4 + sizeof (struct ieee80211_he_operation); + buflen += 3 + sizeof(struct ieee80211_he_capabilities) + + 3 + sizeof(struct ieee80211_he_operation); } -#endif +#endif /* CONFIG_IEEE80211AX */ buflen += hostapd_mbo_ie_len(hapd); @@ -502,18 +502,18 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, pos = hostapd_eid_fils_indic(hapd, pos, 0); +#ifdef CONFIG_IEEE80211AX + if (hapd->iconf->ieee80211ax) { + pos = hostapd_eid_he_capab(hapd, pos); + pos = hostapd_eid_he_operation(hapd, pos); + } +#endif /* CONFIG_IEEE80211AX */ + #ifdef CONFIG_IEEE80211AC if (hapd->conf->vendor_vht) pos = hostapd_eid_vendor_vht(hapd, pos); #endif /* CONFIG_IEEE80211AC */ -#ifdef CONFIG_IEEE80211AX - if (hapd->iconf->ieee80211ax) { - pos = hostapd_eid_vendor_he_capab(hapd, pos); - pos = hostapd_eid_vendor_he_operation(hapd, pos); - } -#endif /* CONFIG_IEEE80211AX */ - /* Wi-Fi Alliance WMM */ pos = hostapd_eid_wmm(hapd, pos); @@ -1056,10 +1056,10 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax) { - tail_len += 4 + sizeof (struct ieee80211_he_capabilities) + - 4 + sizeof (struct ieee80211_he_operation); + tail_len += 3 + sizeof(struct ieee80211_he_capabilities) + + 3 + sizeof(struct ieee80211_he_operation); } -#endif +#endif /* CONFIG_IEEE80211AX */ tail_len += hostapd_mbo_ie_len(hapd); @@ -1187,18 +1187,18 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, tailpos = hostapd_eid_fils_indic(hapd, tailpos, 0); +#ifdef CONFIG_IEEE80211AX + if (hapd->iconf->ieee80211ax) { + tailpos = hostapd_eid_he_capab(hapd, tailpos); + tailpos = hostapd_eid_he_operation(hapd, tailpos); + } +#endif /* CONFIG_IEEE80211AX */ + #ifdef CONFIG_IEEE80211AC if (hapd->conf->vendor_vht) tailpos = hostapd_eid_vendor_vht(hapd, tailpos); #endif /* CONFIG_IEEE80211AC */ -#ifdef CONFIG_IEEE80211AX - if (hapd->iconf->ieee80211ax) { - tailpos = hostapd_eid_vendor_he_capab(hapd, tailpos); - tailpos = hostapd_eid_vendor_he_operation(hapd, tailpos); - } -#endif /* CONFIG_IEEE80211AX */ - /* Wi-Fi Alliance WMM */ tailpos = hostapd_eid_wmm(hapd, tailpos); diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 0653fb267..3b381b4e7 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -55,8 +55,8 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_vendor_vht(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid); -u8 * hostapd_eid_vendor_he_capab(struct hostapd_data *hapd, u8 *eid); -u8 * hostapd_eid_vendor_he_operation(struct hostapd_data *hapd, u8 *eid); +u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid); +u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid); int hostapd_ht_operation_update(struct hostapd_iface *iface); void ieee802_11_send_sa_query_req(struct hostapd_data *hapd, diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c index 7d6a84fcc..1a8d46972 100644 --- a/src/ap/ieee802_11_he.c +++ b/src/ap/ieee802_11_he.c @@ -10,14 +10,13 @@ #include "utils/common.h" #include "common/ieee802_11_defs.h" -#include "common/qca-vendor.h" #include "hostapd.h" #include "ap_config.h" #include "beacon.h" #include "ieee802_11.h" #include "dfs.h" -u8 * hostapd_eid_vendor_he_capab(struct hostapd_data *hapd, u8 *eid) +u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_he_capabilities *cap; u8 *pos = eid; @@ -25,17 +24,10 @@ u8 * hostapd_eid_vendor_he_capab(struct hostapd_data *hapd, u8 *eid) if (!hapd->iface->current_mode) return eid; - /* For now, use a vendor specific element since the P802.11ax draft is - * still subject to changes and the contents of this element may change. - * This can be replaced with the actual element once P802.11ax is - * finalized. */ - /* Vendor HE Capabilities element */ - *pos++ = WLAN_EID_VENDOR_SPECIFIC; - *pos++ = 4 /* The Vendor OUI, subtype */ + - sizeof(struct ieee80211_he_capabilities); + *pos++ = WLAN_EID_EXTENSION; + *pos++ = 1 + sizeof(struct ieee80211_he_capabilities); + *pos++ = WLAN_EID_EXT_HE_CAPABILITIES; - WPA_PUT_BE32(pos, (OUI_QCA << 8) | QCA_VENDOR_ELEM_HE_CAPAB); - pos += 4; cap = (struct ieee80211_he_capabilities *) pos; os_memset(cap, 0, sizeof(*cap)); @@ -57,7 +49,7 @@ u8 * hostapd_eid_vendor_he_capab(struct hostapd_data *hapd, u8 *eid) } -u8 * hostapd_eid_vendor_he_operation(struct hostapd_data *hapd, u8 *eid) +u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_he_operation *oper; u8 *pos = eid; @@ -65,17 +57,10 @@ u8 * hostapd_eid_vendor_he_operation(struct hostapd_data *hapd, u8 *eid) if (!hapd->iface->current_mode) return eid; - /* For now, use a vendor specific element since the P802.11ax draft is - * still subject to changes and the contents of this element may change. - * This can be replaced with the actual element once P802.11ax is - * finalized. */ - /* Vendor HE Operation element */ - *pos++ = WLAN_EID_VENDOR_SPECIFIC; - *pos++ = 4 /* The Vendor OUI, subtype */ + - sizeof(struct ieee80211_he_operation); + *pos++ = WLAN_EID_EXTENSION; + *pos++ = 1 + sizeof(struct ieee80211_he_operation); + *pos++ = WLAN_EID_EXT_HE_OPERATION; - WPA_PUT_BE32(pos, (OUI_QCA << 8) | QCA_VENDOR_ELEM_HE_OPER); - pos += 4; oper = (struct ieee80211_he_operation *) pos; os_memset(oper, 0, sizeof(*oper)); @@ -95,6 +80,8 @@ u8 * hostapd_eid_vendor_he_operation(struct hostapd_data *hapd, u8 *eid) (hapd->iface->conf->he_op.he_rts_threshold << HE_OPERATION_RTS_THRESHOLD_OFFSET); + /* TODO: conditional MaxBSSID Indicator subfield */ + pos += sizeof(*oper); return pos; diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index be8ebaf5e..2444c7d4e 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -463,6 +463,8 @@ #define WLAN_EID_EXT_FILS_NONCE 13 #define WLAN_EID_EXT_FUTURE_CHANNEL_GUIDANCE 14 #define WLAN_EID_EXT_OWE_DH_PARAM 32 +#define WLAN_EID_EXT_HE_CAPABILITIES 35 +#define WLAN_EID_EXT_HE_OPERATION 36 /* Action frame categories (IEEE Std 802.11-2016, 9.4.1.11, Table 9-76) */ @@ -1980,18 +1982,17 @@ enum nr_chan_width { struct ieee80211_he_capabilities { u8 he_mac_capab_info[5]; u8 he_phy_capab_info[9]; - u16 he_txrx_mcs_support; - /* possibly followed by Tx Rx MCS NSS descriptor */ - u8 variable[]; + u8 he_txrx_mcs_support[12]; /* TODO: 4, 8, or 12 octets */ /* PPE Thresholds (optional) */ } STRUCT_PACKED; struct ieee80211_he_operation { u32 he_oper_params; - u8 he_mcs_nss_set[3]; + u8 he_mcs_nss_set[2]; u8 vht_op_info_chwidth; u8 vht_op_info_chan_center_freq_seg0_idx; u8 vht_op_info_chan_center_freq_seg1_idx; + /* Followed by conditional MaxBSSID Indicator subfield (u8) */ } STRUCT_PACKED; /* HE Capabilities Information defines */