From 46458e7d229d0d780398b7cd53dcbc5c5c22675e Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Fri, 13 Nov 2020 11:18:32 -0800 Subject: [PATCH] qcacmn: Add API to check for passive frequency Add new API to check if frequency is passive or not. The API checks the channel flag against REGULATORY_CHAN_NO_IR. Change-Id: I166a7a79517f81c23ff933d2657ef3f4c551c082 CRs-fixed: 2822205 --- umac/regulatory/core/src/reg_services_common.c | 9 +++++++++ umac/regulatory/core/src/reg_services_common.h | 10 ++++++++++ .../regulatory/dispatcher/inc/wlan_reg_services_api.h | 11 +++++++++++ .../regulatory/dispatcher/src/wlan_reg_services_api.c | 6 ++++++ 4 files changed, 36 insertions(+) diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index e9ecb213996c..df87272fb868 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -3936,6 +3936,15 @@ bool reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) return ch_state == CHANNEL_STATE_DISABLE; } + +bool reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) +{ + uint32_t chan_flags; + + chan_flags = reg_get_channel_flags_for_freq(pdev, freq); + + return chan_flags & REGULATORY_CHAN_NO_IR; +} #endif /* CONFIG_CHAN_FREQ_API */ uint8_t reg_get_max_tx_power(struct wlan_objmgr_pdev *pdev) diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 6f4ac6d220e8..90a433a35a4d 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -1137,6 +1137,16 @@ reg_get_5g_bonded_channel_for_freq(struct wlan_objmgr_pdev *pdev, * Return: True if channel state is disabled, else false */ bool reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); + +/** + * reg_is_passive_for_freq() - Check if the given channel frequency is in + * passive state + * @pdev: Pointer to pdev + * @freq: Channel frequency + * + * Return: True if channel state is passive, else false + */ +bool reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); #endif /* CONFIG_CHAN_FREQ_API */ /** diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 1ef9220b029c..55721cf4b56b 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -1318,6 +1318,17 @@ bool wlan_reg_is_passive_or_disable_for_freq(struct wlan_objmgr_pdev *pdev, bool wlan_reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); +/** + * wlan_reg_is_passive_for_freq() - Check the channel flags to see if the + * passive flag is set + * @pdev: pdev ptr + * @freq: Channel center frequency + * + * Return: true or false + */ +bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, + qdf_freq_t freq); + /** * wlan_reg_chan_to_band() - Get band from channel number * @chan_num: channel number diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 84bcb0a8f848..1e3ac7e0fa91 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -1009,6 +1009,12 @@ bool wlan_reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, return reg_is_disable_for_freq(pdev, freq); } +bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, + qdf_freq_t freq) +{ + return reg_is_passive_for_freq(pdev, freq); +} + QDF_STATUS wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, struct channel_power *ch_list,