浏览代码

qcacld-3.0: Check unsafe channel again after bandwidth selected

In LTE coex SAP restart scenario, currently SAP new channel is selected
base on 20M bandwidth, and channel bandwidth is determined after
channel frequency determined, if new channel bandwidth is greater than
20M, it is possible channel boundary fall in unsafe channel range,
because bonded channel is fixed with different bandwidth.

If select new primary channel with determined bandwidth, it would
violate MCC to SCC limitation if concurrency, to make it simple,
just shrink SAP bandwidth to 20M if check unsafe channel failed.

Change-Id: Id9bc5e6e807c0446138ca816bc3ada22443fe7a2
CRs-Fixed: 3005333
Will Huang 3 年之前
父节点
当前提交
7ceef833da
共有 1 个文件被更改,包括 56 次插入3 次删除
  1. 56 3
      components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

+ 56 - 3
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -2474,9 +2474,55 @@ sap_restart:
 		}
 	}
 }
-#endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */
 
-#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
+/**
+ * policy_mgr_check_bw_with_unsafe_chan_freq() - valid SAP channel bw against
+ *						 unsafe channel list
+ * @psoc: PSOC object information
+ * @center_freq: SAP channel center frequency
+ * @ch_width: SAP channel width
+ *
+ * Return: true if no unsafe channel fall in SAP channel bandwidth range,
+ *	   false otherwise
+ */
+static bool
+policy_mgr_check_bw_with_unsafe_chan_freq(struct wlan_objmgr_psoc *psoc,
+					  qdf_freq_t center_freq,
+					  enum phy_ch_width ch_width)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	uint32_t freq_start, freq_end, bw, i, unsafe_chan_freq;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return true;
+	}
+
+	if (ch_width <= CH_WIDTH_20MHZ || !center_freq)
+		return true;
+
+	if (!pm_ctx->unsafe_channel_count)
+		return true;
+
+	bw = wlan_reg_get_bw_value(ch_width);
+	freq_start = center_freq - bw / 2;
+	freq_end = center_freq + bw / 2;
+
+	for (i = 0; i < pm_ctx->unsafe_channel_count; i++) {
+		unsafe_chan_freq = pm_ctx->unsafe_channel_list[i];
+		if (unsafe_chan_freq > freq_start &&
+		    unsafe_chan_freq < freq_end) {
+			policy_mgr_debug("unsafe ch freq %d is in range %d-%d",
+					 unsafe_chan_freq,
+					 freq_start,
+					 freq_end);
+			return false;
+		}
+	}
+	return true;
+}
+
 /**
  * policy_mgr_change_sap_channel_with_csa() - Move SAP channel using (E)CSA
  * @psoc: PSOC object information
@@ -2511,13 +2557,20 @@ void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc,
 			ch_width = ch_params.ch_width;
 	}
 
+	if (!policy_mgr_check_bw_with_unsafe_chan_freq(psoc,
+						       ch_params.mhz_freq_seg0,
+						       ch_width)) {
+		policy_mgr_info("SAP bw shrink to 20M for unsafe");
+		ch_width = CH_WIDTH_20MHZ;
+	}
+
 	if (pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb) {
 		policy_mgr_info("SAP change change without restart");
 		pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb(psoc,
 				vdev_id, ch_freq, ch_width, forced);
 	}
 }
-#endif
+#endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */
 
 QDF_STATUS policy_mgr_wait_for_connection_update(struct wlan_objmgr_psoc *psoc)
 {