From be3cf6a602896e1940fcd3bacc8836b3fe5cf05f Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Fri, 19 Feb 2021 16:04:58 +0530 Subject: [PATCH] qcacld-3.0: Add INI param to read MAC address from MAC cfg file Currently, Driver reads MAC address from MAC cfg file if it is present. Kernel has a timeout of 60secs and userspace tries to loop till the file is read if it is during the boot. So this will result in dsc transaction timeout if the MAC cfg file is not present in the device. To avoid this, add INI parameter to read this MAC cfg file and enable it only when the MAC cfg file is present in the device. Change-Id: I0bd9c089b6077534a07cb68deb07feb6064a5b88 CRs-Fixed: 2877424 --- core/hdd/inc/hdd_config.h | 21 +++++++++++++++++++++ core/hdd/inc/wlan_hdd_cfg.h | 1 + core/hdd/src/wlan_hdd_cfg.c | 5 +++++ core/hdd/src/wlan_hdd_main.c | 2 ++ 4 files changed, 29 insertions(+) diff --git a/core/hdd/inc/hdd_config.h b/core/hdd/inc/hdd_config.h index e8974e48fb16..e1819cac4045 100644 --- a/core/hdd/inc/hdd_config.h +++ b/core/hdd/inc/hdd_config.h @@ -771,6 +771,26 @@ struct dhcp_server { 0, \ "enable/disable MAC address provisioning feature") +/* + * + * read_mac_addr_from_mac_file - Use/ignore MAC address from mac cfg file + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used whether to configure MAC address from the cfg file or not + * + * Supported Feature: STA/SAP/P2P + * + * Usage: External + * + * + */ +#define CFG_READ_MAC_ADDR_FROM_MAC_FILE CFG_INI_BOOL( \ + "read_mac_addr_from_mac_file", \ + 0, \ + "Use/ignore MAC address from cfg file") + /* * * provisioned_intf_pool - It is bit mask value of Interfaces @@ -1808,6 +1828,7 @@ enum host_log_level { CFG(CFG_NB_COMMANDS_RATE_LIMIT) \ CFG(CFG_HDD_DOT11_MODE) \ CFG(CFG_ENABLE_DISABLE_CHANNEL) \ + CFG(CFG_READ_MAC_ADDR_FROM_MAC_FILE) \ CFG(CFG_SAR_CONVERSION) \ CFG(CFG_WOW_DISABLE) \ CFG(CFG_ENABLE_HOST_MODULE_LOG_LEVEL) \ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 081f231b805d..a81d4e66ceb7 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -267,6 +267,7 @@ struct hdd_config { uint32_t sta_stats_cache_expiry_time; #endif int icmp_req_to_fw_mark_interval; + bool read_mac_addr_from_mac_file; }; /** diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index b67aafa0356e..63593e0f419a 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -241,6 +241,11 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; + if (!hdd_ctx->config->read_mac_addr_from_mac_file) { + hdd_debug("Reading MAC address from MAC file is not enabled."); + return QDF_STATUS_E_FAILURE; + } + memset(mac_table, 0, sizeof(mac_table)); status = request_firmware(&fw, WLAN_MAC_FILE, hdd_ctx->parent_dev); if (status) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index b831551da0e0..a3545b0e1f5c 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -12525,6 +12525,8 @@ static void hdd_cfg_params_init(struct hdd_context *hdd_ctx) hdd_sar_cfg_update(config, psoc); hdd_init_qmi_stats(config, psoc); hdd_club_ll_stats_in_get_sta_cfg_update(config, psoc); + config->read_mac_addr_from_mac_file = + cfg_get(psoc, CFG_READ_MAC_ADDR_FROM_MAC_FILE); } struct hdd_context *hdd_context_create(struct device *dev)