From 816b503c44d9bc9bb250da30d603e9abf849b5e6 Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Sirasanagandla Date: Mon, 5 Aug 2019 21:35:14 +0530 Subject: [PATCH] qcacmn: Ignore regulatory offload indication from FW Based on the ini "ignore_fw_reg_offload_ind" ignore regulatory offload indicatin from fw. Change-Id: Ia95b5bdda6ee1fcc2b07f28f997a7c80afcbc32b CRs-Fixed: 2533001 --- target_if/regulatory/src/target_if_reg.c | 9 +++++++ target_if/regulatory/src/target_if_reg_11d.c | 9 +++++++ .../lmac_if/inc/wlan_lmac_if_def.h | 1 + .../lmac_if/src/wlan_lmac_if.c | 3 +++ umac/regulatory/core/src/reg_priv_objs.h | 2 ++ .../regulatory/core/src/reg_services_common.c | 26 +++++++++++++++++++ .../regulatory/core/src/reg_services_common.h | 18 +++++++++++++ .../dispatcher/inc/wlan_reg_tgt_api.h | 9 +++++++ .../dispatcher/inc/wlan_reg_ucfg_api.h | 9 +++++++ .../dispatcher/src/wlan_reg_tgt_api.c | 5 ++++ .../dispatcher/src/wlan_reg_ucfg_api.c | 5 ++++ 11 files changed, 96 insertions(+) diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index df774a552b35..8cd570bcb758 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -52,10 +52,19 @@ static inline uint32_t get_chan_list_cc_event_id(void) static bool tgt_if_regulatory_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc) { wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + struct wlan_lmac_if_reg_rx_ops *reg_rx_ops; + + reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); if (!wmi_handle) return false; + if (reg_rx_ops->reg_ignore_fw_reg_offload_ind && + reg_rx_ops->reg_ignore_fw_reg_offload_ind(psoc)) { + target_if_debug("User disabled regulatory offload from ini"); + return 0; + } + return wmi_service_enabled(wmi_handle, wmi_service_regulatory_db); } diff --git a/target_if/regulatory/src/target_if_reg_11d.c b/target_if/regulatory/src/target_if_reg_11d.c index 0b5e02b63ab5..c857868d380b 100644 --- a/target_if/regulatory/src/target_if_reg_11d.c +++ b/target_if/regulatory/src/target_if_reg_11d.c @@ -28,10 +28,19 @@ bool tgt_if_regulatory_is_11d_offloaded(struct wlan_objmgr_psoc *psoc) { wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + struct wlan_lmac_if_reg_rx_ops *reg_rx_ops; + + reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); if (!wmi_handle) return false; + if (reg_rx_ops->reg_ignore_fw_reg_offload_ind && + reg_rx_ops->reg_ignore_fw_reg_offload_ind(psoc)) { + target_if_debug("Ignore fw reg 11d offload indication"); + return 0; + } + return wmi_service_enabled(wmi_handle, wmi_service_11d_offload); } diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 6de724f453ff..07ff75b3e56d 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -984,6 +984,7 @@ struct wlan_lmac_if_reg_rx_ops { bool dfs_enable); QDF_STATUS (*reg_modify_pdev_chan_range)(struct wlan_objmgr_pdev *pdev); + bool (*reg_ignore_fw_reg_offload_ind)(struct wlan_objmgr_psoc *psoc); }; #ifdef CONVERGED_P2P_ENABLE diff --git a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c index 0ed3c5085403..72dbef41517c 100644 --- a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c +++ b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c @@ -316,6 +316,9 @@ static void wlan_lmac_if_umac_reg_rx_ops_register( rx_ops->reg_rx_ops.reg_modify_pdev_chan_range = wlan_reg_modify_pdev_chan_range; + + rx_ops->reg_rx_ops.reg_ignore_fw_reg_offload_ind = + tgt_reg_ignore_fw_reg_offload_ind; } #ifdef CONVERGED_P2P_ENABLE diff --git a/umac/regulatory/core/src/reg_priv_objs.h b/umac/regulatory/core/src/reg_priv_objs.h index 35eec2f3abd3..b0f08b08d07f 100644 --- a/umac/regulatory/core/src/reg_priv_objs.h +++ b/umac/regulatory/core/src/reg_priv_objs.h @@ -86,6 +86,7 @@ struct chan_change_cbk_entry { * country update is pending for pdev (phy_id). * @world_country_pending: In this array, element[phy_id] is true if any world * country update is pending for pdev (phy_id). + * @ignore_fw_reg_offload_ind: Ignore FW reg offload indication */ struct wlan_regulatory_psoc_priv_obj { struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP]; @@ -104,6 +105,7 @@ struct wlan_regulatory_psoc_priv_obj { bool dfs_enabled; enum band_info band_capability; bool indoor_chan_enabled; + bool ignore_fw_reg_offload_ind; bool enable_11d_supp_original; bool enable_11d_supp; bool is_11d_offloaded; diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index 5f3a820f97ed..17ad8a4248e6 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -3383,3 +3383,29 @@ enum reg_wifi_band reg_freq_to_band(uint16_t freq) return REG_BAND_UNKNOWN; } #endif /* CONFIG_CHAN_FREQ_API */ + +QDF_STATUS reg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_PSOC_REG_OBJ(psoc_reg)) { + reg_err("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc_reg->ignore_fw_reg_offload_ind = true; + return QDF_STATUS_SUCCESS; +} + +bool reg_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_PSOC_REG_OBJ(psoc_reg)) + return false; + + return psoc_reg->ignore_fw_reg_offload_ind; +} + diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index e2767ee66367..fac28cdcda32 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -905,4 +905,22 @@ uint16_t reg_min_chan_freq(void); uint16_t reg_max_chan_freq(void); #endif /* CONFIG_CHAN_FREQ_API */ + +/** + * reg_set_ignore_fw_reg_offload_ind() - Set if regdb offload indication + * needs to be ignored + * @psoc: Pointer to psoc + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); + +/** + * reg_get_ignore_fw_reg_offload_ind() - Check whether regdb offload indication + * needs to be ignored + * + * @psoc: Pointer to psoc + */ +bool reg_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); + #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h index f4ab54c935b6..3ec2aa538137 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h @@ -65,4 +65,13 @@ QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, */ QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc, struct ch_avoid_ind_type *ch_avoid_evnt); + +/** + * tgt_reg_ignore_fw_reg_offload_ind() - Check whether regdb offload indication + * from FW needs to be ignored. + * + * @psoc: Pointer to psoc + */ +bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); + #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index 4ed60544a935..05b003d7f2a5 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -371,4 +371,13 @@ struct wlan_psoc_host_hal_reg_capabilities_ext *ucfg_reg_get_hal_reg_cap( QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, uint16_t phy_cnt); + +/** + * ucfg_set_ignore_fw_reg_offload_ind() - API to set ignore regdb offload ind + * @psoc: psoc ptr + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); + #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c b/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c index 190fee0f9cda..1af955d97333 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c @@ -70,3 +70,8 @@ QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc, { return reg_process_ch_avoid_event(psoc, ch_avoid_evnt); } + +bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc) +{ + return reg_get_ignore_fw_reg_offload_ind(psoc); +} diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 68e809d502f7..8ed6fb2cffa8 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -328,3 +328,8 @@ void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev) reg_restore_cached_channels(pdev); } #endif + +QDF_STATUS ucfg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc) +{ + return reg_set_ignore_fw_reg_offload_ind(psoc); +}