Moved IEEE 802.11n parameter to be per-radio instead of per-BSS

This commit is contained in:
Jouni Malinen 2008-08-22 21:03:31 +03:00 committed by Jouni Malinen
parent edd360e170
commit 9d2a76a2c3
4 changed files with 33 additions and 39 deletions

View file

@ -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); pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta);
/* Wi-Fi Wireless Multimedia Extensions */ /* 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 pos = hostapd_eid_ht_capabilities_info(hapd, pos);
if (hapd->conf->ieee80211n) { pos = hostapd_eid_ht_operation(hapd, pos);
pos = hostapd_eid_ht_capabilities_info(hapd, pos);
pos = hostapd_eid_ht_operation(hapd, pos);
}
#endif /* CONFIG_IEEE80211N */
if (hostapd_send_mgmt_frame(hapd, resp, pos - (u8 *) resp, 0) < 0) if (hostapd_send_mgmt_frame(hapd, resp, pos - (u8 *) resp, 0) < 0)
perror("handle_probe_req: send"); perror("handle_probe_req: send");
@ -381,11 +376,10 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
tailpos, NULL); tailpos, NULL);
/* Wi-Fi Wireless Multimedia Extensions */ /* 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 #ifdef CONFIG_IEEE80211N
if (hapd->conf->ieee80211n) { if (hapd->iconf->ieee80211n) {
u8 *start; u8 *start;
start = tailpos; start = tailpos;
tailpos = hostapd_eid_ht_capabilities_info(hapd, tailpos); tailpos = hostapd_eid_ht_capabilities_info(hapd, tailpos);

View file

@ -246,11 +246,11 @@ static struct hostapd_config * hostapd_config_defaults(void)
conf->wme_ac_params[3] = ac_vo; conf->wme_ac_params[3] = ac_vo;
#ifdef CONFIG_IEEE80211N #ifdef CONFIG_IEEE80211N
SET_2BIT_LE16(&bss->ht_capab, SET_2BIT_LE16(&conf->ht_capab,
HT_CAP_INFO_MIMO_PWR_SAVE_OFFSET, HT_CAP_INFO_MIMO_PWR_SAVE_OFFSET,
MIMO_PWR_NO_LIMIT_ON_MIMO_SEQS); 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 */ #endif /* CONFIG_IEEE80211N */
return conf; return conf;
@ -1949,7 +1949,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N #ifdef CONFIG_IEEE80211N
} else if (os_strcmp(buf, "ieee80211n") == 0) { } else if (os_strcmp(buf, "ieee80211n") == 0) {
bss->ieee80211n = atoi(pos); conf->ieee80211n = atoi(pos);
#endif /* CONFIG_IEEE80211N */ #endif /* CONFIG_IEEE80211N */
} else if (os_strcmp(buf, "max_listen_interval") == 0) { } else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos); bss->max_listen_interval = atoi(pos);

View file

@ -273,12 +273,6 @@ struct hostapd_bss_config {
u16 max_listen_interval; u16 max_listen_interval;
int okc; /* Opportunistic Key Caching */ 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_DISABLED = 0,
INTERNAL_BRIDGE_ENABLED = 1 INTERNAL_BRIDGE_ENABLED = 1
} bridge_packets; } bridge_packets;
#ifdef CONFIG_IEEE80211N
int ieee80211n;
int ht_op_mode_fixed;
u16 ht_capab;
#endif /* CONFIG_IEEE80211N */
}; };

View file

@ -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) u8 * hostapd_eid_ht_capabilities_info(struct hostapd_data *hapd, u8 *eid)
{ {
#ifdef CONFIG_IEEE80211N
struct ieee80211_ht_capability *cap; struct ieee80211_ht_capability *cap;
u8 *pos = eid; u8 *pos = eid;
if (!hapd->conf->ieee80211n) if (!hapd->iconf->ieee80211n)
return eid; return eid;
*pos++ = WLAN_EID_HT_CAP; *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, MAC_HT_PARAM_INFO_MAX_RX_AMPDU_FACTOR_OFFSET,
MAX_RX_AMPDU_FACTOR_64KB); 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[0] = 0xff;
cap->supported_mcs_set[1] = 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); pos += sizeof(*cap);
return pos; return pos;
#else /* CONFIG_IEEE80211N */
return eid;
#endif /* CONFIG_IEEE80211N */
} }
u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
{ {
#ifdef CONFIG_IEEE80211N
struct ieee80211_ht_operation *oper; struct ieee80211_ht_operation *oper;
u8 *pos = eid; u8 *pos = eid;
if (!hapd->conf->ieee80211n) if (!hapd->iconf->ieee80211n)
return eid; return eid;
*pos++ = WLAN_EID_HT_OPERATION; *pos++ = WLAN_EID_HT_OPERATION;
@ -150,9 +153,14 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
pos += sizeof(*oper); pos += sizeof(*oper);
return pos; return pos;
#else /* CONFIG_IEEE80211N */
return eid;
#endif /* CONFIG_IEEE80211N */
} }
#ifdef CONFIG_IEEE80211N
/* /*
op_mode op_mode
Set to 0 (HT pure) under the followign conditions 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; u16 cur_op_mode, new_op_mode;
int op_mode_changes = 0; int op_mode_changes = 0;
struct hostapd_data *hapd = iface->bss[0];
/* TODO: should hapd pointer really be used here? This should most if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed)
* likely be per radio, not per BSS.. */
if (!hapd->conf->ieee80211n || hapd->conf->ht_op_mode_fixed)
return 0; return 0;
wpa_printf(MSG_DEBUG, "%s current operation mode=0x%X", 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 || if (iface->num_sta_no_ht ||
(iface->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)) (iface->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT))
new_op_mode = OP_MODE_MIXED; new_op_mode = OP_MODE_MIXED;
else if ((hapd->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) && else if ((iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)
iface->num_sta_ht_20mhz) && iface->num_sta_ht_20mhz)
new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED; new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
else if (iface->olbc_ht) else if (iface->olbc_ht)
new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS; new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS;
@ -1258,7 +1262,7 @@ static void handle_assoc(struct hostapd_data *hapd,
} }
} else { } else {
hapd->iface->num_sta_no_ht++; hapd->iface->num_sta_no_ht++;
if (hapd->conf->ieee80211n) { if (hapd->iconf->ieee80211n) {
wpa_printf(MSG_DEBUG, "%s STA " MACSTR wpa_printf(MSG_DEBUG, "%s STA " MACSTR
" - no HT, num of non-HT stations %d", " - no HT, num of non-HT stations %d",
__func__, MAC2STR(sta->addr), __func__, MAC2STR(sta->addr),
@ -1335,12 +1339,8 @@ static void handle_assoc(struct hostapd_data *hapd,
if (sta->flags & WLAN_STA_WME) if (sta->flags & WLAN_STA_WME)
p = hostapd_eid_wme(hapd, p); p = hostapd_eid_wme(hapd, p);
#ifdef CONFIG_IEEE80211N p = hostapd_eid_ht_capabilities_info(hapd, p);
if (hapd->conf->ieee80211n) { p = hostapd_eid_ht_operation(hapd, p);
p = hostapd_eid_ht_capabilities_info(hapd, p);
p = hostapd_eid_ht_operation(hapd, p);
}
#endif /* CONFIG_IEEE80211N */
#ifdef CONFIG_IEEE80211R #ifdef CONFIG_IEEE80211R
if (resp == WLAN_STATUS_SUCCESS) { if (resp == WLAN_STATUS_SUCCESS) {