Browse Source

qcacld-3.0: Limit STA connection in 80MHz BW for HE/VHT mode

Extend gStaPrefer80MHzOver160MHz ini to limit STA connection in
80MHz BW for HE/VHT mode. In case of XR use-case, higher
throughput is not needed but higher reliability is expected.
This ini helps in XR glass device to always connects in 80MHz.

Change-Id: Icefd2d54214351c04dd7420269c308cec2b5ae31
CRs-Fixed: 3117216
Vishal Miskin 3 years ago
parent
commit
24af7b3137

+ 7 - 2
components/mlme/dispatcher/inc/cfg_mlme_sta.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -149,13 +150,14 @@
  * <ini>
  * gStaPrefer80MHzOver160MHz - set sta preference to connect in 80HZ/160HZ
  * @Min: 0
- * @Max: 1
+ * @Max: 2
  * @Default: 0
  *
  * This ini is used to set sta preference to connect in 80HZ/160HZ
  *
  * 0 - Connects in 160MHz 1x1 when AP is 160MHz 2x2
  * 1 - Connects in 80MHz 2x2 when AP is 160MHz 2x2
+ * 2 - Always Connects in 80MHz when AP is 160MHz
  *
  * Related: NA
  *
@@ -165,9 +167,12 @@
  *
  * </ini>
  */
-#define CFG_STA_PREFER_80MHZ_OVER_160MHZ CFG_INI_BOOL( \
+#define CFG_STA_PREFER_80MHZ_OVER_160MHZ CFG_INI_UINT( \
 	"gStaPrefer80MHzOver160MHz", \
 	0, \
+	2, \
+	0, \
+	CFG_VALUE_OR_DEFAULT, \
 	"Sta preference to connect in 80HZ/160HZ")
 
 /*

+ 15 - 2
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -1579,6 +1579,19 @@ enum station_keepalive_method {
 	MLME_STA_KEEPALIVE_COUNT
 };
 
+/**
+ * enum station_prefer_bw - Station preferred bandwidth to connect AP
+ * @STA_PREFER_BW_DEFAULT: Station connects AP with its max bw capability.
+ * @STA_PREFER_BW_VHT80MHZ: Station connects in VHT 80MHz 2x2 when AP is in
+				160MHz 2x2
+ * @STA_PREFER_BW_80MHZ: Station connects in 80MHz when AP is in 160MHz
+ */
+enum station_prefer_bw {
+	STA_PREFER_BW_DEFAULT,
+	STA_PREFER_BW_VHT80MHZ,
+	STA_PREFER_BW_80MHZ
+};
+
 /**
  * struct wlan_mlme_sta_cfg - MLME STA configuration items
  * @sta_keep_alive_period:          Sends NULL frame to AP period
@@ -1591,8 +1604,8 @@ enum station_keepalive_method {
  * @fils_max_chan_guard_time:       Set maximum channel guard time
  * @current_rssi:                   Current rssi
  * @deauth_retry_cnt:               Deauth retry count
- * @ignore_peer_erp_info:           Ignore peer infrormation
  * @sta_prefer_80mhz_over_160mhz:   Set Sta preference to connect in 80HZ/160HZ
+ * @ignore_peer_erp_info:           Ignore peer infrormation
  * @enable_5g_ebt:                  Set default 5G early beacon termination
  * @deauth_before_connection:       Send deauth before connection or not
  * @enable_go_cts2self_for_sta:     Stop NOA and start using cts2self
@@ -1614,8 +1627,8 @@ struct wlan_mlme_sta_cfg {
 	uint8_t fils_max_chan_guard_time;
 	uint8_t current_rssi;
 	uint8_t deauth_retry_cnt;
+	uint8_t sta_prefer_80mhz_over_160mhz;
 	bool ignore_peer_erp_info;
-	bool sta_prefer_80mhz_over_160mhz;
 	bool enable_5g_ebt;
 	bool deauth_before_connection;
 	bool enable_go_cts2self_for_sta;

+ 21 - 5
core/mac/src/pe/lim/lim_prop_exts_utils.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -220,10 +221,13 @@ void lim_update_he_bw_cap_mcs(struct pe_session *session,
 			      tSirProbeRespBeacon *beacon)
 {
 	uint8_t is_80mhz;
+	uint8_t sta_prefer_80mhz_over_160mhz;
 
 	if (!session->he_capable)
 		return;
 
+	sta_prefer_80mhz_over_160mhz =
+		session->mac_ctx->mlme_cfg->sta.sta_prefer_80mhz_over_160mhz;
 	if ((session->opmode == QDF_STA_MODE ||
 	     session->opmode == QDF_P2P_CLIENT_MODE) &&
 	    beacon && beacon->he_cap.present) {
@@ -239,6 +243,13 @@ void lim_update_he_bw_cap_mcs(struct pe_session *session,
 				pe_debug("HE160 Rx/Tx MCS is not valid, falling back to 80MHz");
 				session->ch_width = CH_WIDTH_80MHZ;
 			}
+		} else if (sta_prefer_80mhz_over_160mhz ==
+				STA_PREFER_BW_80MHZ) {
+			is_80mhz = 1;
+			if (session->ch_width == CH_WIDTH_160MHZ) {
+				pe_debug("STA prferred HE80 over HE160, falling back to 80MHz");
+				session->ch_width = CH_WIDTH_80MHZ;
+			}
 		} else {
 			is_80mhz = 0;
 		}
@@ -482,6 +493,7 @@ void lim_extract_ap_capability(struct mac_context *mac_ctx, uint8_t *p_ie,
 	uint8_t chan_center_freq_seg1;
 	tDot11fIEVHTCaps *vht_caps;
 	uint8_t channel = 0;
+	uint8_t sta_prefer_80mhz_over_160mhz;
 	struct mlme_vht_capabilities_info *mlme_vht_cap;
 
 	beacon_struct = qdf_mem_malloc(sizeof(tSirProbeRespBeacon));
@@ -490,6 +502,8 @@ void lim_extract_ap_capability(struct mac_context *mac_ctx, uint8_t *p_ie,
 
 	*qos_cap = 0;
 	*uapsd = 0;
+	sta_prefer_80mhz_over_160mhz =
+		session->mac_ctx->mlme_cfg->sta.sta_prefer_80mhz_over_160mhz;
 
 	if (sir_parse_beacon_ie(mac_ctx, beacon_struct, p_ie,
 		(uint32_t) ie_len) != QDF_STATUS_SUCCESS) {
@@ -597,11 +611,13 @@ void lim_extract_ap_capability(struct mac_context *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) &&
-		    mac_ctx->mlme_cfg->sta.sta_prefer_80mhz_over_160mhz) {
-			if (!(IS_VHT_NSS_1x1(beacon_struct->VHTCaps.txMCSMap))
-					&&
-			   (!IS_VHT_NSS_1x1(beacon_struct->VHTCaps.rxMCSMap)))
+		if (vht_ch_wd > WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) {
+			if (sta_prefer_80mhz_over_160mhz == STA_PREFER_BW_80MHZ)
+				vht_ch_wd = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
+			else if ((sta_prefer_80mhz_over_160mhz ==
+						STA_PREFER_BW_VHT80MHZ) &&
+			  (!(IS_VHT_NSS_1x1(beacon_struct->VHTCaps.txMCSMap)) &&
+			    (!IS_VHT_NSS_1x1(beacon_struct->VHTCaps.rxMCSMap))))
 				vht_ch_wd = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
 		}
 		/*