diff options
| author | Ashish Kumar Dhanotiya <adhanoti@codeaurora.org> | 2018-02-15 17:53:01 +0530 |
|---|---|---|
| committer | Ashish Kumar Dhanotiya <adhanoti@codeaurora.org> | 2018-02-19 19:41:44 +0530 |
| commit | 0a380b2e46658dfada9991cf2d29a494a6858b75 (patch) | |
| tree | a33d760361e4abca66072e7972e829d667cef9e7 | |
| parent | d13099d5c73c35dacd871a817ea8fac8a54c1f12 (diff) | |
qcacld-2.0: Update MAC addresses only once
Propagation from qcacld-3.0 to qcacld-2.0
Currently MAC addresses are getting updated at the time of rx_ready
indication and at the time of initialization.
First time addressses are updated in when first rx_ready indication
comes in hdd_update_tgt_cfg api.
At the time of initialization mac addresses are getting updated
from platform driver or MAC.bin. If platform driver and MAC.bin
doesn't provide the addresses then addresses updated in
hdd_update_tgt_cfg are used.
If platform driver or MAC.bin provides MAC addresses then those
addresses must be used. Currently on every rx_ready indication
MAC addresses are updated, losing the addresses provided by
platform driver or MAC.bin.
Move the complete address management logic to
hdd_initialize_mac_address api so the MAC addresses will be
updated only once.
Change-Id: I64910063e51c08916c9835e547ef1d7b58de33e6
CRs-Fixed: 2190513
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_main.h | 1 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_main.c | 23 |
2 files changed, 20 insertions, 4 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index ba12da36ab51..84f936bbc95f 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -2133,6 +2133,7 @@ struct hdd_context_s #endif /* flag to show whether moniotr mode is enabled */ bool is_mon_enable; + v_MACADDR_t hw_macaddr; }; /*--------------------------------------------------------------------------- diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 631f435377da..066046c4c891 100644 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -9395,13 +9395,12 @@ void hdd_update_tgt_cfg(void *context, void *param) if (!vos_is_macaddr_zero(&cfg->hw_macaddr)) { - hdd_update_macaddr(hdd_ctx->cfg_ini, cfg->hw_macaddr); + vos_mem_copy(&hdd_ctx->hw_macaddr, &cfg->hw_macaddr, + VOS_MAC_ADDR_SIZE); } else { hddLog(VOS_TRACE_LEVEL_ERROR, - "%s: Invalid MAC passed from target, using MAC from ini file" - MAC_ADDRESS_STR, __func__, - MAC_ADDR_ARRAY(hdd_ctx->cfg_ini->intfMacAddr[0].bytes)); + "%s: HW MAC is zero", __func__); } hdd_ctx->target_fw_version = cfg->target_fw_version; @@ -16199,6 +16198,22 @@ static int hdd_initialize_mac_address(hdd_context_t *hdd_ctx) WLAN_MAC_FILE, status); return -EIO; } + return 0; + } + + if (!vos_is_macaddr_zero(&hdd_ctx->hw_macaddr)) { + hdd_update_macaddr(hdd_ctx->cfg_ini, hdd_ctx->hw_macaddr); + } else { + tSirMacAddr customMacAddr; + + hddLog(VOS_TRACE_LEVEL_ERROR, + "%s: Invalid MAC passed from target, using MAC from ini" + MAC_ADDRESS_STR, __func__, + MAC_ADDR_ARRAY(hdd_ctx->cfg_ini->intfMacAddr[0].bytes)); + vos_mem_copy(&customMacAddr, + &hdd_ctx->cfg_ini->intfMacAddr[0].bytes, + VOS_MAC_ADDR_SIZE); + sme_SetCustomMacAddr(customMacAddr); } return 0; } |
