Răsfoiți Sursa

qcacld-3.0: Add INI to configure sap default BW when do restart

Currently CH_WIDTH_MAX is set as default BW when sap do restart,
then apply some checking rules to get the final BW. It's possible
the final BW is greater than sap original BW. But a greater BW
isn't expected in some use cases where greater BW may introduce
some unexpected issues.
Add INI to configure sap original BW as default BW when do sap
restart as required.

Change-Id: Ie274a3eea73c2af9424a8b9ce21bee34eeaaef2e
CRs-Fixed: 3315486
Qun Zhang 2 ani în urmă
părinte
comite
c1640bd3b0

+ 23 - 1
components/cmn_services/policy_mgr/inc/cfg_policy_mgr.h

@@ -688,6 +688,27 @@ CFG_INI_BOOL("g_enable_sr_in_same_mac_conc", 1, \
 #define CFG_SPATIAL_REUSE
 #endif
 
+/*
+ * <ini>
+ * g_use_original_bw_for_sap_restart - Set sap default BW when do restart
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to set sap default BW when do restart.
+ * 0 - Use maximum BW as default BW
+ * 1 - Use sap original BW as default BW
+ *
+ * Supported Feature: SAP
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SAP_DEFAULT_BW_FOR_RESTART \
+CFG_INI_BOOL("g_use_original_bw_for_sap_restart", 0, \
+	     "Use SAP original bandwidth when do restart")
+
 #define CFG_POLICY_MGR_ALL \
 		CFG(CFG_MCC_TO_SCC_SWITCH) \
 		CFG(CFG_CONC_SYS_PREF) \
@@ -712,5 +733,6 @@ CFG_INI_BOOL("g_enable_sr_in_same_mac_conc", 1, \
 		CFG(CFG_P2P_GO_ENABLE_FORCE_SCC) \
 		CFG(CFG_PCL_BAND_PRIORITY) \
 		CFG(CFG_MULTI_SAP_ALLOWED_ON_SAME_BAND) \
-		CFG_SPATIAL_REUSE
+		CFG_SPATIAL_REUSE \
+		CFG(CFG_SAP_DEFAULT_BW_FOR_RESTART)
 #endif

+ 27 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -318,6 +318,33 @@ QDF_STATUS
 policy_mgr_get_multi_sap_allowed_on_same_band(struct wlan_objmgr_psoc *psoc,
 				bool *multi_sap_allowed_on_same_band);
 
+/**
+ * policy_mgr_set_original_bw_for_sap_restart() - to set use_sap_original_bw
+ * @psoc: pointer to psoc
+ * @use_sap_original_bw: value to be set
+ *
+ * This API is used to set use_sap_original_bw
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS
+policy_mgr_set_original_bw_for_sap_restart(struct wlan_objmgr_psoc *psoc,
+					   bool use_sap_original_bw);
+
+/**
+ * policy_mgr_get_original_bw_for_sap_restart() - to find out if sap original
+ * bw is used as default BW when do sap restart
+ * @psoc: pointer to psoc
+ * @use_sap_original_bw: value to be filled
+ *
+ * This API is used to find out whether sap original BW is used as default BW
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS
+policy_mgr_get_original_bw_for_sap_restart(struct wlan_objmgr_psoc *psoc,
+					   bool *use_sap_original_bw);
+
 /*
  * policy_mgr_get_connected_vdev_band_mask() - to get the connected vdev band
  * mask

+ 32 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -254,6 +254,38 @@ policy_mgr_get_multi_sap_allowed_on_same_band(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+policy_mgr_set_original_bw_for_sap_restart(struct wlan_objmgr_psoc *psoc,
+					   bool use_sap_original_bw)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("pm_ctx is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	pm_ctx->cfg.use_sap_original_bw = use_sap_original_bw;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+policy_mgr_get_original_bw_for_sap_restart(struct wlan_objmgr_psoc *psoc,
+					   bool *use_sap_original_bw)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("pm_ctx is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	*use_sap_original_bw = pm_ctx->cfg.use_sap_original_bw;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 static bool
 policy_mgr_update_dfs_master_dynamic_enabled(
 	struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)

+ 3 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -271,6 +271,8 @@ extern enum policy_mgr_conc_next_action
  * @multi_sap_allowed_on_same_band: Enable/Disable multi sap started
  *                                  on same band
  * @sr_in_same_mac_conc: Enable/Disable SR in same MAC concurrency
+ * @use_sap_original_bw: Enable/Disable sap original BW as default
+ *                       BW when do restart
  */
 struct policy_mgr_cfg {
 	uint8_t mcc_to_scc_switch;
@@ -299,6 +301,7 @@ struct policy_mgr_cfg {
 #ifdef WLAN_FEATURE_SR
 	bool sr_in_same_mac_conc;
 #endif
+	bool use_sap_original_bw;
 };
 
 /**

+ 2 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c

@@ -125,6 +125,8 @@ static QDF_STATUS policy_mgr_init_cfg(struct wlan_objmgr_psoc *psoc)
 	cfg->multi_sap_allowed_on_same_band =
 		cfg_get(psoc, CFG_MULTI_SAP_ALLOWED_ON_SAME_BAND);
 	policy_mgr_init_same_mac_conc_sr_status(psoc);
+	cfg->use_sap_original_bw =
+		cfg_get(psoc, CFG_SAP_DEFAULT_BW_FOR_RESTART);
 
 	return QDF_STATUS_SUCCESS;
 }

+ 7 - 2
core/hdd/src/wlan_hdd_hostapd.c

@@ -3593,6 +3593,7 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 	enum sap_csa_reason_code csa_reason =
 		CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL;
 	QDF_STATUS status;
+	bool use_sap_original_bw = false;
 
 	if (!ap_adapter) {
 		hdd_err("ap_adapter is NULL");
@@ -3632,8 +3633,12 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 	}
 	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;
+	policy_mgr_get_original_bw_for_sap_restart(psoc, &use_sap_original_bw);
+	if (use_sap_original_bw)
+		ch_params.ch_width = sap_context->ch_width_orig;
+	else
+		ch_params.ch_width = CH_WIDTH_MAX;
+
 	intf_ch_freq = wlansap_get_chan_band_restrict(sap_context, &csa_reason);
 	if (intf_ch_freq)
 		goto sap_restart;