diff options
| author | Dundi Raviteja <dundi@codeaurora.org> | 2018-04-25 18:15:26 +0530 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-05-09 06:21:50 -0700 |
| commit | f780ca85f1b832e89bfbd76fc4bae7d32040d4a5 (patch) | |
| tree | 639a127a0d90e289b0960c06d8aa084e82c05d95 | |
| parent | d47cb93001b2468bc9e6fbf105b65fbda759eb8e (diff) | |
qcacld-3.0: Use request manager to handle setting random MAC
Use the new request manager framework for handling set random MAC.
Change-Id: Iea25711c81ae324082eb5a10f4a8bcc9768b60aa
CRs-Fixed: 2231107
| -rw-r--r-- | core/hdd/inc/wlan_hdd_main.h | 14 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_p2p.c | 71 |
2 files changed, 37 insertions, 48 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 74e7139daaed..1a5b2c7dcdf7 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -426,20 +426,6 @@ struct hdd_apf_context { qdf_spinlock_t lock; }; -/** - * struct random_mac_context - Context used with hdd_random_mac_callback - * @random_mac_completion: Event on which hdd_set_random_mac will wait - * @adapter: Pointer to adapter - * @magic: For valid context this is set to ACTION_FRAME_RANDOM_CONTEXT_MAGIC - * @set_random_addr: Status of random filter set - */ -struct random_mac_context { - struct completion random_mac_completion; - hdd_adapter_t *adapter; - unsigned int magic; - bool set_random_addr; -}; - extern spinlock_t hdd_context_lock; extern struct mutex hdd_init_deinit_lock; diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 002237da943f..c3ed24ebc7ce 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -44,6 +44,7 @@ #include "cds_sched.h" #include "cds_concurrency.h" #include "cds_utils.h" +#include "wlan_hdd_request_manager.h" /* Ms to Time Unit Micro Sec */ #define MS_TO_TU_MUS(x) ((x) * 1024) @@ -171,6 +172,10 @@ static bool hdd_is_p2p_go_cnf_frame(const u8 *buf, uint32_t len) return false; } +struct random_mac_priv { + bool set_random_addr; +}; + /** * hdd_random_mac_callback() - Callback invoked from wmi layer * @set_random_addr: Status of random mac filter set operation @@ -183,31 +188,20 @@ static bool hdd_is_p2p_go_cnf_frame(const u8 *buf, uint32_t len) */ static void hdd_random_mac_callback(bool set_random_addr, void *context) { - struct random_mac_context *rnd_ctx; - hdd_adapter_t *adapter; + struct hdd_request *request; + struct random_mac_priv *priv; - if (!context) { - hdd_err("Bad param, pContext"); + request = hdd_request_get(context); + if (!request) { + hdd_err("invalid request"); return; } - rnd_ctx = context; - adapter = rnd_ctx->adapter; + priv = hdd_request_priv(request); + priv->set_random_addr = set_random_addr; - spin_lock(&hdd_context_lock); - if ((!adapter) || - (rnd_ctx->magic != ACTION_FRAME_RANDOM_CONTEXT_MAGIC)) { - spin_unlock(&hdd_context_lock); - hdd_err("Invalid context, magic [%08x]", rnd_ctx->magic); - return; - } - - rnd_ctx->magic = 0; - if (set_random_addr) - rnd_ctx->set_random_addr = true; - - complete(&rnd_ctx->random_mac_completion); - spin_unlock(&hdd_context_lock); + hdd_request_complete(request); + hdd_request_put(request); } /** @@ -222,11 +216,17 @@ static bool hdd_set_random_mac(hdd_adapter_t *adapter, uint8_t *random_mac_addr, uint32_t freq) { - struct random_mac_context context; hdd_context_t *hdd_ctx; QDF_STATUS sme_status; unsigned long rc; + void *cookie; bool status = false; + struct hdd_request *request; + struct random_mac_priv *priv; + static const struct hdd_request_params params = { + .priv_size = sizeof(*priv), + .timeout_ms = WLAN_WAIT_TIME_SET_RND, + }; ENTER(); hdd_ctx = WLAN_HDD_GET_CTX(adapter); @@ -235,30 +235,33 @@ static bool hdd_set_random_mac(hdd_adapter_t *adapter, return false; } - init_completion(&context.random_mac_completion); - context.adapter = adapter; - context.magic = ACTION_FRAME_RANDOM_CONTEXT_MAGIC; - context.set_random_addr = false; + request = hdd_request_alloc(¶ms); + if (!request) { + hdd_err("Request allocation failure"); + return false; + } + + cookie = hdd_request_cookie(request); sme_status = sme_set_random_mac(hdd_ctx->hHal, hdd_random_mac_callback, adapter->sessionId, random_mac_addr, freq, - &context); + cookie); if (sme_status != QDF_STATUS_SUCCESS) { hdd_err("Unable to set random mac"); } else { - rc = wait_for_completion_timeout(&context.random_mac_completion, - msecs_to_jiffies(WLAN_WAIT_TIME_SET_RND)); - if (!rc) + rc = hdd_request_wait_for_response(request); + if (rc) { hdd_err("SME timed out while setting random mac"); + } else { + priv = hdd_request_priv(request); + status = priv->set_random_addr; + } } - spin_lock(&hdd_context_lock); - context.magic = 0; - status = context.set_random_addr; - spin_unlock(&hdd_context_lock); - + hdd_request_put(request); EXIT(); + return status; } |
