1 /* 2 * hostapd / IEEE 802.11ax HE 3 * Copyright (c) 2016-2017, Qualcomm Atheros, Inc. 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #include "utils/includes.h" 10 11 #include "utils/common.h" 12 #include "common/ieee802_11_defs.h" 13 #include "hostapd.h" 14 #include "ap_config.h" 15 #include "beacon.h" 16 #include "ieee802_11.h" 17 #include "dfs.h" 18 19 u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid) 20 { 21 struct ieee80211_he_capabilities *cap; 22 u8 *pos = eid; 23 24 if (!hapd->iface->current_mode) 25 return eid; 26 27 *pos++ = WLAN_EID_EXTENSION; 28 *pos++ = 1 + sizeof(struct ieee80211_he_capabilities); 29 *pos++ = WLAN_EID_EXT_HE_CAPABILITIES; 30 31 cap = (struct ieee80211_he_capabilities *) pos; 32 os_memset(cap, 0, sizeof(*cap)); 33 34 if (hapd->iface->conf->he_phy_capab.he_su_beamformer) 35 cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX] |= 36 HE_PHYCAP_SU_BEAMFORMER_CAPAB; 37 38 if (hapd->iface->conf->he_phy_capab.he_su_beamformee) 39 cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX] |= 40 HE_PHYCAP_SU_BEAMFORMEE_CAPAB; 41 42 if (hapd->iface->conf->he_phy_capab.he_mu_beamformer) 43 cap->he_phy_capab_info[HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX] |= 44 HE_PHYCAP_MU_BEAMFORMER_CAPAB; 45 46 pos += sizeof(*cap); 47 48 return pos; 49 } 50 51 52 u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid) 53 { 54 struct ieee80211_he_operation *oper; 55 u8 *pos = eid; 56 57 if (!hapd->iface->current_mode) 58 return eid; 59 60 *pos++ = WLAN_EID_EXTENSION; 61 *pos++ = 1 + sizeof(struct ieee80211_he_operation); 62 *pos++ = WLAN_EID_EXT_HE_OPERATION; 63 64 oper = (struct ieee80211_he_operation *) pos; 65 os_memset(oper, 0, sizeof(*oper)); 66 67 if (hapd->iface->conf->he_op.he_bss_color) 68 oper->he_oper_params |= hapd->iface->conf->he_op.he_bss_color; 69 70 if (hapd->iface->conf->he_op.he_default_pe_duration) 71 oper->he_oper_params |= 72 (hapd->iface->conf->he_op.he_default_pe_duration << 73 HE_OPERATION_DFLT_PE_DURATION_OFFSET); 74 75 if (hapd->iface->conf->he_op.he_twt_required) 76 oper->he_oper_params |= HE_OPERATION_TWT_REQUIRED; 77 78 if (hapd->iface->conf->he_op.he_rts_threshold) 79 oper->he_oper_params |= 80 (hapd->iface->conf->he_op.he_rts_threshold << 81 HE_OPERATION_RTS_THRESHOLD_OFFSET); 82 83 /* TODO: conditional MaxBSSID Indicator subfield */ 84 85 pos += sizeof(*oper); 86 87 return pos; 88 } 89