HE: Dynamically turn on TWT responder support

This allows us to dynamically turn on TWT responder support using an
nl80211 attribute.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin 2020-02-04 09:05:40 +01:00 committed by Jouni Malinen
parent 0cb39f4fd5
commit ab8c55358e
6 changed files with 34 additions and 0 deletions

View file

@ -1422,6 +1422,8 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
hapd->iface->conf->spr.srg_obss_pd_min_offset;
params.he_spr_srg_obss_pd_max_offset =
hapd->iface->conf->spr.srg_obss_pd_max_offset;
params.twt_responder = hostapd_get_he_twt_responder(hapd,
IEEE80211_MODE_AP);
#endif /* CONFIG_IEEE80211AX */
hapd->reenable_beacon = 0;

View file

@ -96,6 +96,8 @@ u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
u16 copy_sta_he_capab(struct hostapd_data *hapd, struct sta_info *sta,
enum ieee80211_op_mode opmode, const u8 *he_capab,
size_t he_capab_len);
int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
enum ieee80211_op_mode mode);
void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
const u8 *buf, size_t len, int ack);
void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst,

View file

@ -413,3 +413,18 @@ u16 copy_sta_he_capab(struct hostapd_data *hapd, struct sta_info *sta,
return WLAN_STATUS_SUCCESS;
}
int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
enum ieee80211_op_mode mode)
{
u8 *mac_cap;
if (!hapd->iface->current_mode ||
!hapd->iface->current_mode->he_capab)
return 0;
mac_cap = hapd->iface->current_mode->he_capab[mode].mac_cap;
return mac_cap[HE_MAC_CAPAB_0] & HE_MACCAP_TWT_RESPONDER;
}

View file

@ -2156,6 +2156,8 @@ struct ieee80211_spatial_reuse {
/* HE Capabilities Information defines */
#define HE_MACCAP_TWT_RESPONDER ((u8) BIT(2))
#define HE_PHYCAP_CHANNEL_WIDTH_SET_IDX 0
#define HE_PHYCAP_CHANNEL_WIDTH_MASK ((u8) (BIT(1) | BIT(2) | \
BIT(3) | BIT(4)))

View file

@ -182,6 +182,7 @@ struct hostapd_channel_data {
struct hostapd_wmm_rule wmm_rules[WMM_AC_NUM];
};
#define HE_MAC_CAPAB_0 0
#define HE_MAX_MAC_CAPAB_SIZE 6
#define HE_MAX_PHY_CAPAB_SIZE 11
#define HE_MAX_MCS_CAPAB_SIZE 12
@ -1487,6 +1488,11 @@ struct wpa_driver_ap_params {
* he_spr_srg_obss_pd_max_offset - Maximum TX power offset
*/
int he_spr_srg_obss_pd_max_offset;
/**
* twt_responder - Whether Target Wait Time responder is enabled
*/
int twt_responder;
};
struct wpa_driver_mesh_bss_params {

View file

@ -4348,6 +4348,13 @@ static int wpa_driver_nl80211_set_ap(void *priv,
nla_nest_end(msg, spr);
}
if (params->twt_responder) {
wpa_printf(MSG_DEBUG, "nl80211: twt_responder=%d",
params->twt_responder);
if (nla_put_flag(msg, NL80211_ATTR_TWT_RESPONDER))
goto fail;
}
#endif /* CONFIG_IEEE80211AX */
ret = send_and_recv_msgs(drv, msg, NULL, NULL);