Jelajahi Sumber

qcacld-3.0: Compare mac id for ap-sta force scc

Consider SBS mode and 6GHZ, can't force scc only by band.
for example: 1 port on 5G, another on 6G,  they may be on same
MAC, may be not. Just compare mac id from connection list
directly.

Change-Id: I5bfc9cd14b058a6a4f402c0e2d2f9ae7da8287fb
CRs-Fixed: 2646499
Jianmin Zhu 5 tahun lalu
induk
melakukan
d682eb4e28

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

@@ -3350,6 +3350,7 @@ bool policy_mgr_dump_channel_list(uint32_t len,
 /**
  * policy_mgr_is_restart_sap_required() - check whether sap need restart
  * @psoc: psoc pointer
+ * @vdev_id: vdev id
  * @freq: sap current freq
  * @scc_mode: mcc to scc switch mode
  *
@@ -3359,6 +3360,7 @@ bool policy_mgr_dump_channel_list(uint32_t len,
  * Return: True or false
  */
 bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id,
 					qdf_freq_t freq,
 					tQDF_MCC_TO_SCC_SWITCH_MODE scc_mode);
 

+ 17 - 9
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -4320,13 +4320,14 @@ bool policy_mgr_get_5g_scc_prefer(
 }
 
 bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id,
 					qdf_freq_t freq,
 					tQDF_MCC_TO_SCC_SWITCH_MODE scc_mode)
 {
-	uint32_t i;
+	uint8_t i, mac = 0;
 	bool restart_required = false;
 	bool is_sta_p2p_cli;
-	bool is_same_band;
+	bool is_same_mac;
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 	struct policy_mgr_conc_connection_info *connection;
 
@@ -4342,19 +4343,26 @@ bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc,
 
 	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
 	connection = pm_conc_connection_list;
+	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
+		if (connection[i].vdev_id == vdev_id) {
+			mac = connection[i].mac;
+			break;
+		}
+	}
+	if (i == MAX_NUMBER_OF_CONC_CONNECTIONS) {
+		policy_mgr_err("Invalid vdev id: %d", vdev_id);
+		return false;
+	}
+
 	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
 		is_sta_p2p_cli =
 			connection[i].in_use &&
 			(connection[i].mode == PM_STA_MODE ||
 			connection[i].mode == PM_P2P_CLIENT_MODE);
+		is_same_mac = connection[i].mac == mac &&
+			      connection[i].freq != freq;
 
-		is_same_band =
-			wlan_reg_is_24ghz_ch_freq(freq) ==
-			wlan_reg_is_24ghz_ch_freq(connection[i].freq) &&
-			connection[i].freq != freq;
-
-		if (is_sta_p2p_cli &&
-		    (is_same_band || !policy_mgr_is_dbs_enable(psoc))) {
+		if (is_sta_p2p_cli && is_same_mac) {
 			restart_required = true;
 			break;
 		}

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

@@ -3204,7 +3204,9 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 
 	ucfg_policy_mgr_get_mcc_scc_switch(hdd_ctx->psoc,
 					   &mcc_to_scc_switch);
-	if (!policy_mgr_is_restart_sap_required(hdd_ctx->psoc, *ch_freq,
+	policy_mgr_get_chan_by_session_id(psoc, vdev_id, &sap_ch_freq);
+	if (!policy_mgr_is_restart_sap_required(hdd_ctx->psoc, vdev_id,
+						sap_ch_freq,
 						mcc_to_scc_switch)) {
 		wlansap_context_put(sap_context);
 		hdd_debug("SAP needn't restart");
@@ -3218,7 +3220,6 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 	 * Need to take care of 3 port cases with 2 STA iface in future.
 	 */
 	intf_ch_freq = wlansap_check_cc_intf(sap_context);
-	policy_mgr_get_chan_by_session_id(psoc, vdev_id, &sap_ch_freq);
 	hdd_debug("sap_vdev %d intf_ch: %d, orig freq: %d",
 		  vdev_id, intf_ch_freq, sap_ch_freq);
 	if (QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION !=