Browse Source

Added support for configuring secondary channel offset for HT40

Jouni Malinen 16 years ago
parent
commit
a8d8410e1f
5 changed files with 21 additions and 9 deletions
  1. 7 1
      hostapd/config.c
  2. 1 0
      hostapd/config.h
  3. 5 3
      hostapd/hostapd.conf
  4. 5 0
      hostapd/ieee802_11.c
  5. 3 5
      src/common/ieee802_11_defs.h

+ 7 - 1
hostapd/config.c

@@ -1315,8 +1315,14 @@ static int hostapd_config_ht_capab(struct hostapd_config *conf,
 {
 {
 	if (os_strstr(capab, "[LDPC]"))
 	if (os_strstr(capab, "[LDPC]"))
 		conf->ht_capab |= HT_CAP_INFO_LDPC_CODING_CAP;
 		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->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]")) {
 	if (os_strstr(capab, "[SMPS-STATIC]")) {
 		conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
 		conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
 		conf->ht_capab |= HT_CAP_INFO_SMPS_STATIC;
 		conf->ht_capab |= HT_CAP_INFO_SMPS_STATIC;

+ 1 - 0
hostapd/config.h

@@ -378,6 +378,7 @@ struct hostapd_config {
 	int ieee80211n;
 	int ieee80211n;
 	int ht_op_mode_fixed;
 	int ht_op_mode_fixed;
 	u16 ht_capab;
 	u16 ht_capab;
+	int secondary_channel;
 #endif /* CONFIG_IEEE80211N */
 #endif /* CONFIG_IEEE80211N */
 };
 };
 
 

+ 5 - 3
hostapd/hostapd.conf

@@ -380,8 +380,10 @@ wme_ac_vo_acm=0
 
 
 # ht_capab: HT capabilities (list of flags)
 # ht_capab: HT capabilities (list of flags)
 # LDPC coding capability: [LDPC] = supported
 # 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]
 # Spatial Multiplexing (SM) Power Save: [SMPS-STATIC] or [SMPS-DYNAMIC]
 #	(SMPS disabled if neither is set)
 #	(SMPS disabled if neither is set)
 # HT-greenfield: [GF] (disabled if not 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)
 # DSSS/CCK Mode in 40 MHz: [DSSS_CCK-40] = allowed (not allowed if not set)
 # PSMP support: [PSMP] (disabled if not set)
 # PSMP support: [PSMP] (disabled if not set)
 # L-SIG TXOP protection support: [LSIG-TXOP-PROT] (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 ##################################
 ##### IEEE 802.1X-2004 related configuration ##################################
 
 

+ 5 - 0
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;
 	oper = (struct ieee80211_ht_operation *) pos;
 	os_memset(oper, 0, sizeof(*oper));
 	os_memset(oper, 0, sizeof(*oper));
 
 
+	oper->control_chan = hapd->iconf->channel;
 	oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode);
 	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);
 	pos += sizeof(*oper);
 
 

+ 3 - 5
src/common/ieee802_11_defs.h

@@ -495,10 +495,6 @@ struct ht_cap_ie {
 } STRUCT_PACKED;
 } 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_20     0
 #define REC_TRANS_CHNL_WIDTH_ANY    1
 #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_20MHZ_HT_STA_ASSOCED    2
 #define OP_MODE_MIXED                   3
 #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_REC_TRANS_CHNL_WIDTH		((u8) BIT(2))
 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY		((u8) BIT(4))
 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY		((u8) BIT(4))