Kaynağa Gözat

qcacld-3.0: Add support to configure the 80MHz preference

Add support to configure the 80MHz preference over 160MHz
connection when the peer AP is capable of 160MHz 2x2 mode.

Change-Id: I67d62a358141c470176667429f982053d162c4f8
CRs-Fixed: 1075815
Kiran Kumar Lokere 8 yıl önce
ebeveyn
işleme
1aa9c9ac12

+ 9 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -1098,6 +1098,14 @@ typedef enum {
 #define CFG_VHT_ENABLE_2x2_CAP_FEATURE_MAX     (1)
 #define CFG_VHT_ENABLE_2x2_CAP_FEATURE_DEFAULT (0)
 
+/* 0 - Connects in 160MHz 1x1 when AP is 160MHz 2x2
+ * 1 - Connects in 80MHz 2x2 when AP is 160MHz 2x2
+ */
+#define CFG_STA_PREFER_80MHZ_OVER_160MHZ         "gStaPrefer80MHzOver160MHz"
+#define CFG_STA_PREFER_80MHZ_OVER_160MHZ_MIN     (0)
+#define CFG_STA_PREFER_80MHZ_OVER_160MHZ_MAX     (1)
+#define CFG_STA_PREFER_80MHZ_OVER_160MHZ_DEFAULT (1)
+
 /*
  * NSS cfg bit definition.
  * STA          BIT[0:1]
@@ -4225,6 +4233,7 @@ struct hdd_config {
 	bool enable_go_cts2self_for_sta;
 	uint32_t tx_aggregation_size;
 	uint32_t rx_aggregation_size;
+	bool sta_prefer_80MHz_over_160MHz;
 };
 
 #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))

+ 7 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -2029,6 +2029,13 @@ REG_TABLE_ENTRY g_registry_table[] = {
 		     CFG_VDEV_TYPE_NSS_2G_MIN,
 		     CFG_VDEV_TYPE_NSS_2G_MAX),
 
+	REG_VARIABLE(CFG_STA_PREFER_80MHZ_OVER_160MHZ, WLAN_PARAM_Integer,
+		     struct hdd_config, sta_prefer_80MHz_over_160MHz,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_STA_PREFER_80MHZ_OVER_160MHZ_DEFAULT,
+		     CFG_STA_PREFER_80MHZ_OVER_160MHZ_MIN,
+		     CFG_STA_PREFER_80MHZ_OVER_160MHZ_MAX),
+
 	REG_VARIABLE(CFG_VDEV_TYPE_NSS_5G, WLAN_PARAM_Integer,
 		     struct hdd_config, vdev_type_nss_5g,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -7458,6 +7458,8 @@ static int hdd_features_init(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter)
 
 	/* FW capabilities received, Set the Dot11 mode */
 	sme_setdef_dot11mode(hdd_ctx->hHal);
+	sme_set_prefer_80MHz_over_160MHz(hdd_ctx->hHal,
+			hdd_ctx->config->sta_prefer_80MHz_over_160MHz);
 
 
 	if (hdd_ctx->config->fIsImpsEnabled)

+ 1 - 0
core/mac/inc/ani_global.h

@@ -978,6 +978,7 @@ typedef struct sAniSirGlobal {
 	int8_t first_scan_bucket_threshold;
 	enum auth_tx_ack_status auth_ack_status;
 	uint8_t user_configured_nss;
+	bool sta_prefer_80MHz_over_160MHz;
 } tAniSirGlobal;
 
 typedef enum {

+ 2 - 1
core/mac/src/pe/lim/lim_prop_exts_utils.c

@@ -224,7 +224,8 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie,
 		 * AP supports Nss > 1 in 160MHz mode then connect the STA
 		 * in 2x2 80MHz mode instead of connecting in 160MHz mode.
 		 */
-		if (vht_ch_wd > WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) {
+		if ((vht_ch_wd > WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) &&
+				mac_ctx->sta_prefer_80MHz_over_160MHz) {
 			if (!(IS_VHT_NSS_1x1(beacon_struct->VHTCaps.txMCSMap))
 					&&
 			   (!IS_VHT_NSS_1x1(beacon_struct->VHTCaps.rxMCSMap)))

+ 2 - 0
core/sme/inc/sme_api.h

@@ -1323,4 +1323,6 @@ QDF_STATUS sme_encrypt_decrypt_msg(tHalHandle hal,
  * Return: QDF_STATUS
  */
 QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal);
+void sme_set_prefer_80MHz_over_160MHz(tHalHandle hal,
+		bool sta_prefer_80MHz_over_160MHz);
 #endif /* #if !defined( __SME_API_H ) */

+ 12 - 0
core/sme/src/common/sme_api.c

@@ -11212,6 +11212,18 @@ void sme_get_command_q_status(tHalHandle hHal)
 
 	return;
 }
+/**
+ * sme_set_prefer_80MHz_over_160MHz() - API to set sta_prefer_80MHz_over_160MHz
+ * @hal:           The handle returned by macOpen
+ * @sta_prefer_80MHz_over_160MHz: sta_prefer_80MHz_over_160MHz config param
+ */
+void sme_set_prefer_80MHz_over_160MHz(tHalHandle hal,
+		bool sta_prefer_80MHz_over_160MHz)
+{
+	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
+	mac_ctx->sta_prefer_80MHz_over_160MHz = sta_prefer_80MHz_over_160MHz;
+}
+
 #ifdef WLAN_FEATURE_DSRC
 /**
  * sme_set_dot11p_config() - API to set the 802.11p config