Added support for configuring secondary channel offset for HT40
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 24 Nov 2008 14:33:45 +0000 (16:33 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 24 Nov 2008 14:33:45 +0000 (16:33 +0200)
hostapd/config.c
hostapd/config.h
hostapd/hostapd.conf
hostapd/ieee802_11.c
src/common/ieee802_11_defs.h

index b4ac830..2e7e04f 100644 (file)
@@ -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;
index 324349d..c776b7f 100644 (file)
@@ -378,6 +378,7 @@ struct hostapd_config {
        int ieee80211n;
        int ht_op_mode_fixed;
        u16 ht_capab;
+       int secondary_channel;
 #endif /* CONFIG_IEEE80211N */
 };
 
index c6ec709..8df35c8 100644 (file)
@@ -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 ##################################
 
index 5090b79..aa493fe 100644 (file)
@@ -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);
 
index b92c6ff..611d1e0 100644 (file)
@@ -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))