From 1b3a5355004a406dd1873cedc89cb9ce4a59f8df Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Sirasanagandla Date: Mon, 5 Aug 2019 21:33:03 +0530 Subject: [PATCH] qcacld-3.0: Ignore regulatory offload indication from FW Based on the ini "ignore_fw_reg_offload_ind" ignore regulatory offload indicatin from fw. Change-Id: I6e20f2100eeac8e93baa5c5d3f3d1c8b33356aed CRs-Fixed: 2532989 --- components/mlme/core/src/wlan_mlme_main.c | 4 +++ components/mlme/dispatcher/inc/cfg_mlme_reg.h | 33 +++++++++++++++++++ .../mlme/dispatcher/inc/wlan_mlme_api.h | 11 +++++++ .../dispatcher/inc/wlan_mlme_public_struct.h | 2 ++ .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 15 +++++++++ .../mlme/dispatcher/src/wlan_mlme_api.c | 14 ++++++++ core/hdd/inc/wlan_hdd_regulatory.h | 12 ++++++- core/hdd/src/wlan_hdd_main.c | 2 ++ core/hdd/src/wlan_hdd_regulatory.c | 17 ++++++++++ 9 files changed, 109 insertions(+), 1 deletion(-) diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 7ee226470f..f7d4889c94 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -2283,6 +2283,10 @@ static void mlme_init_reg_cfg(struct wlan_objmgr_psoc *psoc, reg->enable_11d_in_world_mode = cfg_get(psoc, CFG_ENABLE_11D_IN_WORLD_MODE); reg->scan_11d_interval = cfg_get(psoc, CFG_SCAN_11D_INTERVAL); + reg->ignore_fw_reg_offload_ind = cfg_get( + psoc, + CFG_IGNORE_FW_REG_OFFLOAD_IND); + qdf_uint8_array_parse(cfg_default(CFG_VALID_CHANNEL_LIST), channel_list, CFG_VALID_CHANNEL_LIST_LEN, diff --git a/components/mlme/dispatcher/inc/cfg_mlme_reg.h b/components/mlme/dispatcher/inc/cfg_mlme_reg.h index 502226923f..bc06bc034d 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_reg.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_reg.h @@ -242,6 +242,38 @@ "", \ "country code") +/* + * + * ignore_fw_reg_offload_ind - If set, Ignore the FW offload indication + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to ignore regdb offload indication from FW and + * regulatory will be treated as non offload. + * There is a case where FW is sending the offload indication in + * service ready event but not sending the cc list event + * WMI_REG_CHAN_LIST_CC_EVENTID and because of this driver is not + * able to populate the channel list. To address this issue, this ini + * is added. If this ini is enabled, regulatory will always be treated as + * non offload solution. + * + * This ini should only be enabled to circumvent the above mentioned firmware + * bug. + * + * Related: None + * + * Supported Feature: STA/AP + * + * Usage: External + * + * + */ +#define CFG_IGNORE_FW_REG_OFFLOAD_IND CFG_INI_BOOL( \ + "ignore_fw_reg_offload_ind", \ + 0, \ + "Ignore Regulatory offloads Indication from FW") + #define CFG_REG_ALL \ CFG(CFG_SELF_GEN_FRM_PWR) \ CFG(CFG_ENABLE_11D_IN_WORLD_MODE) \ @@ -251,6 +283,7 @@ CFG(CFG_SCAN_11D_INTERVAL) \ CFG(CFG_VALID_CHANNEL_LIST) \ CFG(CFG_COUNTRY_CODE) \ + CFG(CFG_IGNORE_FW_REG_OFFLOAD_IND) \ CFG_SAP_AVOID_ACS_FREQ_LIST_ALL #endif /* CFG_MLME_REG_H__ */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index a5c21f323e..b5e0a10a07 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -2257,4 +2257,15 @@ mlme_get_peer_phymode(struct wlan_objmgr_psoc *psoc, uint8_t *mac, */ QDF_STATUS mlme_set_tgt_wpa3_roam_cap(struct wlan_objmgr_psoc *psoc, uint32_t akm_bitmap); +/** + * wlan_mlme_get_ignore_fw_reg_offload_ind() - Get the + * ignore_fw_reg_offload_ind ini + * @psoc: pointer to psoc object + * @disabled: output pointer to hold user config + * + * Return: QDF Status + */ +QDF_STATUS +wlan_mlme_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc, + bool *disabled); #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index b3a3e6bd4d..543043d784 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -2107,6 +2107,7 @@ struct wlan_mlme_mwc { * @avoid_acs_freq_list: List of the frequencies which need to be avoided * during acs * @avoid_acs_freq_list_num: Number of the frequencies to be avoided during acs + * @ignore_fw_reg_offload_ind: Ignore fw regulatory offload indication */ struct wlan_mlme_reg { uint32_t self_gen_frm_pwr; @@ -2124,6 +2125,7 @@ struct wlan_mlme_reg { uint16_t avoid_acs_freq_list[CFG_VALID_CHANNEL_LIST_LEN]; uint8_t avoid_acs_freq_list_num; #endif + bool ignore_fw_reg_offload_ind; }; /** diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 40e1a1a48d..7a070b6152 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -3920,4 +3920,19 @@ bool ucfg_mlme_validate_full_roam_scan_period(uint32_t full_roam_scan_period); * Return: True if roam_scan_period is in expected range, false otherwise. */ bool ucfg_mlme_validate_scan_period(uint32_t roam_scan_period); +/** + * ucfg_mlme_get_ignore_fw_reg_offload_ind() - Get the + * ignore_fw_reg_offload_ind ini + * @psoc: pointer to psoc object + * @disabled: output pointer to hold user config + * + * Return: QDF Status + */ +static inline QDF_STATUS +ucfg_mlme_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc, + bool *disabled) +{ + return wlan_mlme_get_ignore_fw_reg_offload_ind(psoc, disabled); +} + #endif /* _WLAN_MLME_UCFG_API_H_ */ diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 54cdd05266..b9431ee72f 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -3542,3 +3542,17 @@ QDF_STATUS mlme_set_tgt_wpa3_roam_cap(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } + +QDF_STATUS +wlan_mlme_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc, + bool *disabled) +{ + struct wlan_mlme_psoc_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_obj(psoc); + if (!mlme_obj) + return QDF_STATUS_E_FAILURE; + + *disabled = mlme_obj->cfg.reg.ignore_fw_reg_offload_ind; + return QDF_STATUS_SUCCESS; +} diff --git a/core/hdd/inc/wlan_hdd_regulatory.h b/core/hdd/inc/wlan_hdd_regulatory.h index 87493f5e48..3fe46d95bc 100644 --- a/core/hdd/inc/wlan_hdd_regulatory.h +++ b/core/hdd/inc/wlan_hdd_regulatory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 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 @@ -91,4 +91,14 @@ void hdd_modify_indoor_channel_state_flags( struct regulatory_channel *cds_chan, enum channel_enum chan_enum, int chan_num, bool disable); +/** + * hdd_update_regdb_offload_config() - Update regdb offload disable ini + * for regulatory component. + * + * @psoc: psoc ptr + * + * Return: None + */ +void hdd_update_regdb_offload_config(struct hdd_context *hdd_ctx); + #endif diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 46e0ad3d8d..5d5c5b6ef8 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -15090,6 +15090,8 @@ int hdd_update_config(struct hdd_context *hdd_ctx) ret = hdd_update_cds_config(hdd_ctx); ret = hdd_update_user_config(hdd_ctx); + hdd_update_regdb_offload_config(hdd_ctx); + return ret; } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index ec38cb55bd..f7a7fe4b47 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1492,3 +1492,20 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy) return 0; } #endif + +void hdd_update_regdb_offload_config(struct hdd_context *hdd_ctx) +{ + QDF_STATUS status; + bool ignore_fw_reg_offload_ind = false; + + status = ucfg_mlme_get_ignore_fw_reg_offload_ind( + hdd_ctx->psoc, + &ignore_fw_reg_offload_ind); + if (!ignore_fw_reg_offload_ind) { + hdd_debug("regdb offload is based on firmware capability"); + return; + } + + hdd_debug("Ignore regdb offload Indication from FW"); + ucfg_set_ignore_fw_reg_offload_ind(hdd_ctx->psoc); +}