浏览代码

qcacld-3.0: Update logic to get proper channel width for SAP

While processing START SAP req, Host calls wlan_sap_get_concurrent_bw
to calculate SAP BW based on the concurrent channel & STA DFS channel.
The below issues are present due to current logic to calculate SAP BW
in this API:
1. In the case of standalone SAP, this API returns SAP bandwidth as
   80 MHz always, this results in standalone SAP will never come up in
   other BWs.
2. In the case of non-DBS HW, the host is not considering the value of
   INI "g_sta_sap_scc_on_dfs_chan", the value is defined by the enum
   PM_AP_DFS_MASTER_MODE.

By considering the value of STA DFS channel, HW mode, and INI
g_sta_sap_scc_on_dfs_chan, modify the logic to calculate concurrent
as well as standalone SAP BW in API wlan_sap_get_concurrent_bw.

Change-Id: Id521893feb9b6173efc2704f37dfa59f405655e2
CRs-Fixed: 3363394
abhinav kumar 2 年之前
父节点
当前提交
bb899849e1
共有 2 个文件被更改,包括 61 次插入40 次删除
  1. 2 1
      core/sap/src/sap_api_link_cntl.c
  2. 59 39
      core/sap/src/sap_module.c

+ 2 - 1
core/sap/src/sap_api_link_cntl.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -140,6 +140,7 @@ void sap_config_acs_result(mac_handle_t mac_handle,
 		wlan_sap_get_concurrent_bw(mac_ctx->pdev, mac_ctx->psoc,
 					   sap_ctx->acs_cfg->pri_ch_freq,
 					   ch_params.ch_width);
+	sap_debug("new_ch_width:%d", new_ch_width);
 	ch_params.ch_width = new_ch_width;
 
 	wlan_reg_set_channel_params_for_pwrmode(

+ 59 - 39
core/sap/src/sap_module.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -617,6 +617,7 @@ enum phy_ch_width wlan_sap_get_concurrent_bw(struct wlan_objmgr_pdev *pdev,
 	bool sta_present, is_con_chan_dfs = false, is_con_sta_indoor = false;
 	uint8_t sta_vdev_id;
 	uint8_t sta_sap_scc_on_dfs_chnl;
+	bool is_hw_dbs_capable = false;
 
 	if (WLAN_REG_IS_24GHZ_CH_FREQ(con_ch_freq))
 		return CH_WIDTH_20MHZ;
@@ -630,6 +631,8 @@ enum phy_ch_width wlan_sap_get_concurrent_bw(struct wlan_objmgr_pdev *pdev,
 							&sta_ch_width);
 	if (sta_present) {
 		sta_chan_width = policy_mgr_get_ch_width(sta_ch_width);
+		sap_debug("sta_chan_width:%d, channel_width:%d",
+			  sta_chan_width, channel_width);
 		if (wlan_reg_is_dfs_for_freq(pdev, con_ch_freq) ||
 		    sta_chan_width == CH_WIDTH_160MHZ)
 			is_con_chan_dfs = true;
@@ -638,56 +641,73 @@ enum phy_ch_width wlan_sap_get_concurrent_bw(struct wlan_objmgr_pdev *pdev,
 			is_con_sta_indoor = true;
 	}
 
-	if (!policy_mgr_is_hw_dbs_capable(psoc))
-		goto sap_ch_width_check;
+	policy_mgr_get_sta_sap_scc_on_dfs_chnl(psoc, &sta_sap_scc_on_dfs_chnl);
+	is_hw_dbs_capable = policy_mgr_is_hw_dbs_capable(psoc);
+	sap_debug("sta_sap_scc_on_dfs_chnl:%d, is_hw_dbs_capable:%d",
+		  sta_sap_scc_on_dfs_chnl, is_hw_dbs_capable);
 
-	if (is_con_chan_dfs) {
+	if (!is_hw_dbs_capable)
+		goto dfs_master_mode_check;
+
+	/*
+	 * In indoor concurrency cases, limit the channel width with the STA
+	 * interface bandwidth. Since, only the bonded channels are active
+	 * channels.
+	 */
+	if (is_con_sta_indoor) {
 		channel_width = QDF_MIN(sta_chan_width, channel_width);
+		sap_debug("STA + SAP on indoor channels");
+		return channel_width;
+	} else if (is_con_chan_dfs) {
+		channel_width = QDF_MIN(sta_chan_width, channel_width);
+		sap_debug("STA + SAP on dfs channels");
+		goto dfs_master_mode_check;
+	} else {
+		/* Handle "DBS + active channel" concurrency/standalone SAP */
+		sap_debug("STA + SAP/GO or standalone SAP on active channel");
+		if (sta_present)
+			return  QDF_MAX(sta_chan_width, CH_WIDTH_80MHZ);
+		return channel_width;
+	}
 
-		if (sta_present && channel_width == CH_WIDTH_160MHZ)
-			channel_width = CH_WIDTH_80MHZ;
+dfs_master_mode_check:
+	/* Handle "DBS/non-DBS + dfs channels" concurrency */
+	if (sta_sap_scc_on_dfs_chnl == PM_STA_SAP_ON_DFS_MASTER_MODE_FLEX) {
+		if (sta_present) {
+			sap_debug("STA+SAP/GO: limit the SAP channel width");
+			return QDF_MIN(sta_chan_width, channel_width);
+		}
 
-		policy_mgr_get_sta_sap_scc_on_dfs_chnl(
-					psoc, &sta_sap_scc_on_dfs_chnl);
-		if (sta_sap_scc_on_dfs_chnl ==
-					PM_STA_SAP_ON_DFS_MASTER_MODE_FLEX) {
+		sap_debug("Standalone SAP/GO: set BW coming in start req");
+		return channel_width;
+	} else if (sta_sap_scc_on_dfs_chnl ==
+		   PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED) {
+		if (sta_present) {
+			sap_debug("STA present: Limit the SAP channel width");
+			channel_width = QDF_MIN(sta_chan_width, channel_width);
 			return channel_width;
-		} else if (sta_sap_scc_on_dfs_chnl ==
-				PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED) {
-			if (sta_present)
-				return channel_width;
-			/*
-			 * sta_sap_scc_on_dfs_chnl = 1, DFS master is disabled.
-			 * If STA not present (SAP single), the SAP (160Mhz) is
-			 * not allowed on DFS, so limit SAP to 80Mhz.
-			 */
-			return QDF_MIN(channel_width, CH_WIDTH_80MHZ);
 		}
 		/*
-		 * sta_sap_scc_on_dfs_chnl = 0, not allow STA+SAP SCC
-		 * on DFS. Limit SAP to 80Mhz if STA present.
+		 * sta_sap_scc_on_dfs_chnl = 1, DFS master is disabled.
+		 * If STA not present (SAP single), the SAP (160Mhz) is
+		 * not allowed on DFS, so limit SAP to 80Mhz.
 		 */
-		if (sta_present)
-			return QDF_MIN(channel_width, CH_WIDTH_80MHZ);
-
-		return channel_width;
-	} else if (is_con_sta_indoor) {
-		sap_debug("Indoor STA channel width is %d", sta_chan_width);
-		return QDF_MIN(channel_width, sta_chan_width);
+		sap_debug("Limit Standalone SAP/GO to 80Mhz");
+		return QDF_MIN(channel_width, CH_WIDTH_80MHZ);
 	}
 
-sap_ch_width_check:
-
-	/* if no STA present return max of BW and 80MHZ */
-	if (!sta_present)
-		return CH_WIDTH_80MHZ;
+	/*
+	 * sta_sap_scc_on_dfs_chnl = 0, not allow STA+SAP SCC on DFS.
+	 * Limit SAP to 80Mhz if STA present.
+	 */
+	if (sta_present) {
+		sap_debug("STA present, Limit SAP/GO to 80Mhz");
+		return QDF_MIN(channel_width, CH_WIDTH_80MHZ);
+	}
 
-	/* if STA not on DFS return max of BW and 80MHZ */
-	if (!is_con_chan_dfs)
-		return  QDF_MAX(sta_chan_width, CH_WIDTH_80MHZ);
+	sap_debug("Single SAP/GO: set BW coming in SAP/GO start req");
+	return channel_width;
 
-	/* If sta channel is DFS return min of 80 and STA BW */
-	return QDF_MIN(sta_chan_width, CH_WIDTH_80MHZ);
 }
 
 uint32_t wlan_sap_get_vht_ch_width(struct sap_context *sap_ctx)