From 5d32743e83694432bd99496784e1454002c7b3f1 Mon Sep 17 00:00:00 2001 From: Harprit Chhabada Date: Tue, 12 Mar 2019 17:46:20 -0700 Subject: [PATCH] qcacmn: Implement API to support GETBAND functionality Add GETBAND support by implementing API, ucfg_reg_get_band Change-Id: I91fabb367c53aed5ae13a0bb4272965f925d44bd CRs-Fixed: 2412777 --- umac/regulatory/core/src/reg_utils.c | 32 +++++++++++++++++++ umac/regulatory/core/src/reg_utils.h | 15 +++++++-- .../dispatcher/inc/wlan_reg_ucfg_api.h | 14 ++++++-- .../dispatcher/src/wlan_reg_ucfg_api.c | 14 ++++---- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index c05e92ac1c..9da552c855 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -403,6 +403,38 @@ QDF_STATUS reg_set_band(struct wlan_objmgr_pdev *pdev, return status; } +QDF_STATUS reg_get_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + struct wlan_objmgr_psoc *psoc; + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("pdev reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) { + reg_err("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc_priv_obj = reg_get_psoc_obj(psoc); + if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) { + reg_err("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + reg_debug("getting band_info: %d", pdev_priv_obj->band_capability); + *band = pdev_priv_obj->band_capability; + + return QDF_STATUS_SUCCESS; +} + #ifdef DISABLE_CHANNEL_LIST QDF_STATUS reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev) { diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index 8f18dae788..2e2a8882fa 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -56,21 +56,30 @@ bool reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch); /** * reg_set_band() - Sets the band information for the PDEV * @pdev: The physical dev to set the band for - * @band: The set band parameters to configure for the pysical device + * @band: The set band parameters to configure for the physical device * * Return: QDF_STATUS */ QDF_STATUS reg_set_band(struct wlan_objmgr_pdev *pdev, enum band_info band); +/** + * reg_get_band() - Get the band information for the PDEV + * @pdev: The physical dev to get the band for + * @band: The band parameters of the physical device + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_get_band(struct wlan_objmgr_pdev *pdev, enum band_info *band); + #ifdef DISABLE_CHANNEL_LIST /** - * reg_restore_cached_channels() - Cache the current state of the channles + * reg_restore_cached_channels() - Cache the current state of the channels * @pdev: The physical dev to cache the channels for */ QDF_STATUS reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev); /** - * reg_cache_channel_state() - Cache the current state of the channles + * reg_cache_channel_state() - Cache the current state of the channels * @pdev: The physical dev to cache the channels for * @channel_list: List of the channels for which states needs to be cached * @num_channels: Number of channels in the list diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index 18129167ca..bb493e9180 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -31,12 +31,22 @@ typedef QDF_STATUS (*reg_event_cb)(void *status_struct); /** * ucfg_reg_set_band() - Sets the band information for the PDEV * @pdev: The physical pdev to set the band for - * @band: The set band parameter to configure for the pysical device + * @band: The set band parameter to configure for the physical device * * Return: QDF_STATUS */ QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev, - enum band_info band); + enum band_info band); + +/** + * ucfg_reg_get_band() - Gets the band information for the PDEV + * @pdev: The physical pdev to get the band for + * @band: The band parameter of the physical device + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_get_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band); /** * ucfg_reg_notify_sap_event() - Notify regulatory domain for sap event diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 5db92700f9..e4fde34a26 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -117,19 +117,19 @@ QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_pdev *pdev, } #ifdef CONFIG_REG_CLIENT -/** - * ucfg_reg_set_band() - Sets the band information for the PDEV - * @pdev: The physical pdev to set the band for - * @band: The set band parameter to configure for the pysical device - * - * Return: QDF_STATUS - */ + QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev, enum band_info band) { return reg_set_band(pdev, band); } +QDF_STATUS ucfg_reg_get_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band) +{ + return reg_get_band(pdev, band); +} + /** * ucfg_reg_notify_sap_event() - Notify regulatory domain for sap event * @pdev: The physical dev to set the band for