From cf37ebbf75de6c39d6b426dda4e3150d39d65ae3 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Fri, 2 Sep 2016 16:23:06 +0530 Subject: qcacld-3.0: Reset IPA disconnect events during SSR IPA Disconnect events are not sent to IPA driver in case of SSR. This is resulting in mismatch between IPA driver and HOST driver. Reset IPA disconnect events during SSR, to have coherent connect/disconnect counter. Propagation from qcacld-2.0 to qcacld-3.0. Change-Id: Ie07e5840fc997f41b987fc7e548e1a7e3484c113 CRs-Fixed: 1034712 --- core/hdd/src/wlan_hdd_ipa.c | 108 ++++++++++++++++++++++++++++++++++++------ core/hdd/src/wlan_hdd_power.c | 2 +- 2 files changed, 94 insertions(+), 16 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index b42df3a390ea..510a5717088f 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -1875,6 +1875,97 @@ void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx) return; } +/** + * hdd_ipa_msg_free_fn() - Free an IPA message + * @buff: pointer to the IPA message + * @len: length of the IPA message + * @type: type of IPA message + * + * Return: None + */ +static void hdd_ipa_msg_free_fn(void *buff, uint32_t len, uint32_t type) +{ + HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO, "msg type:%d, len:%d", type, len); + ghdd_ipa->stats.num_free_msg++; + qdf_mem_free(buff); +} + + +/** + * hdd_ipa_send_disconnect() - ipa send disconnect clients + * adapter: pointer to hdd adapter + * Send disconnect evnt to IPA driver during SSR + * + * Return: 0 - Success + */ +static int hdd_ipa_send_disconnect(hdd_adapter_t *adapter) +{ + struct ipa_msg_meta meta; + struct ipa_wlan_msg *msg; + int ret = 0; + int i; + + for (i = 0; i < WLAN_MAX_STA_COUNT; i++) { + if (qdf_is_macaddr_broadcast(&adapter->aStaInfo[i].macAddrSTA)) + continue; + if ((adapter->aStaInfo[i].isUsed) && + (!adapter->aStaInfo[i].isDeauthInProgress)) { + meta.msg_len = sizeof(struct ipa_wlan_msg); + msg = qdf_mem_malloc(meta.msg_len); + if (msg == NULL) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, + "msg allocation failed"); + return -ENOMEM; + } + meta.msg_type = WLAN_CLIENT_DISCONNECT; + strlcpy(msg->name, adapter->dev->name, + IPA_RESOURCE_NAME_MAX); + memcpy(msg->mac_addr, adapter->aStaInfo[i].macAddrSTA.bytes, + ETH_ALEN); + HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO, "%s: Evt: %d", + msg->name, meta.msg_type); + ret = ipa_send_msg(&meta, msg, hdd_ipa_msg_free_fn); + if (ret) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, + "%s: Evt: %d fail:%d", + msg->name, meta.msg_type, ret); + qdf_mem_free(msg); + return ret; + } + } + } + + return ret; +} + +/** + * hdd_ipa_uc_disconnect_client() - disconnect ipa sap clients + * hdd_ctx: pointer to hdd context + * Send disconnect evnt to IPA driver during SSR + * + * Return: 0 - Success + */ +static int hdd_ipa_uc_disconnect_client(hdd_context_t *hdd_ctx) +{ + hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; + QDF_STATUS status; + hdd_adapter_t *adapter; + int ret = 0; + + + status = hdd_get_front_adapter(hdd_ctx, &adapter_node); + while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) { + adapter = adapter_node->pAdapter; + if (adapter->device_mode == QDF_SAP_MODE) + hdd_ipa_send_disconnect(adapter); + status = hdd_get_next_adapter( + hdd_ctx, adapter_node, &next); + adapter_node = next; + } + + return ret; +} + /** * hdd_ipa_uc_ssr_deinit() - handle ipa deinit for SSR * @@ -1892,6 +1983,8 @@ int hdd_ipa_uc_ssr_deinit(void) if ((!hdd_ipa) || (!hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx))) return 0; + /* send disconnect to ipa driver for connected clients */ + hdd_ipa_uc_disconnect_client(hdd_ipa->hdd_ctx); /* Clean up HDD IPA interfaces */ for (idx = 0; (hdd_ipa->num_iface > 0) && (idx < HDD_IPA_MAX_IFACE); idx++) { @@ -3537,21 +3630,6 @@ end: return ret; } -/** - * hdd_ipa_msg_free_fn() - Free an IPA message - * @buff: pointer to the IPA message - * @len: length of the IPA message - * @type: type of IPA message - * - * Return: None - */ -static void hdd_ipa_msg_free_fn(void *buff, uint32_t len, uint32_t type) -{ - hddLog(LOG1, "msg type:%d, len:%d", type, len); - ghdd_ipa->stats.num_free_msg++; - qdf_mem_free(buff); -} - #ifndef QCA_LL_TX_FLOW_CONTROL_V2 /** * hdd_ipa_send_mcc_scc_msg() - send IPA WLAN_SWITCH_TO_MCC/SCC message diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 199fc4668d5b..f056d383937a 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1461,6 +1461,7 @@ QDF_STATUS hdd_wlan_shutdown(void) cds_clear_concurrent_session_count(); hdd_cleanup_scan_queue(pHddCtx); + hdd_ipa_uc_ssr_deinit(); hdd_reset_all_adapters(pHddCtx); /* Flush cached rx frame queue */ @@ -1468,7 +1469,6 @@ QDF_STATUS hdd_wlan_shutdown(void) /* De-register the HDD callbacks */ hdd_deregister_cb(pHddCtx); - hdd_ipa_uc_ssr_deinit(); cds_sched_context = get_cds_sched_ctxt(); -- cgit v1.2.3