Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3e7ed97 authored by Vinod Kumar Myadam's avatar Vinod Kumar Myadam Committed by Madan Koyyalamudi
Browse files

qcacld-3.0: Don't allow GO/GC+GO/GC+STA on the same band

Add support to allow/disallow three port combinations on
same band based on PCL table

Change-Id: Id2e9ad7d17bab6ea0aff6913b25f0eb330dc6c13
CRs-Fixed: 3028527
parent 23f539a6
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -3752,4 +3752,18 @@ QDF_STATUS policy_mgr_check_mon_concurrency(struct wlan_objmgr_psoc *psoc);
bool policy_mgr_is_sta_chan_valid_for_connect_and_roam(
				struct wlan_objmgr_pdev *pdev,
				qdf_freq_t freq);
/**
 * policy_mgr_is_3rd_conn_on_same_band_allowed() - Check the third connection
 * on same band allowed or not
 * list for third connection
 * @psoc: PSOC object information
 * @mode: Device mode
 *
 * This function checks whether to allow third connection on same band or not
 * based on pcl table
 *
 * Return: TRUE/FALSE
 */
bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
						 enum policy_mgr_con_mode mode);
#endif /* __WLAN_POLICY_MGR_API_H */
+33 −41
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-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
@@ -2770,35 +2770,37 @@ bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc,
}

/**
 * policy_mgr_is_multi_ap_plus_sta_3vif_conc() - Check multiple AP plus STA
 * concurrency
 * @mode1: policy_mgr_con_mode of connection 1
 * @mode2: policy_mgr_con_mode of connection 2
 * @mode2: policy_mgr_con_mode of connection 3
 * policy_mgr_is_3rd_conn_on_same_band() - Check whether 3rd connection is on
 * same band or not
 * @ch_freq: channel frequency
 *
 * Check the 3vif concurrency is SAP(GO)+SAP(GO)+STA or not based on
 * connection mode.
 * Check the existing two connection are in same band or not. If it is in
 * same band then check the 3rd connection is also in same band or not
 *
 * Return: True/False
 */
static bool policy_mgr_is_multi_ap_plus_sta_3vif_conc(
	enum policy_mgr_con_mode mode1, enum policy_mgr_con_mode mode2,
	enum policy_mgr_con_mode mode3)
static bool policy_mgr_is_3rd_conn_on_same_band(uint32_t ch_freq)
{
	if (mode1 == PM_STA_MODE &&
	    (mode2 == PM_SAP_MODE || mode2 == PM_P2P_GO_MODE) &&
	    (mode3 == PM_SAP_MODE || mode3 == PM_P2P_GO_MODE))
		return true;
	if (mode2 == PM_STA_MODE &&
	    (mode1 == PM_SAP_MODE || mode1 == PM_P2P_GO_MODE) &&
	    (mode3 == PM_SAP_MODE || mode3 == PM_P2P_GO_MODE))
		return true;
	if (mode3 == PM_STA_MODE &&
	    (mode1 == PM_SAP_MODE || mode1 == PM_P2P_GO_MODE) &&
	    (mode2 == PM_SAP_MODE || mode2 == PM_P2P_GO_MODE))
		return true;
	bool ret = false;

	return false;
	if (((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) &&
	    (WLAN_REG_IS_24GHZ_CH_FREQ
	    (pm_conc_connection_list[0].freq)) &&
	    (WLAN_REG_IS_24GHZ_CH_FREQ
	    (pm_conc_connection_list[1].freq))) ||
	    (((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)) ||
	    (WLAN_REG_IS_6GHZ_CHAN_FREQ(ch_freq))) &&
	    ((WLAN_REG_IS_5GHZ_CH_FREQ
	    (pm_conc_connection_list[0].freq)) ||
	    (WLAN_REG_IS_6GHZ_CHAN_FREQ
	    (pm_conc_connection_list[0].freq))) &&
	    ((WLAN_REG_IS_5GHZ_CH_FREQ
	    (pm_conc_connection_list[1].freq)) ||
	    (WLAN_REG_IS_6GHZ_CHAN_FREQ
	    (pm_conc_connection_list[1].freq))))) {
		ret = true;
	}
	return ret;
}

/**
@@ -2874,16 +2876,8 @@ bool policy_mgr_allow_new_home_channel(
					policy_mgr_rl_debug("don't allow 3rd home channel on same MAC");
					status = false;
				}
			} else if (((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) &&
				   (WLAN_REG_IS_24GHZ_CH_FREQ
				   (pm_conc_connection_list[0].freq)) &&
				   (WLAN_REG_IS_24GHZ_CH_FREQ
				   (pm_conc_connection_list[1].freq))) ||
				   ((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)) &&
				   (WLAN_REG_IS_5GHZ_CH_FREQ
				   (pm_conc_connection_list[0].freq)) &&
				   (WLAN_REG_IS_5GHZ_CH_FREQ
				   (pm_conc_connection_list[1].freq)))) {
			} else if (policy_mgr_is_3rd_conn_on_same_band(
				   ch_freq)) {
				policy_mgr_rl_debug("don't allow 3rd home channel on same MAC");
				status = false;
			}
@@ -2909,12 +2903,10 @@ bool policy_mgr_allow_new_home_channel(
				 * and therefore a 3rd connection with the
				 * same MAC is possible.
				 */
			} else if (wlan_reg_is_same_band_freqs(ch_freq,
					pm_conc_connection_list[0].freq) &&
				   policy_mgr_is_multi_ap_plus_sta_3vif_conc(
					pm_conc_connection_list[0].mode,
					pm_conc_connection_list[1].mode,
					mode)) {
			} else if (policy_mgr_is_3rd_conn_on_same_band(
				   ch_freq) &&
				   !(policy_mgr_is_3rd_conn_on_same_band_allowed(
				   psoc, mode))) {
				policy_mgr_rl_debug("don't allow 3rd home channel on same MAC - sta existing");
				status = false;
			}
+80 −1
Original line number Diff line number Diff line
/*
 * 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
@@ -2787,3 +2787,82 @@ bool policy_mgr_is_sta_chan_valid_for_connect_and_roam(

	return true;
}

bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
						 enum policy_mgr_con_mode mode)
{
	enum policy_mgr_pcl_type pcl = PM_NONE;
	enum policy_mgr_conc_priority_mode conc_system_pref = 0;
	enum policy_mgr_two_connection_mode third_index = 0;
	struct policy_mgr_psoc_priv_obj *pm_ctx;
	bool ret = false;

	pm_ctx = policy_mgr_get_context(psoc);
	if (!pm_ctx) {
		policy_mgr_err("context is NULL");
			return false;
	}

	policy_mgr_debug("pref:%d requested mode:%d",
			 pm_ctx->cur_conc_system_pref, mode);

	switch (pm_ctx->cur_conc_system_pref) {
	case 0:
		conc_system_pref = PM_THROUGHPUT;
		break;
	case 1:
		conc_system_pref = PM_POWERSAVE;
		break;
	case 2:
		conc_system_pref = PM_LATENCY;
		break;
	default:
		policy_mgr_err("unknown cur_conc_system_pref value %d",
			       pm_ctx->cur_conc_system_pref);
		break;
	}

	third_index = policy_mgr_get_third_connection_pcl_table_index(psoc);
	if (PM_MAX_TWO_CONNECTION_MODE == third_index) {
		policy_mgr_err(
			"couldn't find index for 3rd connection pcl table");
			return false;
	}
	if (policy_mgr_is_hw_dbs_capable(psoc) == true) {
		pcl = (*third_connection_pcl_dbs_table)
			[third_index][mode][conc_system_pref];
	} else {
		pcl = (*third_connection_pcl_non_dbs_table)
			[third_index][mode][conc_system_pref];
	}

	policy_mgr_debug("pcl for third connection is %d", pcl);
	switch (pcl) {
	case PM_SCC_CH:
	case PM_SCC_CH_24G:
	case PM_SCC_CH_5G:
	case PM_24G_SCC_CH:
	case PM_5G_SCC_CH:
	case PM_SCC_ON_5_SCC_ON_24_24G:
	case PM_SCC_ON_5_SCC_ON_24_5G:
	case PM_SCC_ON_24_SCC_ON_5_24G:
	case PM_SCC_ON_24_SCC_ON_5_5G:
	case PM_SCC_ON_5_SCC_ON_24:
	case PM_SCC_ON_24_SCC_ON_5:
	case PM_24G_SCC_CH_SBS_CH:
	case PM_24G_SCC_CH_SBS_CH_5G:
	case PM_MCC_CH:
	case PM_MCC_CH_24G:
	case PM_MCC_CH_5G:
	case PM_24G_MCC_CH:
	case PM_5G_MCC_CH:
	case PM_24G_SBS_CH_MCC_CH:
		ret = true;
		break;
	default:
		policy_mgr_debug("Not in SCC case");
		ret = false;
		break;
	}
	return ret;
}