diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index 5ecafa307ba4..5de5353a1663 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -3306,10 +3306,11 @@ uint32_t policy_mgr_get_dfs_beaconing_session_id( conn_index++) { conn_info = &pm_conc_connection_list[conn_index]; if (conn_info->in_use && - wlan_reg_chan_has_dfs_attribute_for_freq( - pm_ctx->pdev, conn_info->freq) && + WLAN_REG_IS_5GHZ_CH_FREQ(conn_info->freq) && + (conn_info->ch_flagext & (IEEE80211_CHAN_DFS | + IEEE80211_CHAN_DFS_CFREQ2)) && (conn_info->mode == PM_SAP_MODE || - conn_info->mode == PM_P2P_GO_MODE)) { + conn_info->mode == PM_P2P_GO_MODE)) { session_id = pm_conc_connection_list[conn_index].vdev_id; break; diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 559899b16efe..70e09bf55738 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -868,7 +868,8 @@ static __iw_softap_setparam(struct net_device *dev, } qdf_mem_zero(&radar, sizeof(radar)); - if (wlan_reg_is_dfs_for_freq(pdev, ap_ctx->operating_chan_freq)) + if (policy_mgr_get_dfs_beaconing_session_id(hdd_ctx->psoc) != + WLAN_UMAC_VDEV_ID_MAX) tgt_dfs_process_radar_ind(pdev, &radar); else hdd_debug("Ignore set radar, op ch_freq(%d) is not dfs", diff --git a/core/hdd/src/wlan_hdd_sysfs_radar.c b/core/hdd/src/wlan_hdd_sysfs_radar.c index ceb7ac4c00ae..24d3f3de442f 100644 --- a/core/hdd/src/wlan_hdd_sysfs_radar.c +++ b/core/hdd/src/wlan_hdd_sysfs_radar.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2021 The Linux Foundation. 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 above @@ -79,7 +79,8 @@ __hdd_sysfs_radar_store(struct net_device *net_dev, } qdf_mem_zero(&radar, sizeof(radar)); - if (wlan_reg_is_dfs_for_freq(pdev, ap_ctx->operating_chan_freq)) + if (policy_mgr_get_dfs_beaconing_session_id(hdd_ctx->psoc) != + WLAN_UMAC_VDEV_ID_MAX) tgt_dfs_process_radar_ind(pdev, &radar); else hdd_debug("Ignore set radar, op ch_freq(%d) is not dfs", diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index d0e9a15257ce..38206e6b52e5 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -425,6 +425,46 @@ static uint8_t sap_ch_params_to_bonding_channels( return nchannels; } +/** + * sap_operating_on_dfs() - check current sap operating on dfs + * @mac_ctx: mac ctx + * @sap_ctx: SAP context + * + * Return: true if any sub channel is dfs channel + */ +static +bool sap_operating_on_dfs(struct mac_context *mac_ctx, + struct sap_context *sap_ctx) +{ + uint8_t is_dfs = false; + struct csr_roam_profile *profile = + &sap_ctx->csr_roamProfile; + uint32_t chan_freq = profile->op_freq; + struct ch_params *ch_params = &profile->ch_params; + + if (WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq) || + WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq)) + return false; + if (ch_params->ch_width == CH_WIDTH_160MHZ) { + is_dfs = true; + } else if (ch_params->ch_width == CH_WIDTH_80P80MHZ) { + if (wlan_reg_is_passive_or_disable_for_freq( + mac_ctx->pdev, + chan_freq) || + wlan_reg_is_passive_or_disable_for_freq( + mac_ctx->pdev, + ch_params->mhz_freq_seg1 - 10)) + is_dfs = true; + } else { + if (wlan_reg_is_passive_or_disable_for_freq( + mac_ctx->pdev, + chan_freq)) + is_dfs = true; + } + + return is_dfs; +} + void sap_get_cac_dur_dfs_region(struct sap_context *sap_ctx, uint32_t *cac_duration_ms, uint32_t *dfs_region) @@ -2316,7 +2356,6 @@ static QDF_STATUS sap_fsm_handle_radar_during_cac(struct sap_context *sap_ctx, for (intf = 0; intf < SAP_MAX_NUM_SESSION; intf++) { struct sap_context *t_sap_ctx; - struct csr_roam_profile *profile; t_sap_ctx = mac_ctx->sap.sapCtxList[intf].sap_context; if (((QDF_SAP_MODE == @@ -2324,10 +2363,8 @@ static QDF_STATUS sap_fsm_handle_radar_during_cac(struct sap_context *sap_ctx, (QDF_P2P_GO_MODE == mac_ctx->sap.sapCtxList[intf].sapPersona)) && t_sap_ctx && t_sap_ctx->fsm_state != SAP_INIT) { - profile = &t_sap_ctx->csr_roamProfile; - if (!wlan_reg_is_passive_or_disable_for_freq( - mac_ctx->pdev, profile->op_freq)) - continue; + if (!sap_operating_on_dfs(mac_ctx, t_sap_ctx)) + continue; t_sap_ctx->is_chan_change_inprogress = true; /* * eSAP_DFS_CHANNEL_CAC_RADAR_FOUND: @@ -2668,13 +2705,14 @@ static QDF_STATUS sap_fsm_state_started(struct sap_context *sap_ctx, * no need to move them */ profile = &temp_sap_ctx->csr_roamProfile; - if (!wlan_reg_is_passive_or_disable_for_freq( - mac_ctx->pdev, profile->op_freq)) { + if (!sap_operating_on_dfs( + mac_ctx, temp_sap_ctx)) { sap_debug("vdev %d freq %d (state %d) is not DFS or disabled so continue", temp_sap_ctx->sessionId, profile->op_freq, - wlan_reg_get_channel_state_for_freq(mac_ctx->pdev, - profile->op_freq)); + wlan_reg_get_channel_state_for_freq( + mac_ctx->pdev, + profile->op_freq)); continue; } sap_debug("vdev %d switch freq %d -> %d",