From e4d8644dac338132a4e4d68b4fc85a522aa9b768 Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Fri, 23 Jun 2017 16:57:00 +0530 Subject: [PATCH] qcacld-3.0: Populate the remaining addresses from tha wlan_mac.bin address Currently if only one address is provided in wlan_mac.bin, it is updated for interface wlan0. It will be copied to interface p2p0 if a specific configuration is present. softap0 retains its mac address either generated from serial number or given through Firmware ready event. This doesn't guarentee a unique mac address to both these interfaces. Regardless of configuration Both softap0 and p2p0 should have a unique mac address with locally administered bit set. Change-Id: I64299f5c2e2376c8dbdb26ea34ba0187d5d1f28d CRs-Fixed: 2066086 --- core/hdd/inc/wlan_hdd_main.h | 1 + core/hdd/src/wlan_hdd_cfg.c | 4 ++++ core/hdd/src/wlan_hdd_main.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index f6519fe0d9c7..167520c056e1 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -2226,6 +2226,7 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, bool reinit); int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool ftm_mode); int hdd_start_adapter(hdd_adapter_t *adapter); +void hdd_populate_random_mac_addr(hdd_context_t *hdd_ctx, uint32_t num); /** * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 84bd712f7cf3..d5a3e3c951a1 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -6154,6 +6154,7 @@ QDF_STATUS hdd_update_mac_config(hdd_context_t *pHddCtx) char *line, *buffer = NULL; char *temp = NULL; char *name, *value; + int max_mac_addr = QDF_MAX_CONCURRENCY_PERSONA; tCfgIniEntry macTable[QDF_MAX_CONCURRENCY_PERSONA]; tSirMacAddr customMacAddr; @@ -6229,6 +6230,9 @@ QDF_STATUS hdd_update_mac_config(hdd_context_t *pHddCtx) } update_mac_from_string(pHddCtx, &macTable[0], i); + hdd_debug("Populating remaining %d Mac addreses", + max_mac_addr - i); + hdd_populate_random_mac_addr(pHddCtx, max_mac_addr - i); qdf_mem_copy(&customMacAddr, &pHddCtx->config->intfMacAddr[0].bytes[0], diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e213b4d54320..210ad956664e 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8453,7 +8453,7 @@ static uint8_t *hdd_get_platform_wlan_mac_buff(struct device *dev, * * Return: None */ -static void hdd_populate_random_mac_addr(hdd_context_t *hdd_ctx, uint32_t num) +void hdd_populate_random_mac_addr(hdd_context_t *hdd_ctx, uint32_t num) { uint32_t start_idx = QDF_MAX_CONCURRENCY_PERSONA - num; uint32_t iter;