]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow HE MCS rate selection for Beacon frames
authorRajkumar Manoharan <rmanohar@codeaurora.org>
Sat, 3 Oct 2020 09:31:15 +0000 (02:31 -0700)
committerJouni Malinen <j@w1.fi>
Sun, 7 Feb 2021 22:26:38 +0000 (00:26 +0200)
Allow HE MCS rate to be used for beacon transmission when the driver
advertises the support. The rate is specified with a new beacon_rate
option "he:<HE MCS>" in hostapd configuration.

Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
hostapd/config_file.c
hostapd/hostapd.conf
src/common/defs.h
src/drivers/driver.h
src/drivers/driver_nl80211.c
src/drivers/driver_nl80211_capa.c

index fe8fcd728a3ec8b52b79c1a0992e275bdecbc0a3..ac66d8bd490e77e8b5b93f7f21fced46224a27a7 100644 (file)
@@ -3263,6 +3263,16 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                        }
                        conf->rate_type = BEACON_RATE_VHT;
                        conf->beacon_rate = val;
+               } else if (os_strncmp(pos, "he:", 3) == 0) {
+                       val = atoi(pos + 3);
+                       if (val < 0 || val > 11) {
+                               wpa_printf(MSG_ERROR,
+                                          "Line %d: invalid beacon_rate HE-MCS %d",
+                                          line, val);
+                               return 1;
+                       }
+                       conf->rate_type = BEACON_RATE_HE;
+                       conf->beacon_rate = val;
                } else {
                        val = atoi(pos);
                        if (val < 10 || val > 10000) {
index c4482c13c72c2a144d1ba01968ffbe0d57e0f9d6..8553338fdd2245e8bc3210e8e620533ec54647bc 100644 (file)
@@ -279,6 +279,8 @@ fragm_threshold=-1
 #    beacon_rate=ht:<HT MCS>
 # VHT:
 #    beacon_rate=vht:<VHT MCS>
+# HE:
+#    beacon_rate=he:<HE MCS>
 #
 # For example, beacon_rate=10 for 1 Mbps or beacon_rate=60 for 6 Mbps (OFDM).
 #beacon_rate=10
index a58eff5f71c7bbda08ee9b733e3e29aa685bfbc5..f43bdb5d1b15af92d2ee2141416c1b91636f3dbc 100644 (file)
@@ -405,7 +405,8 @@ enum wpa_radio_work_band {
 enum beacon_rate_type {
        BEACON_RATE_LEGACY,
        BEACON_RATE_HT,
-       BEACON_RATE_VHT
+       BEACON_RATE_VHT,
+       BEACON_RATE_HE
 };
 
 enum eap_proxy_sim_state {
index f737aecae103a6127bacb70b4ab3dbf89c3c386a..1e1f11372667b247bc0c8354fcdd670d2a3f3125 100644 (file)
@@ -1264,14 +1264,14 @@ struct wpa_driver_ap_params {
         *
         * This parameter can be used to set a specific Beacon frame data rate
         * for the BSS. The interpretation of this value depends on the
-        * rate_type (legacy: in 100 kbps units, HT: HT-MCS, VHT: VHT-MCS). If
-        * beacon_rate == 0 and rate_type == 0 (BEACON_RATE_LEGACY), the default
-        * Beacon frame data rate is used.
+        * rate_type (legacy: in 100 kbps units, HT: HT-MCS, VHT: VHT-MCS,
+        * HE: HE-MCS). If beacon_rate == 0 and rate_type == 0
+        * (BEACON_RATE_LEGACY), the default Beacon frame data rate is used.
         */
        unsigned int beacon_rate;
 
        /**
-        * beacon_rate_type: Beacon data rate type (legacy/HT/VHT)
+        * beacon_rate_type: Beacon data rate type (legacy/HT/VHT/HE)
         */
        enum beacon_rate_type rate_type;
 
@@ -1959,6 +1959,8 @@ struct wpa_driver_capa {
  * frames
  */
 #define WPA_DRIVER_FLAGS2_PROT_RANGE_NEG       0x0000000000000010ULL
+/** Driver supports Beacon frame TX rate configuration (HE rates) */
+#define WPA_DRIVER_FLAGS2_BEACON_RATE_HE       0x0000000000000020ULL
        u64 flags2;
 
 #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
index aa0e10bd2ba6c3cdd723ac2e78cd78bdee7669e9..9e5ee544106d869f660f0c7d07dbafbb8066d6a1 100644 (file)
@@ -4198,11 +4198,12 @@ static int nl80211_set_mesh_config(void *priv,
 #endif /* CONFIG_MESH */
 
 
-static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags,
+static int nl80211_put_beacon_rate(struct nl_msg *msg, u64 flags, u64 flags2,
                                   struct wpa_driver_ap_params *params)
 {
        struct nlattr *bands, *band;
        struct nl80211_txrate_vht vht_rate;
+       struct nl80211_txrate_he he_rate;
 
        if (!params->freq ||
            (params->beacon_rate == 0 &&
@@ -4235,6 +4236,7 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags,
                return -1;
 
        os_memset(&vht_rate, 0, sizeof(vht_rate));
+       os_memset(&he_rate, 0, sizeof(he_rate));
 
        switch (params->rate_type) {
        case BEACON_RATE_LEGACY:
@@ -4287,6 +4289,22 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, const u64 flags,
                wpa_printf(MSG_DEBUG, " * beacon_rate = VHT-MCS %u",
                           params->beacon_rate);
                break;
+       case BEACON_RATE_HE:
+               if (!(flags2 & WPA_DRIVER_FLAGS2_BEACON_RATE_HE)) {
+                       wpa_printf(MSG_INFO,
+                                  "nl80211: Driver does not support setting Beacon frame rate (HE)");
+                       return -1;
+               }
+               he_rate.mcs[0] = BIT(params->beacon_rate);
+               if (nla_put(msg, NL80211_TXRATE_LEGACY, 0, NULL) ||
+                   nla_put(msg, NL80211_TXRATE_HT, 0, NULL) ||
+                   nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate),
+                           &vht_rate) ||
+                   nla_put(msg, NL80211_TXRATE_HE, sizeof(he_rate), &he_rate))
+                       return -1;
+               wpa_printf(MSG_DEBUG, " * beacon_rate = HE-MCS %u",
+                          params->beacon_rate);
+               break;
        }
 
        nla_nest_end(msg, band);
@@ -4409,7 +4427,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
            nla_put(msg, NL80211_ATTR_BEACON_TAIL, params->tail_len,
                    params->tail) ||
            nl80211_put_beacon_int(msg, params->beacon_int) ||
-           nl80211_put_beacon_rate(msg, drv->capa.flags, params) ||
+           nl80211_put_beacon_rate(msg, drv->capa.flags, drv->capa.flags2,
+                                   params) ||
            nl80211_put_dtim_period(msg, params->dtim_period) ||
            nla_put(msg, NL80211_ATTR_SSID, params->ssid_len, params->ssid))
                goto fail;
index 6c2ab515ea14565347bcdb56c6d8a05beaaa3233..6dea42f90dce78d6cf9aa42cf8823cb6d1f96fa7 100644 (file)
@@ -558,6 +558,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info,
                              NL80211_EXT_FEATURE_BEACON_RATE_VHT))
                capa->flags |= WPA_DRIVER_FLAGS_BEACON_RATE_VHT;
 
+       if (ext_feature_isset(ext_features, len,
+                             NL80211_EXT_FEATURE_BEACON_RATE_HE))
+               capa->flags2 |= WPA_DRIVER_FLAGS2_BEACON_RATE_HE;
+
        if (ext_feature_isset(ext_features, len,
                              NL80211_EXT_FEATURE_SET_SCAN_DWELL))
                capa->rrm_flags |= WPA_DRIVER_FLAGS_SUPPORT_SET_SCAN_DWELL;