@@ -1448,6 +1448,7 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
params.he_bss_color_partial =
hapd->iface->conf->he_op.he_bss_color_partial;
params.he_bss_color = hapd->iface->conf->he_op.he_bss_color;
+ params.twt_responder = hostapd_get_he_twt_responder(hapd, IEEE80211_MODE_AP);
#endif /* CONFIG_IEEE80211AX */
hapd->reenable_beacon = 0;
@@ -94,6 +94,7 @@ 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,
@@ -413,3 +413,17 @@ 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)
+ return 0;
+ if (!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;
+}
@@ -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)))
@@ -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
@@ -1502,6 +1503,11 @@ struct wpa_driver_ap_params {
* he_bss_color - The BSS Color of the AP
*/
int he_bss_color;
+
+ /**
+ * twt_responder - Whether Target Wait Time responder is enabled
+ */
+ int twt_responder;
};
struct wpa_driver_mesh_bss_params {
@@ -4363,6 +4363,12 @@ static int wpa_driver_nl80211_set_ap(void *priv,
goto fail;
nla_nest_end(msg, bss_color);
+ 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);
This allows us to dynamically turn TWT on responder support using a nl80211 attribute. Signed-off-by: John Crispin <john@phrozen.org> --- src/ap/beacon.c | 1 + src/ap/ieee802_11.h | 1 + src/ap/ieee802_11_he.c | 14 ++++++++++++++ src/common/ieee802_11_defs.h | 2 ++ src/drivers/driver.h | 6 ++++++ src/drivers/driver_nl80211.c | 6 ++++++ 6 files changed, 30 insertions(+)