From 317a6bd0d3551be90cc06abdbaf1f92e9b98ccf8 Mon Sep 17 00:00:00 2001 From: bings Date: Mon, 22 Apr 2019 14:53:18 +0800 Subject: qcacld-2.0: Clear up DFS rules for multiple interfaces Currently if STA connects to a DFS channel AP, SAP fails to start in non-DFS channel. To fix this issue, clear up DFS rules in sap_check_mcc_valid. For STA+SAP mode, if STA exists, SAP can't start in DFS channel. For SAP+SAP mode, DFS channel can't be selected if they work in MCC mode. Change-Id: I8697fe46b43b79f0380b18b1ebf919cbb318e97b CRs-Fixed: 2438589 --- CORE/SAP/src/sapFsm.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/CORE/SAP/src/sapFsm.c b/CORE/SAP/src/sapFsm.c index 254f5a1b7b7c..08a49ef178f9 100644 --- a/CORE/SAP/src/sapFsm.c +++ b/CORE/SAP/src/sapFsm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -2357,20 +2357,32 @@ static VOS_STATUS sap_check_mcc_valid( /* * 3. Don't support MCC on DFS channel. */ - if (chan_cnt > 0) { - for (j = 0; j < chan_cnt; j++) { - if (channels[j] != 0 - && vos_nv_getChannelEnabledState(channels[j]) - == NV_CHANNEL_DFS) { - VOS_TRACE( VOS_MODULE_ID_SAP, - VOS_TRACE_LEVEL_ERROR, - "%s: dfs not support in MCC dfs chan %d" - "(chan %d band %d)", - __func__, channels[j], chan, band); + for (i = 0; i < session_count; i++) { + info = &sessions[i]; + if (info->och != 0 && + vos_nv_getChannelEnabledState(info->och) == + NV_CHANNEL_DFS) { + if ((info->con_mode == VOS_STA_SAP_MODE || + info->con_mode == VOS_P2P_GO_MODE) && + info->och != chan) { + VOS_TRACE(VOS_MODULE_ID_SAP, + VOS_TRACE_LEVEL_ERROR, + "SAP+SAP MCC DFS not support"); + return VOS_STATUS_E_FAILURE; + } + if ((info->con_mode == VOS_STA_MODE || + info->con_mode == VOS_P2P_CLIENT_MODE) && + vos_nv_getChannelEnabledState(chan) == + NV_CHANNEL_DFS + ) { + VOS_TRACE(VOS_MODULE_ID_SAP, + VOS_TRACE_LEVEL_ERROR, + "STA+SAP SAP can't start in DFS ch"); return VOS_STATUS_E_FAILURE; } } } + return VOS_STATUS_SUCCESS; } -- cgit v1.2.3