Przeglądaj źródła

qcacld-3.0: Consider original BW setting for SAP force SCC

At present, we select max possible band width for SAP in concurrent of
STA+SAP. If STA is working on 160Mhz, the SAP will follow the same
BW as STA. But customer doesn't want to move SAP to 160Mhz
if the original SAP starting BW is 80Mhz since the 160Mhz SAP will
have DFS limitations.
This change avoid 160Mhz selection for 5G SAP force SCC if
1. the channel switch request is not user initiated and
2. the original BW setting is not 160Mhz

Change-Id: I25a7c2ba6679eab8e3884e5b2332d7ed163de12e
CRs-Fixed: 3068284
Liangwei Dong 3 lat temu
rodzic
commit
aa03983d64

+ 13 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 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
@@ -2629,6 +2630,13 @@ void policy_mgr_do_go_plus_go_force_scc(struct wlan_objmgr_psoc *psoc,
 					uint32_t ch_width)
 {
 	uint8_t total_connection;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return;
+	}
 
 	total_connection = policy_mgr_mode_specific_connection_count(
 						psoc, PM_P2P_GO_MODE, NULL);
@@ -2637,6 +2645,11 @@ void policy_mgr_do_go_plus_go_force_scc(struct wlan_objmgr_psoc *psoc,
 
 	/* If any p2p disconnected, don't do csa */
 	if (total_connection > 1) {
+		if (pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason)
+			pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason(
+				psoc, vdev_id,
+				CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL);
+
 		policy_mgr_change_sap_channel_with_csa(psoc, vdev_id,
 						       ch_freq, ch_width, true);
 	}

+ 1 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -3402,6 +3402,7 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 		hdd_err("sap_context is invalid");
 		return QDF_STATUS_E_FAILURE;
 	}
+	wlan_hdd_set_sap_csa_reason(psoc, vdev_id, csa_reason);
 
 	/* Initialized ch_width to CH_WIDTH_MAX */
 	ch_params.ch_width = CH_WIDTH_MAX;

+ 22 - 2
core/sap/src/sap_module.c

@@ -754,6 +754,7 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx,
 	sap_ctx->isCacEndNotified = false;
 	sap_ctx->is_chan_change_inprogress = false;
 	sap_ctx->phyMode = config->SapHw_mode;
+	sap_ctx->csa_reason = CSA_REASON_UNKNOWN;
 
 	/* Set the BSSID to your "self MAC Addr" read the mac address
 		from Configuation ITEM received from HDD */
@@ -1215,6 +1216,21 @@ wlansap_get_target_eht_phy_ch_width(void)
 }
 #endif /* WLAN_FEATURE_11BE */
 
+static enum phy_ch_width
+wlansap_5g_original_bw_validate(
+	struct sap_context *sap_context,
+	uint32_t chan_freq,
+	enum phy_ch_width ch_width)
+{
+	if (sap_context->csa_reason != CSA_REASON_USER_INITIATED &&
+	    WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq) &&
+	    ch_width >= CH_WIDTH_160MHZ &&
+	    sap_context->ch_width_orig < CH_WIDTH_160MHZ)
+		ch_width = CH_WIDTH_80MHZ;
+
+	return ch_width;
+}
+
 enum phy_ch_width
 wlansap_get_csa_chanwidth_from_phymode(struct sap_context *sap_context,
 				       uint32_t chan_freq,
@@ -1239,6 +1255,8 @@ wlansap_get_csa_chanwidth_from_phymode(struct sap_context *sap_context,
 		ch_width = CH_WIDTH_20MHZ;
 	} else {
 		ch_width = wlansap_get_max_bw_by_phymode(sap_context);
+		ch_width = wlansap_5g_original_bw_validate(
+				sap_context, chan_freq, ch_width);
 		concurrent_bw = wlan_sap_get_concurrent_bw(
 				mac->pdev, mac->psoc, chan_freq,
 				ch_width);
@@ -1252,11 +1270,13 @@ wlansap_get_csa_chanwidth_from_phymode(struct sap_context *sap_context,
 	ch_width = ch_params.ch_width;
 	if (tgt_ch_params)
 		*tgt_ch_params = ch_params;
-	sap_nofl_debug("freq %d bw %d (phymode %d, con bw %d, tgt bw %d)",
+	sap_nofl_debug("csa freq %d bw %d (phymode %d con bw %d tgt bw %d orig %d reason %d)",
 		       chan_freq, ch_width,
 		       sap_context->phyMode,
 		       concurrent_bw,
-		       tgt_ch_params ? tgt_ch_params->ch_width : CH_WIDTH_MAX);
+		       tgt_ch_params ? tgt_ch_params->ch_width : CH_WIDTH_MAX,
+		       sap_context->ch_width_orig,
+		       sap_context->csa_reason);
 
 	return ch_width;
 }