summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuanyuan Liu <yuanliu@codeaurora.org>2016-09-14 12:15:16 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-21 17:06:51 -0700
commit245a3e4380b6da86cdac9de98bdae5b40ce34422 (patch)
tree3b966bfc915d4b4cc71548e196be33b0ec6cdf75
parent428fbd62b33af4f50847c63633ab120d24fc03f3 (diff)
qcacld-3.0: Update MAC address to FW
Update MAC address to FW if it is provided by host. Otherwise, MAC address will be out-of-sync between host and FW. Change-Id: Idcf00d80d6d9e3e39b5a5ccb6d96390c2d883fe6 CRs-Fixed: 1066986
-rw-r--r--core/hdd/inc/wlan_hdd_main.h1
-rw-r--r--core/hdd/src/wlan_hdd_main.c40
2 files changed, 39 insertions, 2 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index d53758c34a10..2dfece9426f3 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -1496,6 +1496,7 @@ struct hdd_context_s {
bool napi_enable;
bool stop_modules_in_progress;
bool start_modules_in_progress;
+ bool update_mac_addr_to_fw;
};
/*---------------------------------------------------------------------------
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index a157b5ee20e3..55d8eb8ca004 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -1424,6 +1424,7 @@ void hdd_update_tgt_cfg(void *context, void *param)
if (!qdf_is_macaddr_zero(&cfg->hw_macaddr)) {
hdd_update_macaddr(hdd_ctx->config, cfg->hw_macaddr);
+ hdd_ctx->update_mac_addr_to_fw = false;
} else {
static struct qdf_mac_addr default_mac_addr = {
{0x00, 0x0A, 0xF5, 0x89, 0x89, 0xFF}
@@ -1441,6 +1442,7 @@ void hdd_update_tgt_cfg(void *context, void *param)
MAC_ADDR_ARRAY(hdd_ctx->config->
intfMacAddr[0].bytes));
}
+ hdd_ctx->update_mac_addr_to_fw = true;
}
hdd_ctx->target_fw_version = cfg->target_fw_version;
@@ -6988,6 +6990,30 @@ static int hdd_cnss_wlan_mac(hdd_context_t *hdd_ctx)
}
/**
+ * hdd_update_mac_addr_to_fw() - API to update wlan mac addresses to FW
+ * @hdd_ctx: HDD Context
+ *
+ * Update MAC address to FW. If MAC address passed by FW is invalid, host
+ * will generate its own MAC and update it to FW.
+ *
+ * Return: 0 for success
+ * Non-zero error code for failure
+ */
+static int hdd_update_mac_addr_to_fw(hdd_context_t *hdd_ctx)
+{
+ tSirMacAddr customMacAddr;
+ QDF_STATUS status;
+
+ qdf_mem_copy(&customMacAddr,
+ &hdd_ctx->config->intfMacAddr[0].bytes[0],
+ sizeof(tSirMacAddr));
+ status = sme_set_custom_mac_addr(customMacAddr);
+ if (!QDF_IS_STATUS_SUCCESS(status))
+ return -EAGAIN;
+ return 0;
+}
+
+/**
* hdd_initialize_mac_address() - API to get wlan mac addresses
* @hdd_ctx: HDD Context
*
@@ -7010,8 +7036,18 @@ static void hdd_initialize_mac_address(hdd_context_t *hdd_ctx)
status = hdd_update_mac_config(hdd_ctx);
- if (!QDF_IS_STATUS_SUCCESS(status))
- hdd_warn("can't update mac config, using MAC from ini file");
+ if (QDF_IS_STATUS_SUCCESS(status))
+ return;
+
+ hdd_warn("can't update mac config via wlan_mac.bin, using MAC from ini file or auto-gen");
+
+ if (hdd_ctx->update_mac_addr_to_fw)
+ ret = hdd_update_mac_addr_to_fw(hdd_ctx);
+
+ if (ret != 0) {
+ hdd_err("MAC address out-of-sync, ret:%d", ret);
+ QDF_ASSERT(ret);
+ }
}
/**