]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add TWT responder support for AP in HT and VHT modes
authorManaswini Paluri <quic_mpaluri@quicinc.com>
Wed, 28 Feb 2024 05:41:43 +0000 (11:11 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 19 Apr 2024 15:38:37 +0000 (18:38 +0300)
Add support for TWT responder for AP operating in HT and VHT modes by
introducing a new configuration parameter ht_vht_twt_responder. When
this is enabled, TWT responder mode support in HT and VHT modes is
enabled if the driver supports this and is disabled otherwise.

Signed-off-by: Manaswini Paluri<quic_mpaluri@quicinc.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/beacon.c
src/ap/ieee802_11.h
src/ap/ieee802_11_shared.c
src/drivers/driver.h
src/drivers/driver_nl80211_capa.c

index 9a8f34e0dea29fccefef22d5ed834f16b9e03dbc..c83e71e069a72800c0b8c28f0db8e3e82c85a9f1 100644 (file)
@@ -3664,6 +3664,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                }
        } else if (os_strcmp(buf, "require_ht") == 0) {
                conf->require_ht = atoi(pos);
+       } else if (os_strcmp(buf, "ht_vht_twt_responder") == 0) {
+               conf->ht_vht_twt_responder = atoi(pos);
        } else if (os_strcmp(buf, "obss_interval") == 0) {
                conf->obss_interval = atoi(pos);
 #ifdef CONFIG_IEEE80211AC
index 51ca05e25740f4f4b66d9068e1234c8216a93303..efae334dcedb5681c16e58809e555163da8309f4 100644 (file)
@@ -646,6 +646,12 @@ wmm_ac_vo_acm=0
 # no co-existence issues with neighboring devices are found.
 #obss_interval=0
 
+# ht_vht_twt_responder: Whether TWT responder is enabled in HT and VHT modes
+# 0 = disable; Disable TWT responder support in  HT and VHT modes (default).
+# 1 = enable; Enable TWT responder support in HT and VHT modes if supported by
+# the driver.
+#ht_vht_twt_responder=0
+
 ##### IEEE 802.11ac related configuration #####################################
 
 # ieee80211ac: Whether IEEE 802.11ac (VHT) is enabled
index aa513be4ce4b0c8d6593392d7e56ed8bc9b11d0c..49a2cea166342b085abe5ea583b7283da38ba60d 100644 (file)
@@ -1226,6 +1226,9 @@ struct hostapd_config {
                MBSSID_ENABLED = 1,
                ENHANCED_MBSSID_ENABLED = 2,
        } mbssid;
+
+       /* Whether to enable TWT responder in HT and VHT modes */
+       bool ht_vht_twt_responder;
 };
 
 
index 00ce933ad76417fae6335bbcbb7bc6f5f68998b1..5ba9505238d504003e474be1674077bb385fc764 100644 (file)
@@ -2547,6 +2547,7 @@ static int __ieee802_11_set_beacon(struct hostapd_data *hapd)
        struct hostapd_config *iconf = iface->conf;
        struct hostapd_hw_modes *cmode = iface->current_mode;
        struct wpabuf *beacon, *proberesp, *assocresp;
+       bool twt_he_responder = false;
        int res, ret = -1, i;
        struct hostapd_hw_modes *mode;
 
@@ -2590,11 +2591,13 @@ static 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);
+       twt_he_responder = hostapd_get_he_twt_responder(hapd,
+                                                       IEEE80211_MODE_AP);
        params.unsol_bcast_probe_resp_tmpl =
                hostapd_unsol_bcast_probe_resp(hapd, &params);
 #endif /* CONFIG_IEEE80211AX */
+       params.twt_responder =
+               twt_he_responder || hostapd_get_ht_vht_twt_responder(hapd);
        hapd->reenable_beacon = 0;
 #ifdef CONFIG_SAE
        params.sae_pwe = hapd->conf->sae_pwe;
index a35486d464061cd9aa27bec0651cbdf67f8de96d..f76e9bcde3eae01c589d8f37dff5a6a1b640fd8f 100644 (file)
@@ -129,6 +129,7 @@ u16 copy_sta_he_6ghz_capab(struct hostapd_data *hapd, struct sta_info *sta,
                           const u8 *he_6ghz_capab);
 int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
                                 enum ieee80211_op_mode mode);
+bool hostapd_get_ht_vht_twt_responder(struct hostapd_data *hapd);
 u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid);
 void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
                       const u8 *buf, size_t len, int ack);
index 85790c7ed600931b909f14ec69872e0d2061b4ba..d02f4515abc7516a49fc2b605f99e49097e1a5f7 100644 (file)
@@ -441,6 +441,8 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx,
                if (hostapd_get_he_twt_responder(hapd, IEEE80211_MODE_AP))
                        *pos |= 0x40; /* Bit 78 - TWT responder */
 #endif /* CONFIG_IEEE80211AX */
+               if (hostapd_get_ht_vht_twt_responder(hapd))
+                       *pos |= 0x40; /* Bit 78 - TWT responder */
                break;
        case 10: /* Bits 80-87 */
 #ifdef CONFIG_SAE
@@ -1198,3 +1200,13 @@ struct sta_info * hostapd_ml_get_assoc_sta(struct hostapd_data *hapd,
 
        return sta;
 }
+
+
+bool hostapd_get_ht_vht_twt_responder(struct hostapd_data *hapd)
+{
+       return hapd->iconf->ht_vht_twt_responder &&
+               ((hapd->iconf->ieee80211n && !hapd->conf->disable_11n) ||
+                (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac)) &&
+               (hapd->iface->drv_flags2 &
+                WPA_DRIVER_FLAGS2_HT_VHT_TWT_RESPONDER);
+}
index 36dc0780562483d0deca1e09412446e5ecdf476c..09cafeb0e4bfcae99eaf6022326068f08fbf8829 100644 (file)
@@ -2323,6 +2323,8 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS2_OWE_OFFLOAD_AP       0x0000000000080000ULL
 /** Driver support AP SAE authentication offload */
 #define WPA_DRIVER_FLAGS2_SAE_OFFLOAD_AP       0x0000000000100000ULL
+/** Driver supports TWT responder in HT and VHT modes */
+#define WPA_DRIVER_FLAGS2_HT_VHT_TWT_RESPONDER 0x0000000000200000ULL
        u64 flags2;
 
 #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
index 65389d2069c0fb2d64b23a6b73302b641b0f724b..dc16bd4458da8f2ea92cf5abb0eeddf74ffdb5af 100644 (file)
@@ -1441,6 +1441,8 @@ static void qca_nl80211_get_features(struct wpa_driver_nl80211_data *drv)
        if (check_feature(QCA_WLAN_VENDOR_FEATURE_AP_ALLOWED_FREQ_LIST,
                          &info))
                drv->qca_ap_allowed_freqs = 1;
+       if (check_feature(QCA_WLAN_VENDOR_FEATURE_HT_VHT_TWT_RESPONDER, &info))
+               drv->capa.flags2 |= WPA_DRIVER_FLAGS2_HT_VHT_TWT_RESPONDER;
        os_free(info.flags);
 }