Add support for user configurable Beacon frame data rate for AP mode

Allow configuration of Beacon frame TX rate from hostapd.conf with
"beacon_rate=xx" option. The following format is used to set
legacy/HT/VHT beacon rates:

Legacy (CCK/OFDM rates):
	beacon_rate=<legacy rate in 100 kbps>
HT:
	beacon_rate=ht:<HT MCS>
VHT:
	beacon_rate=vht:<VHT MCS>

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Purushottam Kushwaha 2016-11-22 14:40:35 +05:30 committed by Jouni Malinen
parent dff690b859
commit 29483a5678
6 changed files with 79 additions and 0 deletions

View file

@ -2756,6 +2756,40 @@ static int hostapd_config_fill(struct hostapd_config *conf,
line); line);
return 1; return 1;
} }
} else if (os_strcmp(buf, "beacon_rate") == 0) {
int val;
if (os_strncmp(pos, "ht:", 3) == 0) {
val = atoi(pos + 3);
if (val < 0 || val > 31) {
wpa_printf(MSG_ERROR,
"Line %d: invalid beacon_rate HT-MCS %d",
line, val);
return 1;
}
conf->rate_type = BEACON_RATE_HT;
conf->beacon_rate = val;
} else if (os_strncmp(pos, "vht:", 4) == 0) {
val = atoi(pos + 4);
if (val < 0 || val > 9) {
wpa_printf(MSG_ERROR,
"Line %d: invalid beacon_rate VHT-MCS %d",
line, val);
return 1;
}
conf->rate_type = BEACON_RATE_VHT;
conf->beacon_rate = val;
} else {
val = atoi(pos);
if (val < 10 || val > 10000) {
wpa_printf(MSG_ERROR,
"Line %d: invalid legacy beacon_rate %d",
line, val);
return 1;
}
conf->rate_type = BEACON_RATE_LEGACY;
conf->beacon_rate = val;
}
} else if (os_strcmp(buf, "preamble") == 0) { } else if (os_strcmp(buf, "preamble") == 0) {
if (atoi(pos)) if (atoi(pos))
conf->preamble = SHORT_PREAMBLE; conf->preamble = SHORT_PREAMBLE;

View file

@ -227,6 +227,19 @@ fragm_threshold=-1
#basic_rates=10 20 55 110 #basic_rates=10 20 55 110
#basic_rates=60 120 240 #basic_rates=60 120 240
# Beacon frame TX rate configuration
# This sets the TX rate that is used to transmit Beacon frames. If this item is
# not included, the driver default rate (likely lowest rate) is used.
# Legacy (CCK/OFDM rates):
# beacon_rate=<legacy rate in 100 kbps>
# HT:
# beacon_rate=ht:<HT MCS>
# VHT:
# beacon_rate=vht:<VHT MCS>
#
# For example, beacon_rate=10 for 1 Mbps or beacon_rate=60 for 6 Mbps (OFDM).
#beacon_rate=10
# Short Preamble # Short Preamble
# This parameter can be used to enable optional use of short preamble for # This parameter can be used to enable optional use of short preamble for
# frames sent at 2 Mbps, 5.5 Mbps, and 11 Mbps to improve network performance. # frames sent at 2 Mbps, 5.5 Mbps, and 11 Mbps to improve network performance.

View file

@ -626,6 +626,8 @@ struct hostapd_config {
int *supported_rates; int *supported_rates;
int *basic_rates; int *basic_rates;
unsigned int beacon_rate;
enum beacon_rate_type rate_type;
const struct wpa_driver_ops *driver; const struct wpa_driver_ops *driver;
char *driver_params; char *driver_params;

View file

@ -1223,6 +1223,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
params->dtim_period = hapd->conf->dtim_period; params->dtim_period = hapd->conf->dtim_period;
params->beacon_int = hapd->iconf->beacon_int; params->beacon_int = hapd->iconf->beacon_int;
params->basic_rates = hapd->iface->basic_rates; params->basic_rates = hapd->iface->basic_rates;
params->beacon_rate = hapd->iconf->beacon_rate;
params->rate_type = hapd->iconf->rate_type;
params->ssid = hapd->conf->ssid.ssid; params->ssid = hapd->conf->ssid.ssid;
params->ssid_len = hapd->conf->ssid.ssid_len; params->ssid_len = hapd->conf->ssid.ssid_len;
if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) == if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) ==

View file

@ -370,4 +370,10 @@ enum wpa_radio_work_band {
BAND_60_GHZ = BIT(2), BAND_60_GHZ = BIT(2),
}; };
enum beacon_rate_type {
BEACON_RATE_LEGACY,
BEACON_RATE_HT,
BEACON_RATE_VHT
};
#endif /* DEFS_H */ #endif /* DEFS_H */

View file

@ -964,6 +964,22 @@ struct wpa_driver_ap_params {
*/ */
int *basic_rates; int *basic_rates;
/**
* beacon_rate: Beacon frame data rate
*
* 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.
*/
unsigned int beacon_rate;
/**
* beacon_rate_type: Beacon data rate type (legacy/HT/VHT)
*/
enum beacon_rate_type rate_type;
/** /**
* proberesp - Probe Response template * proberesp - Probe Response template
* *
@ -1313,6 +1329,12 @@ struct wpa_driver_capa {
#define WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD 0x0000020000000000ULL #define WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD 0x0000020000000000ULL
/** Driver supports FILS */ /** Driver supports FILS */
#define WPA_DRIVER_FLAGS_SUPPORT_FILS 0x0000040000000000ULL #define WPA_DRIVER_FLAGS_SUPPORT_FILS 0x0000040000000000ULL
/** Driver supports Beacon frame TX rate configuration (legacy rates) */
#define WPA_DRIVER_FLAGS_BEACON_RATE_LEGACY 0x0000080000000000ULL
/** Driver supports Beacon frame TX rate configuration (HT rates) */
#define WPA_DRIVER_FLAGS_BEACON_RATE_HT 0x0000100000000000ULL
/** Driver supports Beacon frame TX rate configuration (VHT rates) */
#define WPA_DRIVER_FLAGS_BEACON_RATE_VHT 0x0000200000000000ULL
u64 flags; u64 flags;
#define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \ #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \