From 9d2a76a2c38e75c515bbd1732623aa233be42e3a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 22 Aug 2008 21:03:31 +0300 Subject: [PATCH] Moved IEEE 802.11n parameter to be per-radio instead of per-BSS --- hostapd/beacon.c | 16 +++++----------- hostapd/config.c | 6 +++--- hostapd/config.h | 12 ++++++------ hostapd/ieee802_11.c | 38 +++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 39 deletions(-) diff --git a/hostapd/beacon.c b/hostapd/beacon.c index 05dcbb53e..40786074a 100644 --- a/hostapd/beacon.c +++ b/hostapd/beacon.c @@ -283,15 +283,10 @@ void handle_probe_req(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt, pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta); /* Wi-Fi Wireless Multimedia Extensions */ - if (hapd->conf->wme_enabled) - pos = hostapd_eid_wme(hapd, pos); + pos = hostapd_eid_wme(hapd, pos); -#ifdef CONFIG_IEEE80211N - if (hapd->conf->ieee80211n) { - pos = hostapd_eid_ht_capabilities_info(hapd, pos); - pos = hostapd_eid_ht_operation(hapd, pos); - } -#endif /* CONFIG_IEEE80211N */ + pos = hostapd_eid_ht_capabilities_info(hapd, pos); + pos = hostapd_eid_ht_operation(hapd, pos); if (hostapd_send_mgmt_frame(hapd, resp, pos - (u8 *) resp, 0) < 0) perror("handle_probe_req: send"); @@ -381,11 +376,10 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd) tailpos, NULL); /* Wi-Fi Wireless Multimedia Extensions */ - if (hapd->conf->wme_enabled) - tailpos = hostapd_eid_wme(hapd, tailpos); + tailpos = hostapd_eid_wme(hapd, tailpos); #ifdef CONFIG_IEEE80211N - if (hapd->conf->ieee80211n) { + if (hapd->iconf->ieee80211n) { u8 *start; start = tailpos; tailpos = hostapd_eid_ht_capabilities_info(hapd, tailpos); diff --git a/hostapd/config.c b/hostapd/config.c index 16f2a8e12..7ec3594fe 100644 --- a/hostapd/config.c +++ b/hostapd/config.c @@ -246,11 +246,11 @@ static struct hostapd_config * hostapd_config_defaults(void) conf->wme_ac_params[3] = ac_vo; #ifdef CONFIG_IEEE80211N - SET_2BIT_LE16(&bss->ht_capab, + SET_2BIT_LE16(&conf->ht_capab, HT_CAP_INFO_MIMO_PWR_SAVE_OFFSET, MIMO_PWR_NO_LIMIT_ON_MIMO_SEQS); - bss->ht_capab |= HT_CAP_INFO_GREEN_FIELD; + conf->ht_capab |= HT_CAP_INFO_GREEN_FIELD; #endif /* CONFIG_IEEE80211N */ return conf; @@ -1949,7 +1949,7 @@ struct hostapd_config * hostapd_config_read(const char *fname) #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N } else if (os_strcmp(buf, "ieee80211n") == 0) { - bss->ieee80211n = atoi(pos); + conf->ieee80211n = atoi(pos); #endif /* CONFIG_IEEE80211N */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); diff --git a/hostapd/config.h b/hostapd/config.h index 977f815fd..971350362 100644 --- a/hostapd/config.h +++ b/hostapd/config.h @@ -273,12 +273,6 @@ struct hostapd_bss_config { u16 max_listen_interval; int okc; /* Opportunistic Key Caching */ - -#ifdef CONFIG_IEEE80211N - int ieee80211n; - int ht_op_mode_fixed; - u16 ht_capab; -#endif /* CONFIG_IEEE80211N */ }; @@ -352,6 +346,12 @@ struct hostapd_config { INTERNAL_BRIDGE_DISABLED = 0, INTERNAL_BRIDGE_ENABLED = 1 } bridge_packets; + +#ifdef CONFIG_IEEE80211N + int ieee80211n; + int ht_op_mode_fixed; + u16 ht_capab; +#endif /* CONFIG_IEEE80211N */ }; diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c index bdade7a77..87d74c200 100644 --- a/hostapd/ieee802_11.c +++ b/hostapd/ieee802_11.c @@ -101,14 +101,13 @@ u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid) } -#ifdef CONFIG_IEEE80211N - u8 * hostapd_eid_ht_capabilities_info(struct hostapd_data *hapd, u8 *eid) { +#ifdef CONFIG_IEEE80211N struct ieee80211_ht_capability *cap; u8 *pos = eid; - if (!hapd->conf->ieee80211n) + if (!hapd->iconf->ieee80211n) return eid; *pos++ = WLAN_EID_HT_CAP; @@ -120,7 +119,7 @@ u8 * hostapd_eid_ht_capabilities_info(struct hostapd_data *hapd, u8 *eid) MAC_HT_PARAM_INFO_MAX_RX_AMPDU_FACTOR_OFFSET, MAX_RX_AMPDU_FACTOR_64KB); - cap->capabilities_info = host_to_le16(hapd->conf->ht_capab); + cap->capabilities_info = host_to_le16(hapd->iconf->ht_capab); cap->supported_mcs_set[0] = 0xff; cap->supported_mcs_set[1] = 0xff; @@ -128,15 +127,19 @@ u8 * hostapd_eid_ht_capabilities_info(struct hostapd_data *hapd, u8 *eid) pos += sizeof(*cap); return pos; +#else /* CONFIG_IEEE80211N */ + return eid; +#endif /* CONFIG_IEEE80211N */ } u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) { +#ifdef CONFIG_IEEE80211N struct ieee80211_ht_operation *oper; u8 *pos = eid; - if (!hapd->conf->ieee80211n) + if (!hapd->iconf->ieee80211n) return eid; *pos++ = WLAN_EID_HT_OPERATION; @@ -150,9 +153,14 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) pos += sizeof(*oper); return pos; +#else /* CONFIG_IEEE80211N */ + return eid; +#endif /* CONFIG_IEEE80211N */ } +#ifdef CONFIG_IEEE80211N + /* op_mode Set to 0 (HT pure) under the followign conditions @@ -169,12 +177,8 @@ int hostapd_ht_operation_update(struct hostapd_iface *iface) { u16 cur_op_mode, new_op_mode; int op_mode_changes = 0; - struct hostapd_data *hapd = iface->bss[0]; - /* TODO: should hapd pointer really be used here? This should most - * likely be per radio, not per BSS.. */ - - if (!hapd->conf->ieee80211n || hapd->conf->ht_op_mode_fixed) + if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed) return 0; wpa_printf(MSG_DEBUG, "%s current operation mode=0x%X", @@ -213,8 +217,8 @@ int hostapd_ht_operation_update(struct hostapd_iface *iface) if (iface->num_sta_no_ht || (iface->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)) new_op_mode = OP_MODE_MIXED; - else if ((hapd->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) && - iface->num_sta_ht_20mhz) + else if ((iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) + && iface->num_sta_ht_20mhz) new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED; else if (iface->olbc_ht) new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS; @@ -1258,7 +1262,7 @@ static void handle_assoc(struct hostapd_data *hapd, } } else { hapd->iface->num_sta_no_ht++; - if (hapd->conf->ieee80211n) { + if (hapd->iconf->ieee80211n) { wpa_printf(MSG_DEBUG, "%s STA " MACSTR " - no HT, num of non-HT stations %d", __func__, MAC2STR(sta->addr), @@ -1335,12 +1339,8 @@ static void handle_assoc(struct hostapd_data *hapd, if (sta->flags & WLAN_STA_WME) p = hostapd_eid_wme(hapd, p); -#ifdef CONFIG_IEEE80211N - if (hapd->conf->ieee80211n) { - p = hostapd_eid_ht_capabilities_info(hapd, p); - p = hostapd_eid_ht_operation(hapd, p); - } -#endif /* CONFIG_IEEE80211N */ + p = hostapd_eid_ht_capabilities_info(hapd, p); + p = hostapd_eid_ht_operation(hapd, p); #ifdef CONFIG_IEEE80211R if (resp == WLAN_STATUS_SUCCESS) {