From a8d8410e1fc0d88de314a960d7c5c70a76cae883 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 24 Nov 2008 16:33:45 +0200 Subject: [PATCH] Added support for configuring secondary channel offset for HT40 --- hostapd/config.c | 8 +++++++- hostapd/config.h | 1 + hostapd/hostapd.conf | 8 +++++--- hostapd/ieee802_11.c | 5 +++++ src/common/ieee802_11_defs.h | 8 +++----- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/hostapd/config.c b/hostapd/config.c index b4ac830..2e7e04f 100644 --- a/hostapd/config.c +++ b/hostapd/config.c @@ -1315,8 +1315,14 @@ static int hostapd_config_ht_capab(struct hostapd_config *conf, { if (os_strstr(capab, "[LDPC]")) conf->ht_capab |= HT_CAP_INFO_LDPC_CODING_CAP; - if (os_strstr(capab, "[HT40]")) + if (os_strstr(capab, "[HT40-]")) { conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET; + conf->secondary_channel = -1; + } + if (os_strstr(capab, "[HT40+]")) { + conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET; + conf->secondary_channel = 1; + } if (os_strstr(capab, "[SMPS-STATIC]")) { conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK; conf->ht_capab |= HT_CAP_INFO_SMPS_STATIC; diff --git a/hostapd/config.h b/hostapd/config.h index 324349d..c776b7f 100644 --- a/hostapd/config.h +++ b/hostapd/config.h @@ -378,6 +378,7 @@ struct hostapd_config { int ieee80211n; int ht_op_mode_fixed; u16 ht_capab; + int secondary_channel; #endif /* CONFIG_IEEE80211N */ }; diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index c6ec709..8df35c8 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -380,8 +380,10 @@ wme_ac_vo_acm=0 # ht_capab: HT capabilities (list of flags) # LDPC coding capability: [LDPC] = supported -# Supported channel width set: [HT40] = both 20 MHz and 40 MHz -# (20 MHz only if not set) +# Supported channel width set: [HT40-] = both 20 MHz and 40 MHz with secondary +# channel below the primary channel; [HT40+] = both 20 MHz and 40 MHz +# with secondary channel below the primary channel +# (20 MHz only if neither is set) # Spatial Multiplexing (SM) Power Save: [SMPS-STATIC] or [SMPS-DYNAMIC] # (SMPS disabled if neither is set) # HT-greenfield: [GF] (disabled if not set) @@ -397,7 +399,7 @@ wme_ac_vo_acm=0 # DSSS/CCK Mode in 40 MHz: [DSSS_CCK-40] = allowed (not allowed if not set) # PSMP support: [PSMP] (disabled if not set) # L-SIG TXOP protection support: [LSIG-TXOP-PROT] (disabled if not set) -#ht_capab=[HT40][SHORT-GI-20][SHORT-GI-40] +#ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40] ##### IEEE 802.1X-2004 related configuration ################################## diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c index 5090b79..aa493fe 100644 --- a/hostapd/ieee802_11.c +++ b/hostapd/ieee802_11.c @@ -147,7 +147,12 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) oper = (struct ieee80211_ht_operation *) pos; os_memset(oper, 0, sizeof(*oper)); + oper->control_chan = hapd->iconf->channel; oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); + if (hapd->iconf->secondary_channel == 1) + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; + if (hapd->iconf->secondary_channel == -1) + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW; pos += sizeof(*oper); diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index b92c6ff..611d1e0 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -495,10 +495,6 @@ struct ht_cap_ie { } STRUCT_PACKED; -#define EXT_CHNL_OFF_NONE 0 -#define EXT_CHNL_OFF_ABOVE 1 -#define EXT_CHNL_OFF_BELOW 3 - #define REC_TRANS_CHNL_WIDTH_20 0 #define REC_TRANS_CHNL_WIDTH_ANY 1 @@ -507,7 +503,9 @@ struct ht_cap_ie { #define OP_MODE_20MHZ_HT_STA_ASSOCED 2 #define OP_MODE_MIXED 3 -#define HT_INFO_HT_PARAM_EXT_CHNL_OFF_OFFSET 0 +#define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8) BIT(0) | BIT(1)) +#define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8) BIT(0)) +#define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8) BIT(0) | BIT(1)) #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8) BIT(2)) #define HT_INFO_HT_PARAM_RIFS_MODE ((u8) BIT(3)) #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8) BIT(4)) -- 1.7.9.5