From b6609100714d6a22569157a182cf40dfc6f0461b Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Thu, 1 Oct 2020 20:36:37 +0530 Subject: [PATCH 01/55] qcacld-3.0: add cdp ops for IPA Tx buf smmu_unmapping Add cdp ops for IPA Tx buf SMMU-S1 unmapping and call unmap from ipa_uc_ol_deinit if IPA uc_loaded, also assert if mapping/unmapping failed. Change-Id: I79f293fcf5d6f02e3a01d6c8ff829f4ca87e76e8 CRs-Fixed: 2788811 --- components/ipa/core/src/wlan_ipa_core.c | 6 +- core/dp/htt/htt_tx.c | 48 -------------- core/dp/txrx/ol_txrx.c | 3 +- core/dp/txrx/ol_txrx_ipa.c | 87 ++++++++++++++++--------- core/dp/txrx/ol_txrx_ipa.h | 23 +++++-- 5 files changed, 82 insertions(+), 85 deletions(-) diff --git a/components/ipa/core/src/wlan_ipa_core.c b/components/ipa/core/src/wlan_ipa_core.c index cbabe741675f..dc59f469ba68 100644 --- a/components/ipa/core/src/wlan_ipa_core.c +++ b/components/ipa/core/src/wlan_ipa_core.c @@ -617,8 +617,10 @@ static void wlan_ipa_pm_flush(void *data) int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) { - if (!ipa_is_ready()) + if (!ipa_is_ready()) { + ipa_info("IPA is not READY"); return 0; + } if (!num_buf) { ipa_info("No buffers to map/unmap"); @@ -3698,6 +3700,8 @@ QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx) wlan_ipa_uc_disable_pipes(ipa_ctx, true); if (true == ipa_ctx->uc_loaded) { + cdp_ipa_tx_buf_smmu_unmapping(ipa_ctx->dp_soc, + ipa_ctx->dp_pdev_id); status = cdp_ipa_cleanup(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id, ipa_ctx->tx_pipe_handle, diff --git a/core/dp/htt/htt_tx.c b/core/dp/htt/htt_tx.c index 47664cbc5a08..285b0c7ef799 100644 --- a/core/dp/htt/htt_tx.c +++ b/core/dp/htt/htt_tx.c @@ -1206,39 +1206,15 @@ out: static void htt_tx_buf_pool_free(struct htt_pdev_t *pdev) { uint16_t idx; - qdf_mem_info_t *mem_map_table = NULL, *mem_info = NULL; - uint32_t num_unmapped = 0; - - if (qdf_mem_smmu_s1_enabled(pdev->osdev)) { - mem_map_table = qdf_mem_map_table_alloc( - pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt); - if (!mem_map_table) { - qdf_print("Failed to allocate memory"); - return; - } - mem_info = mem_map_table; - } for (idx = 0; idx < pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt; idx++) { if (pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[idx]) { - if (qdf_mem_smmu_s1_enabled(pdev->osdev)) { - *mem_info = pdev->ipa_uc_tx_rsc. - tx_buf_pool_strg[idx]->mem_info; - mem_info++; - num_unmapped++; - } qdf_mem_shared_mem_free(pdev->osdev, pdev->ipa_uc_tx_rsc. tx_buf_pool_strg[idx]); pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[idx] = NULL; } } - - if (qdf_mem_smmu_s1_enabled(pdev->osdev)) { - if (num_unmapped) - cds_smmu_map_unmap(false, num_unmapped, mem_map_table); - qdf_mem_free(mem_map_table); - } } #else static int htt_tx_ipa_get_limit_tx_buf_count(unsigned int uc_tx_buf_cnt) @@ -1336,39 +1312,15 @@ pwr2: static void htt_tx_buf_pool_free(struct htt_pdev_t *pdev) { uint16_t idx; - qdf_mem_info_t *mem_map_table = NULL, *mem_info = NULL; - uint32_t num_unmapped = 0; - - if (qdf_mem_smmu_s1_enabled(pdev->osdev)) { - mem_map_table = qdf_mem_map_table_alloc( - pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt); - if (!mem_map_table) { - qdf_print("Failed to allocate memory"); - return; - } - mem_info = mem_map_table; - } for (idx = 0; idx < pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt; idx++) { if (pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[idx]) { - if (qdf_mem_smmu_s1_enabled(pdev->osdev)) { - *mem_info = pdev->ipa_uc_tx_rsc. - tx_buf_pool_strg[idx]->mem_info; - mem_info++; - num_unmapped++; - } qdf_mem_shared_mem_free(pdev->osdev, pdev->ipa_uc_tx_rsc. tx_buf_pool_strg[idx]); pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[idx] = NULL; } } - - if (qdf_mem_smmu_s1_enabled(pdev->osdev)) { - if (num_unmapped) - cds_smmu_map_unmap(false, num_unmapped, mem_map_table); - qdf_mem_free(mem_map_table); - } } #endif diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index 965c8a65fb08..69f386f4b0d2 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -6185,7 +6185,8 @@ static struct cdp_ipa_ops ol_ops_ipa = { .ipa_uc_get_share_stats = ol_txrx_ipa_uc_get_share_stats, .ipa_uc_set_quota = ol_txrx_ipa_uc_set_quota, #endif - .ipa_tx_buf_smmu_mapping = ol_txrx_ipa_tx_buf_smmu_mapping + .ipa_tx_buf_smmu_mapping = ol_txrx_ipa_tx_buf_smmu_mapping, + .ipa_tx_buf_smmu_unmapping = ol_txrx_ipa_tx_buf_smmu_unmapping }; #endif diff --git a/core/dp/txrx/ol_txrx_ipa.c b/core/dp/txrx/ol_txrx_ipa.c index 3fe6cd02afd9..a9037b4ff7ac 100644 --- a/core/dp/txrx/ol_txrx_ipa.c +++ b/core/dp/txrx/ol_txrx_ipa.c @@ -280,60 +280,89 @@ QDF_STATUS ol_txrx_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl, return QDF_STATUS_SUCCESS; } -static QDF_STATUS __ol_txrx_ipa_tx_buf_smmu_mapping( - struct ol_txrx_soc_t *soc, - struct ol_txrx_pdev_t *pdev, - bool create) +static QDF_STATUS __ol_txrx_ipa_tx_buf_smmu_mapping(struct ol_txrx_pdev_t *pdev, + bool create) { uint32_t index; + uint32_t unmap_cnt = 0; + uint32_t tx_buffer_cnt; QDF_STATUS ret = QDF_STATUS_SUCCESS; struct htt_pdev_t *htt_pdev = pdev->htt_pdev; - uint32_t tx_buffer_cnt = htt_pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt; qdf_mem_info_t *mem_map_table = NULL, *mem_info = NULL; - if (qdf_mem_smmu_s1_enabled(htt_pdev->osdev)) { - mem_map_table = qdf_mem_map_table_alloc(tx_buffer_cnt); - if (!mem_map_table) { - QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, - "Failed to allocate memory"); - return QDF_STATUS_E_FAILURE; - } - mem_info = mem_map_table; + if (!htt_pdev) { + ol_txrx_err("htt_pdev is NULL"); + return QDF_STATUS_E_FAILURE; } - for (index = 0; index < tx_buffer_cnt; index++) { - *mem_info = htt_pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[ - index]->mem_info; - if (!mem_info) - continue; - ret = cds_smmu_map_unmap(true, 1, mem_info); - mem_info++; + if (qdf_mem_smmu_s1_enabled(htt_pdev->osdev)) { + ol_txrx_info("SMMU-S1 mapping is disabled"); + return QDF_STATUS_SUCCESS; } - if (qdf_mem_smmu_s1_enabled(htt_pdev->osdev)) - qdf_mem_free(mem_map_table); + + tx_buffer_cnt = htt_pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt; + mem_map_table = qdf_mem_map_table_alloc(tx_buffer_cnt); + if (!mem_map_table) { + ol_txrx_err("Failed to allocate memory"); + return QDF_STATUS_E_FAILURE; + } + mem_info = mem_map_table; + + for (index = 0; index < tx_buffer_cnt; index++) { + if (htt_pdev->ipa_uc_tx_rsc.tx_buf_pool_strg[index]) { + *mem_info = htt_pdev->ipa_uc_tx_rsc. + tx_buf_pool_strg[index]->mem_info; + mem_info++; + unmap_cnt++; + } + } + + ret = cds_smmu_map_unmap(create, unmap_cnt, mem_map_table); + qdf_assert_always(!ret); + qdf_mem_free(mem_map_table); return ret; } -QDF_STATUS ol_txrx_ipa_tx_buf_smmu_mapping( - struct cdp_soc_t *soc_hdl, uint8_t pdev_id) +QDF_STATUS ol_txrx_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id) { QDF_STATUS ret; struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); if (!pdev) { - QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, - "invalid instance"); + ol_txrx_err("invalid instance"); return QDF_STATUS_E_FAILURE; } if (!qdf_mem_smmu_s1_enabled(pdev->htt_pdev->osdev)) { - QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, - "SMMU S1 disabled"); + ol_txrx_err("SMMU S1 disabled"); return QDF_STATUS_SUCCESS; } - ret = __ol_txrx_ipa_tx_buf_smmu_mapping(soc, pdev, true); + ret = __ol_txrx_ipa_tx_buf_smmu_mapping(pdev, true); + + return ret; +} + +QDF_STATUS ol_txrx_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id) +{ + QDF_STATUS ret; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); + + if (!pdev) { + ol_txrx_err("invalid instance"); + return QDF_STATUS_E_FAILURE; + } + + if (!qdf_mem_smmu_s1_enabled(pdev->htt_pdev->osdev)) { + ol_txrx_err("SMMU S1 disabled"); + return QDF_STATUS_SUCCESS; + } + ret = __ol_txrx_ipa_tx_buf_smmu_mapping(pdev, false); + return ret; } diff --git a/core/dp/txrx/ol_txrx_ipa.h b/core/dp/txrx/ol_txrx_ipa.h index 04326cb31678..af3101778123 100644 --- a/core/dp/txrx/ol_txrx_ipa.h +++ b/core/dp/txrx/ol_txrx_ipa.h @@ -211,15 +211,26 @@ QDF_STATUS ol_txrx_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id); /** - * ol_txrx_ipa_tx_buf_smmu_mapping() Create SMMU mappings for IPA - * allocated TX buffers - * @soc_hdl - handle to the soc - * @pdev_id - pdev id number, to get the handle + * ol_txrx_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for IPA + * allocated TX buffers + * @soc_hdl: handle to the soc + * @pdev_id: pdev id number, to get the handle * * Return: QDF_STATUS */ -QDF_STATUS ol_txrx_ipa_tx_buf_smmu_mapping( - struct cdp_soc_t *soc_hdl, uint8_t pdev_id); +QDF_STATUS ol_txrx_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id); + +/** + * ol_txrx_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for IPA + * allocated TX buffers + * @soc_hdl: handle to the soc + * @pdev_id: pdev id number, to get the handle + * + * Return: QDF_STATUS + */ +QDF_STATUS ol_txrx_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id); #ifdef CONFIG_IPA_WDI_UNIFIED_API /** From 6fb2a4f3a21bb7902c68d5888d9e5155b0185af8 Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Thu, 8 Oct 2020 23:17:26 +0530 Subject: [PATCH 02/55] qcacld-3.0: fix the error in smmu_enable conditional check Fix the error in smmu_enable condition check for IPA Tx buffer and also add the flag to mark smmu map/unmap. Change-Id: I1a9b768c6f17a76b7a857367f342ffbe82e48379 CRs-Fixed: 2793156 --- core/dp/htt/htt_tx.c | 2 ++ core/dp/htt/htt_types.h | 1 + core/dp/txrx/ol_txrx_ipa.c | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/dp/htt/htt_tx.c b/core/dp/htt/htt_tx.c index 285b0c7ef799..370158055aa8 100644 --- a/core/dp/htt/htt_tx.c +++ b/core/dp/htt/htt_tx.c @@ -1379,6 +1379,8 @@ int htt_tx_ipa_uc_attach(struct htt_pdev_t *pdev, pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt = htt_tx_ipa_uc_wdi_tx_buf_alloc( pdev, uc_tx_buf_sz, uc_tx_buf_cnt, uc_tx_partition_base); + pdev->ipa_uc_tx_rsc.ipa_smmu_mapped = false; + return 0; diff --git a/core/dp/htt/htt_types.h b/core/dp/htt/htt_types.h index 386d8d968cb7..dc0951b5f2b3 100644 --- a/core/dp/htt/htt_types.h +++ b/core/dp/htt/htt_types.h @@ -123,6 +123,7 @@ struct htt_ipa_uc_tx_resource_t { uint32_t tx_comp_idx_paddr; qdf_shared_mem_t **tx_buf_pool_strg; uint32_t alloc_tx_buf_cnt; + bool ipa_smmu_mapped; }; /** diff --git a/core/dp/txrx/ol_txrx_ipa.c b/core/dp/txrx/ol_txrx_ipa.c index a9037b4ff7ac..f36bc4888235 100644 --- a/core/dp/txrx/ol_txrx_ipa.c +++ b/core/dp/txrx/ol_txrx_ipa.c @@ -295,7 +295,7 @@ static QDF_STATUS __ol_txrx_ipa_tx_buf_smmu_mapping(struct ol_txrx_pdev_t *pdev, return QDF_STATUS_E_FAILURE; } - if (qdf_mem_smmu_s1_enabled(htt_pdev->osdev)) { + if (!qdf_mem_smmu_s1_enabled(htt_pdev->osdev)) { ol_txrx_info("SMMU-S1 mapping is disabled"); return QDF_STATUS_SUCCESS; } @@ -320,6 +320,8 @@ static QDF_STATUS __ol_txrx_ipa_tx_buf_smmu_mapping(struct ol_txrx_pdev_t *pdev, ret = cds_smmu_map_unmap(create, unmap_cnt, mem_map_table); qdf_assert_always(!ret); qdf_mem_free(mem_map_table); + htt_pdev->ipa_uc_tx_rsc.ipa_smmu_mapped = create; + ol_txrx_info("smmu_map_unmap:%d of %d Tx buffers", create, unmap_cnt); return ret; } From 28e5c78b87be9fb55fd6d4ea02c4225a4906ef2c Mon Sep 17 00:00:00 2001 From: Arun Kumar Khandavalli Date: Tue, 27 Oct 2020 17:35:22 +0530 Subject: [PATCH 03/55] qcacld-3.0: Close/destroy the pdev before CDS closing Pdev is created once all the modules are enabled and currently it is freed after the cds close is done, if some of the modules as part of the de-init sequence has to send a command to the firmware it will result in error. To keep the deinit sequence opposite to that of init close/destroy the pdev before closing the cds. Change-Id: I8e087a573112e5d2d81e8ea413044d45f228813e CRs-Fixed: 2797344 --- core/hdd/src/wlan_hdd_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index f056d45517a7..7005c34151e0 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -14139,6 +14139,14 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) QDF_ASSERT(0); } + hdd_component_pdev_close(hdd_ctx->pdev); + dispatcher_pdev_close(hdd_ctx->pdev); + ret = hdd_objmgr_release_and_destroy_pdev(hdd_ctx); + if (ret) { + hdd_err("Failed to destroy pdev; errno:%d", ret); + QDF_ASSERT(0); + } + qdf_status = cds_close(hdd_ctx->psoc); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { hdd_warn("Failed to stop CDS: %d", qdf_status); @@ -14151,15 +14159,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) hdd_err("WBUFF de-init unsuccessful; status: %d", qdf_status); - hdd_component_pdev_close(hdd_ctx->pdev); - hdd_component_psoc_close(hdd_ctx->psoc); - dispatcher_pdev_close(hdd_ctx->pdev); - ret = hdd_objmgr_release_and_destroy_pdev(hdd_ctx); - if (ret) { - hdd_err("Failed to destroy pdev; errno:%d", ret); - QDF_ASSERT(0); - } /* pdev close and destroy use tx rx ops so call this here */ wlan_global_lmac_if_close(hdd_ctx->psoc); } From 42c549aa7365debeb75fc61ab0e827b596bea918 Mon Sep 17 00:00:00 2001 From: Abhishek Ambure Date: Thu, 12 Nov 2020 13:58:47 +0530 Subject: [PATCH 04/55] qcacld-3.0: Send disassoc cnf if host failed to send disassoc to FW Problem scenario: 1) Host gets Firmware down indication and stops all timers. 2) While processing association completion, host sends disassoc if user changed reg domain during association and new channel falls out of current reg domain. 3) Host fails to send disassoc to fw as WMI is in stop state due to SSR 4) Host doesn't check wmi status for disassoc tx and on failure depends on disassoc ack timer to complete disassoc cnf. 5) As host stops timers on firmware down indication, disassoc ack timer doesn't trigger and host fails to complete disassoc cnf action. Which lead to stuck the vdev state machine at suspend down and peer refs remains undeleted. To fix this issue check the status of sending the disassoc, and if the disassoc failed to send then perform the follow-up actions that are normally performed upon receipt of the disassoc confirmation. Change-Id: Ic2b88cfcbcb755a869ee281be4e1e8a9cec8299b CRs-Fixed: 2816503 --- core/mac/src/pe/lim/lim_send_management_frames.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index cde084c4e6ce..06ec5683e792 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -3578,6 +3578,13 @@ lim_send_disassoc_mgmt_frame(struct mac_context *mac, (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, pe_session->peSessionId, qdf_status)); + if (QDF_IS_STATUS_ERROR(qdf_status)) { + pe_err("Failed to send disassoc frame"); + lim_tx_complete(mac, pPacket, true); + lim_send_disassoc_cnf(mac); + return; + } + val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); if (tx_timer_change From 8ef527e763b88f8a6021d5381d8430464ed35b68 Mon Sep 17 00:00:00 2001 From: Abhishek Ambure Date: Thu, 26 Nov 2020 13:45:29 +0530 Subject: [PATCH 05/55] qcacld-3.0: Don't free pkt if wma fails to tx disassoc mgmt frame In WMA layer, if host fails to send disassoc mgmt to FW, host checks return status of wma_tx_packet() and frees memory allocated for packet in LIM. As host already takes care of packet freeing in wma_tx_packet(), don't free packet in LIM if wma_tx_packet() returns failure. Change-Id: I912a452edadf83936a9ac6120bd45efa9abde173 CRs-Fixed: 2826655 --- core/mac/src/pe/lim/lim_send_management_frames.c | 1 - 1 file changed, 1 deletion(-) diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 06ec5683e792..4384b75795d9 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -3580,7 +3580,6 @@ lim_send_disassoc_mgmt_frame(struct mac_context *mac, if (QDF_IS_STATUS_ERROR(qdf_status)) { pe_err("Failed to send disassoc frame"); - lim_tx_complete(mac, pPacket, true); lim_send_disassoc_cnf(mac); return; } From 1c909860d7aac28d85e09e71844f5cc5c20d4bfe Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Wed, 16 Dec 2020 16:57:12 +0530 Subject: [PATCH 06/55] qcacld-3.0: Send assoc reject upon failing to post ASSOC_IND Currently, lim silently drops the association if it fails to post ASSOC_IND due to some reason(e.g. invalid contents of assoc request) and the MLM state is stuck in eLIM_MLM_WT_ASSOC_CNF_STATE. Station context is not cleaned up till the next association. Gracefully cleanup the association in such failure cases. Change-Id: Iede43a1ddc4ac6ef300af02776b153b58dd70c2c CRs-Fixed: 2810235 --- .../src/pe/lim/lim_process_assoc_req_frame.c | 26 ++++++------------- .../src/pe/lim/lim_process_mlm_rsp_messages.c | 9 ++++++- core/mac/src/pe/lim/lim_types.h | 17 ++++++++++-- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index eb513f8f63ec..2e7796d716cc 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -2954,19 +2954,9 @@ bool lim_fill_lim_assoc_ind_params( return true; } -/** - * lim_send_mlm_assoc_ind() - Sends assoc indication to SME - * @mac_ctx: Global Mac context - * @sta_ds: Station DPH hash entry - * @session_entry: PE session entry - * - * This function sends either LIM_MLM_ASSOC_IND - * or LIM_MLM_REASSOC_IND to SME. - * - * Return: None - */ -void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, - tpDphHashNode sta_ds, struct pe_session *session_entry) +QDF_STATUS lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, + tpDphHashNode sta_ds, + struct pe_session *session_entry) { tpLimMlmAssocInd assoc_ind; tpSirAssocReq assoc_req; @@ -2976,7 +2966,7 @@ void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, if (!session_entry->parsedAssocReq) { pe_err(" Parsed Assoc req is NULL"); - return; + return QDF_STATUS_E_INVAL; } /* Get a copy of the already parsed Assoc Request */ @@ -2985,7 +2975,7 @@ void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, if (!assoc_req) { pe_err("assoc req for assoc_id:%d is NULL", sta_ds->assocId); - return; + return QDF_STATUS_E_INVAL; } /* Get the phy_mode */ @@ -3009,17 +2999,17 @@ void lim_send_mlm_assoc_ind(struct mac_context *mac_ctx, if (!assoc_ind) { lim_release_peer_idx(mac_ctx, sta_ds->assocId, session_entry); - return; + return QDF_STATUS_E_INVAL; } if (!lim_fill_lim_assoc_ind_params(assoc_ind, mac_ctx, sta_ds, session_entry)) { qdf_mem_free(assoc_ind); - return; + return QDF_STATUS_E_INVAL; } lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_IND, (uint32_t *)assoc_ind); qdf_mem_free(assoc_ind); } - return; + return QDF_STATUS_SUCCESS; } diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c index 11a2f0b79a90..be58ca2a859e 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c @@ -1977,7 +1977,14 @@ void lim_process_ap_mlm_add_sta_rsp(struct mac_context *mac, * 2) PE receives eWNI_SME_ASSOC_CNF from SME * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA */ - lim_send_mlm_assoc_ind(mac, sta, pe_session); + if (lim_send_mlm_assoc_ind(mac, sta, pe_session) != QDF_STATUS_SUCCESS) + lim_reject_association(mac, sta->staAddr, + sta->mlmStaContext.subType, + true, sta->mlmStaContext.authType, + sta->assocId, true, + STATUS_UNSPECIFIED_FAILURE, + pe_session); + /* fall though to reclaim the original Add STA Response message */ end: if (0 != limMsgQ->bodyptr) { diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index a5266d1329fb..3b2f44821e06 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -451,8 +451,21 @@ lim_fill_sme_assoc_ind_params( struct mac_context *mac_ctx, tpLimMlmAssocInd assoc_ind, struct assoc_ind *sme_assoc_ind, struct pe_session *session_entry, bool assoc_req_alloc); -void lim_send_mlm_assoc_ind(struct mac_context *mac, tpDphHashNode sta, - struct pe_session *pe_session); + +/** + * lim_send_mlm_assoc_ind() - Sends assoc indication to SME + * @mac_ctx: Global Mac context + * @sta_ds: Station DPH hash entry + * @session_entry: PE session entry + * + * This function sends either LIM_MLM_ASSOC_IND + * or LIM_MLM_REASSOC_IND to SME. + * + * Return: QDF_STATUS + */ +QDF_STATUS lim_send_mlm_assoc_ind(struct mac_context *mac, + tpDphHashNode sta, + struct pe_session *pe_session); #define ASSOC_FRAME_LEN 0 /** From bdfc26efc4c178eded3e3748e1542df65e483f83 Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Mon, 1 Feb 2021 23:11:41 +0530 Subject: [PATCH 07/55] Revert "qcacld-3.0: Add debug infra to detect reference leaks for dev_hold" This reverts commit 85d542301d066784f62ec485699a50375e1325ef. Change-Id: I71d199072533d07fefd779b933fd6a4e0157c22d --- core/hdd/inc/wlan_hdd_main.h | 156 ++----- core/hdd/src/wlan_hdd_assoc.c | 19 +- core/hdd/src/wlan_hdd_cfg80211.c | 25 +- core/hdd/src/wlan_hdd_hang_event.c | 15 +- core/hdd/src/wlan_hdd_hostapd.c | 19 +- core/hdd/src/wlan_hdd_ioctl.c | 13 +- core/hdd/src/wlan_hdd_ipa.c | 15 +- core/hdd/src/wlan_hdd_main.c | 484 ++++++--------------- core/hdd/src/wlan_hdd_nan_datapath.c | 39 +- core/hdd/src/wlan_hdd_oemdata.c | 8 +- core/hdd/src/wlan_hdd_periodic_sta_stats.c | 12 +- core/hdd/src/wlan_hdd_power.c | 60 +-- core/hdd/src/wlan_hdd_regulatory.c | 12 +- core/hdd/src/wlan_hdd_stats.c | 21 +- 14 files changed, 267 insertions(+), 631 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index ac3fa3c46475..d6e634915d12 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -439,79 +439,6 @@ enum hdd_auth_key_mgmt { HDD_AUTH_KEY_MGMT_CCKM = BIT(2) }; -/** - * wlan_net_dev_ref_dbgid - Debug IDs to detect net device reference leaks - */ -/* - * New value added to the enum must also be reflected in function - * net_dev_ref_debug_string_from_id() - */ -typedef enum { - NET_DEV_HOLD_ID_RESERVED = 0, - NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS = 1, - NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER = 2, - NET_DEV_HOLD_GET_SAP_OPERATING_BAND = 3, - NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL = 4, - NET_DEV_HOLD_IS_ANY_STA_CONNECTING = 5, - NET_DEV_HOLD_SAP_DESTROY_CTX_ALL = 6, - NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER = 7, - NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO = 8, - NET_DEV_HOLD_SET_RPS_CPU_MASK = 9, - NET_DEV_HOLD_DFS_INDICATE_RADAR = 10, - NET_DEV_HOLD_MAX_STA_INTERFACE_UP_COUNT_REACHED = 11, - NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS = 12, - NET_DEV_HOLD_STA_DESTROY_CTX_ALL = 13, - NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR = 14, - NET_DEV_HOLD_DEINIT_ALL_ADAPTERS = 15, - NET_DEV_HOLD_STOP_ALL_ADAPTERS = 16, - NET_DEV_HOLD_RESET_ALL_ADAPTERS = 17, - NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN = 18, - NET_DEV_HOLD_START_ALL_ADAPTERS = 19, - NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR = 20, - NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR = 21, - NET_DEV_HOLD_GET_ADAPTER_BY_VDEV = 22, - NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE = 23, - NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME = 24, - NET_DEV_HOLD_GET_ADAPTER = 25, - NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ = 26, - NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS = 27, - NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS = 28, - NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS = 29, - NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER = 30, - NET_DEV_HOLD_CLEAR_RPS_CPU_MASK = 31, - NET_DEV_HOLD_BUS_BW_WORK_HANDLER = 32, - NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT = 33, - NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY = 34, - NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY = 35, - NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP = 36, - NET_DEV_HOLD_INDICATE_MGMT_FRAME = 37, - NET_DEV_HOLD_STATE_INFO_DUMP = 38, - NET_DEV_HOLD_DISABLE_ROAMING = 39, - NET_DEV_HOLD_ENABLE_ROAMING = 40, - NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE = 41, - NET_DEV_HOLD_GET_CON_SAP_ADAPTER = 42, - NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED = 43, - NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS = 44, - NET_DEV_HOLD_DEL_P2P_INTERFACE = 45, - NET_DEV_HOLD_IS_NDP_ALLOWED = 46, - NET_DEV_HOLD_NDI_OPEN = 47, - NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG = 48, - NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY = 49, - NET_DEV_HOLD_SUSPEND_WLAN = 50, - NET_DEV_HOLD_RESUME_WLAN = 51, - NET_DEV_HOLD_SSR_RESTART_SAP = 52, - NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES = 53, - NET_DEV_HOLD_CFG80211_SUSPEND_WLAN = 54, - NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA = 55, - NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP = 56, - NET_DEV_HOLD_CACHE_STATION_STATS_CB = 57, - NET_DEV_HOLD_DISPLAY_TXRX_STATS = 58, - NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT = 59, - - /* Keep it at the end */ - NET_DEV_HOLD_ID_MAX -} wlan_net_dev_ref_dbgid; - /** * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets * received over 100ms intervals @@ -1518,7 +1445,6 @@ struct hdd_adapter { /* Flag to indicate whether it is a pre cac adapter or not */ bool is_pre_cac_adapter; bool delete_in_progress; - uint8_t net_dev_hold_ref_count[NET_DEV_HOLD_ID_MAX]; }; #define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station) @@ -2442,24 +2368,16 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb, void *context); /** - * hdd_adapter_dev_hold_debug - Debug API to call dev_hold - * @adapter: hdd_adapter pointer - * @dbgid: Debug ID corresponding to API that is requesting the dev_hold - * - * Return: none + * __hdd_take_ref_and_fetch_front_adapter - Helper macro to lock, fetch front + * adapter, take ref and unlock. + * @hdd_ctx: the global HDD context + * @adapter: an hdd_adapter pointer to use as a cursor */ -void hdd_adapter_dev_hold_debug(struct hdd_adapter *adapter, - wlan_net_dev_ref_dbgid dbgid); - -/** - * hdd_adapter_dev_put_debug - Debug API to call dev_put - * @adapter: hdd_adapter pointer - * @dbgid: Debug ID corresponding to API that is requesting the dev_put - * - * Return: none - */ -void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, - wlan_net_dev_ref_dbgid dbgid); +#define __hdd_take_ref_and_fetch_front_adapter(hdd_ctx, adapter) \ + qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ + hdd_get_front_adapter_no_lock(hdd_ctx, &adapter), \ + (adapter) ? dev_hold(adapter->dev) : (false), \ + qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) /** * __hdd_take_ref_and_fetch_front_adapter_safe - Helper macro to lock, fetch @@ -2467,16 +2385,26 @@ void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, * @hdd_ctx: the global HDD context * @adapter: an hdd_adapter pointer to use as a cursor * @next_adapter: hdd_adapter pointer to next adapter - * @dbgid: debug ID to detect reference leaks */ #define __hdd_take_ref_and_fetch_front_adapter_safe(hdd_ctx, adapter, \ - next_adapter, dbgid) \ + next_adapter) \ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ hdd_get_front_adapter_no_lock(hdd_ctx, &adapter), \ - (adapter) ? hdd_adapter_dev_hold_debug(adapter, dbgid) : (false), \ + (adapter) ? dev_hold(adapter->dev) : (false), \ hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &next_adapter), \ - (next_adapter) ? hdd_adapter_dev_hold_debug(next_adapter, dbgid) : \ - (false), \ + (next_adapter) ? dev_hold(next_adapter->dev) : (false), \ + qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) + +/** + * __hdd_take_ref_and_fetch_next_adapter - Helper macro to lock, fetch next + * adapter, take ref and unlock. + * @hdd_ctx: the global HDD context + * @adapter: an hdd_adapter pointer to use as a cursor + */ +#define __hdd_take_ref_and_fetch_next_adapter(hdd_ctx, adapter) \ + qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ + hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &adapter), \ + (adapter) ? dev_hold(adapter->dev) : (false), \ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) /** @@ -2485,15 +2413,13 @@ void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, * @hdd_ctx: the global HDD context * @adapter: hdd_adapter pointer to use as a cursor * @next_adapter: hdd_adapter pointer to next adapter - * @dbgid: debug ID to detect reference leaks */ #define __hdd_take_ref_and_fetch_next_adapter_safe(hdd_ctx, adapter, \ - next_adapter, dbgid) \ + next_adapter) \ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ adapter = next_adapter, \ hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &next_adapter), \ - (next_adapter) ? hdd_adapter_dev_hold_debug(next_adapter, dbgid) : \ - (false), \ + (next_adapter) ? dev_hold(next_adapter->dev) : (false), \ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) /** @@ -2517,27 +2443,25 @@ void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, * inside the loop body then the dev_hold has been invoked. * * ***** NOTE ***** - * Before the end of each iteration, hdd_adapter_dev_put_debug(adapter, dbgid) - * must be called. Not calling this will keep hold of a reference, thus - * preventing unregister of the netdevice. If the loop is terminated in - * between with return/goto/break statements, - * hdd_adapter_dev_put_debug(next_adapter, dbgid) must be done along with - * hdd_adapter_dev_put_debug(adapter, dbgid) before termination of the loop. + * Before the end of each iteration, dev_put(adapter->dev) must be + * called. Not calling this will keep hold of a reference, thus preventing + * unregister of the netdevice. If the loop is terminated in between with + * return/goto/break statements, dev_put(next_adapter->dev) must be done + * along with dev_put(adapter->dev) before termination of the loop. * * Usage example: - * hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, dbgid) { - * - * - * hdd_adapter_dev_put_debug(adapter, dbgid) - * } + * hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + * + * + * dev_put(adapter->dev) + * } */ -#define hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, \ - dbgid) \ +#define hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) \ for (__hdd_take_ref_and_fetch_front_adapter_safe(hdd_ctx, adapter, \ - next_adapter, dbgid); \ + next_adapter); \ __hdd_is_adapter_valid(adapter); \ __hdd_take_ref_and_fetch_next_adapter_safe(hdd_ctx, adapter, \ - next_adapter, dbgid)) + next_adapter)) /** * wlan_hdd_get_adapter_by_vdev_id_from_objmgr() - Fetch adapter from objmgr diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index f19f610cf97b..a29943e74c26 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -408,16 +408,13 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *hdd_sta_ctx; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS; if (!hdd_ctx) { hdd_err("HDD context is NULL"); return NULL; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if ((QDF_STA_MODE == adapter->device_mode) || (QDF_P2P_CLIENT_MODE == adapter->device_mode) || @@ -426,10 +423,9 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( hdd_sta_ctx->conn_info.conn_state) { hdd_debug("vdev_id %d: Connection is in progress", adapter->vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } else if ((eConnectionState_Associated == hdd_sta_ctx->conn_info.conn_state) && @@ -438,14 +434,13 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( adapter->vdev_id)) { hdd_debug("vdev_id %d: Key exchange is in progress", adapter->vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 43e8160e17d0..c92f38370ebd 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -5765,11 +5765,8 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter, *next_adapter = NULL; struct hdd_ap_ctx *ap_ctx; struct hdd_station_ctx *sta_ctx; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if ((device_mode == adapter->device_mode) && (device_mode == QDF_SAP_MODE)) { ap_ctx = @@ -5786,10 +5783,9 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx, hdd_ctx->pdev, ap_ctx->operating_chan_freq)) { hdd_err("SAP running on DFS channel"); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } } @@ -5808,14 +5804,13 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx, hdd_ctx->pdev, sta_ctx->conn_info.chan_freq))) { hdd_err("client connected on DFS channel"); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return false; @@ -11970,12 +11965,10 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx) struct hdd_adapter *adapter, *next_adapter = NULL; uint32_t operating_chan_freq; uint8_t sap_operating_band = 0; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_SAP_OPERATING_BAND; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode != QDF_SAP_MODE) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -11988,7 +11981,7 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx) else sap_operating_band = BAND_ALL; - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return sap_operating_band; diff --git a/core/hdd/src/wlan_hdd_hang_event.c b/core/hdd/src/wlan_hdd_hang_event.c index 4302180762f8..93e2f715e3f0 100644 --- a/core/hdd/src/wlan_hdd_hang_event.c +++ b/core/hdd/src/wlan_hdd_hang_event.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -50,7 +50,6 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, struct wlan_objmgr_vdev *vdev; struct hdd_hang_event_fixed_param *cmd; struct hdd_scan_fixed_param *cmd_scan; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL; if (!data) return NOTIFY_STOP_MASK; @@ -77,11 +76,10 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, hdd_hang_data->offset += total_len; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { vdev = hdd_objmgr_get_vdev(adapter); if (!vdev) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } total_len = sizeof(*cmd); @@ -89,10 +87,9 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, if (hdd_hang_data->offset + total_len > QDF_WLAN_HANG_FW_OFFSET) { hdd_objmgr_put_vdev(vdev); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return NOTIFY_STOP_MASK; } cmd = (struct hdd_hang_event_fixed_param *)hdd_buf_ptr; @@ -105,7 +102,7 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, cmd->vdev_substate = wlan_vdev_mlme_get_substate(vdev); hdd_hang_data->offset += total_len; hdd_objmgr_put_vdev(vdev); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NOTIFY_OK; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index dce087e71630..ba3a612bdcbb 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -2894,15 +2894,13 @@ static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_STA_CONNECTING; if (!hdd_ctx) { hdd_err("HDD context is NULL"); return false; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if ((adapter->device_mode == QDF_STA_MODE) || (adapter->device_mode == QDF_P2P_CLIENT_MODE) || @@ -2911,14 +2909,13 @@ static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx) eConnectionState_Connecting) { hdd_debug("vdev_id %d: connecting", adapter->vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return false; @@ -3468,12 +3465,10 @@ void hdd_sap_destroy_ctx_all(struct hdd_context *hdd_ctx, bool is_ssr) hdd_debug("destroying all the sap context"); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_SAP_DESTROY_CTX_ALL) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_SAP_MODE) hdd_sap_destroy_ctx(adapter); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_SAP_DESTROY_CTX_ALL); + dev_put(adapter->dev); } } diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 0e60e658a779..890f7fc50aa5 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -5155,7 +5155,6 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter, struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT; struct qdf_mac_addr selfmac = QDF_MAC_ADDR_BCAST_INIT; struct hdd_adapter *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER; ret = hdd_parse_setmaxtxpower_command(value, &tx_power); if (ret) { @@ -5163,8 +5162,7 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter, return ret; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { /* Assign correct self MAC address */ qdf_copy_macaddr(&bssid, &adapter->mac_addr); @@ -5182,14 +5180,13 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter, if (QDF_STATUS_SUCCESS != status) { hdd_err("Set max tx power failed"); ret = -EINVAL; - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); goto exit; } hdd_debug("Set max tx power success"); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } exit: diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 87edbd5c8316..29bf717eabb7 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -55,7 +55,6 @@ void hdd_ipa_set_tx_flow_info(void) void *soc = cds_get_context(QDF_MODULE_ID_SOC); #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ struct wlan_objmgr_psoc *psoc; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { @@ -71,8 +70,7 @@ void hdd_ipa_set_tx_flow_info(void) psoc = hdd_ctx->psoc; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { switch (adapter->device_mode) { case QDF_STA_MODE: sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); @@ -209,8 +207,7 @@ void hdd_ipa_set_tx_flow_info(void) if (!preAdapterContext) { hdd_err("SCC: Previous adapter context NULL"); - hdd_adapter_dev_put_debug( - adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -259,8 +256,7 @@ void hdd_ipa_set_tx_flow_info(void) if (!adapter5) { hdd_err("MCC: 5GHz adapter context NULL"); - hdd_adapter_dev_put_debug( - adapter, dbgid); + dev_put(adapter->dev); continue; } adapter5->tx_flow_low_watermark = @@ -289,8 +285,7 @@ void hdd_ipa_set_tx_flow_info(void) if (!adapter2_4) { hdd_err("MCC: 2.4GHz adapter context NULL"); - hdd_adapter_dev_put_debug( - adapter, dbgid); + dev_put(adapter->dev); continue; } adapter2_4->tx_flow_low_watermark = @@ -323,7 +318,7 @@ void hdd_ipa_set_tx_flow_info(void) } targetChannel = 0; #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 312de270d0e4..c809ceee5669 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -627,11 +627,9 @@ static void hdd_set_rps_cpu_mask(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_SET_RPS_CPU_MASK) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { hdd_send_rps_ind(adapter); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_SET_RPS_CPU_MASK); + dev_put(adapter->dev); } } @@ -2632,8 +2630,7 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx) return true; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_DFS_INDICATE_RADAR) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter); if ((QDF_SAP_MODE == adapter->device_mode || @@ -2649,8 +2646,7 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx) cds_get_context(QDF_MODULE_ID_SOC), adapter->vdev_id); } - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_DFS_INDICATE_RADAR); + dev_put(adapter->dev); } return true; @@ -3354,23 +3350,19 @@ static bool hdd_is_chan_switch_in_progress(void) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if ((adapter->device_mode == QDF_SAP_MODE || adapter->device_mode == QDF_P2P_GO_MODE) && qdf_atomic_read(&adapter->ch_switch_in_progress)) { hdd_debug("channel switch progress for vdev_id %d", adapter->vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return false; @@ -5860,94 +5852,6 @@ error_init_txrx: } #endif -static char *net_dev_ref_debug_string_from_id(wlan_net_dev_ref_dbgid dbgid) -{ - static const char *strings[] = { - "NET_DEV_HOLD_ID_RESERVED", - "NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS", - "NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER", - "NET_DEV_HOLD_GET_SAP_OPERATING_BAND", - "NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL", - "NET_DEV_HOLD_IS_ANY_STA_CONNECTING", - "NET_DEV_HOLD_SAP_DESTROY_CTX_ALL", - "NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER", - "NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO", - "NET_DEV_HOLD_SET_RPS_CPU_MASK", - "NET_DEV_HOLD_DFS_INDICATE_RADAR", - "NET_DEV_HOLD_MAX_STA_INTERFACE_UP_COUNT_REACHED", - "NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS", - "NET_DEV_HOLD_STA_DESTROY_CTX_ALL", - "NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR", - "NET_DEV_HOLD_DEINIT_ALL_ADAPTERS", - "NET_DEV_HOLD_STOP_ALL_ADAPTERS", - "NET_DEV_HOLD_RESET_ALL_ADAPTERS", - "NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN", - "NET_DEV_HOLD_START_ALL_ADAPTERS", - "NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR", - "NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR", - "NET_DEV_HOLD_GET_ADAPTER_BY_VDEV", - "NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE", - "NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME", - "NET_DEV_HOLD_GET_ADAPTER", - "NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ", - "NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS", - "NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS", - "NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS", - "NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER", - "NET_DEV_HOLD_CLEAR_RPS_CPU_MASK", - "NET_DEV_HOLD_BUS_BW_WORK_HANDLER", - "NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT", - "NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY", - "NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY", - "NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP", - "NET_DEV_HOLD_INDICATE_MGMT_FRAME", - "NET_DEV_HOLD_STATE_INFO_DUMP", - "NET_DEV_HOLD_DISABLE_ROAMING", - "NET_DEV_HOLD_ENABLE_ROAMING", - "NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE", - "NET_DEV_HOLD_GET_CON_SAP_ADAPTER", - "NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED", - "NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS", - "NET_DEV_HOLD_DEL_P2P_INTERFACE", - "NET_DEV_HOLD_IS_NDP_ALLOWED", - "NET_DEV_HOLD_NDI_OPEN", - "NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG", - "NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY", - "NET_DEV_HOLD_SUSPEND_WLAN", - "NET_DEV_HOLD_RESUME_WLAN", - "NET_DEV_HOLD_SSR_RESTART_SAP", - "NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES", - "NET_DEV_HOLD_CFG80211_SUSPEND_WLAN", - "NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA", - "NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP", - "NET_DEV_HOLD_CACHE_STATION_STATS_CB", - "NET_DEV_HOLD_DISPLAY_TXRX_STATS", - "NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT", - "NET_DEV_HOLD_ID_MAX"}; - int32_t num_dbg_strings = QDF_ARRAY_SIZE(strings); - - if (dbgid >= num_dbg_strings) { - char *ret = ""; - - hdd_err("Debug string not found for debug id %d", dbgid); - return ret; - } - - return (char *)strings[dbgid]; -} - -static void hdd_check_for_net_dev_ref_leak(struct hdd_adapter *adapter) -{ - int id; - - for (id = 0; id < NET_DEV_HOLD_ID_MAX; id++) { - if (adapter->net_dev_hold_ref_count[id]) { - hdd_err("net_dev hold reference leak detected for debug id: %s", - net_dev_ref_debug_string_from_id(id)); - } - } -} - /** * hdd_deinit_station_mode() - De-initialize the station adapter * @hdd_ctx: global hdd context @@ -6039,12 +5943,10 @@ void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_STA_DESTROY_CTX_ALL) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_STA_MODE) hdd_cleanup_conn_info(adapter); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_STA_DESTROY_CTX_ALL); + dev_put(adapter->dev); } } #endif @@ -6070,7 +5972,6 @@ static void hdd_cleanup_adapter(struct hdd_context *hdd_ctx, qdf_spinlock_destroy(&adapter->vdev_lock); hdd_sta_info_deinit(&adapter->sta_info_list); hdd_sta_info_deinit(&adapter->cache_sta_info_list); - hdd_check_for_net_dev_ref_leak(adapter); wlan_hdd_debugfs_csr_deinit(adapter); @@ -6103,19 +6004,16 @@ static QDF_STATUS hdd_check_for_existing_macaddr(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (!qdf_mem_cmp(adapter->mac_addr.bytes, mac_addr, sizeof(tSirMacAddr))) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return QDF_STATUS_E_FAILURE; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return QDF_STATUS_SUCCESS; @@ -6616,14 +6514,11 @@ static u8 hdd_get_mode_specific_interface_count(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter = NULL, *next_adapter = NULL; u8 intf_count = 0; - hdd_for_each_adapter_dev_held_safe( - hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == mode) intf_count++; - hdd_adapter_dev_put_debug( - adapter, NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT); + dev_put(adapter->dev); } return intf_count; } @@ -7500,11 +7395,9 @@ void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held) hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_DEINIT_ALL_ADAPTERS) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { hdd_deinit_adapter(hdd_ctx, adapter, rtnl_held); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_DEINIT_ALL_ADAPTERS); + dev_put(adapter->dev); } hdd_exit(); @@ -7519,11 +7412,9 @@ QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx) if (hdd_ctx->sap_pre_cac_work.fn) cds_flush_work(&hdd_ctx->sap_pre_cac_work); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_STOP_ALL_ADAPTERS) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { hdd_stop_adapter(hdd_ctx, adapter); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_STOP_ALL_ADAPTERS); + dev_put(adapter->dev); } hdd_exit(); @@ -7675,8 +7566,7 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx) ucfg_mlme_get_sap_internal_restart(hdd_ctx->psoc, &value); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_RESET_ALL_ADAPTERS) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { hdd_info("[SSR] reset adapter with device mode %s(%d)", qdf_opmode_str(adapter->device_mode), adapter->device_mode); @@ -7729,8 +7619,7 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx) hdd_set_disconnect_status(adapter, false); hdd_debug("Flush any mgmt references held by peer"); hdd_stop_adapter(hdd_ctx, adapter); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_RESET_ALL_ADAPTERS); + dev_put(adapter->dev); } hdd_exit(); @@ -7741,24 +7630,21 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx) bool hdd_is_any_interface_open(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN; if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) { hdd_info("FTM mode, don't close the module"); return true; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags) || test_bit(SME_SESSION_OPENED, &adapter->event_flags)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return false; @@ -8454,15 +8340,13 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) eConnectionState conn_state; bool value; struct wlan_objmgr_vdev *vdev; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_START_ALL_ADAPTERS; hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (!hdd_is_interface_up(adapter) && adapter->device_mode != QDF_NDI_MODE) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -8603,20 +8487,19 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) * applicable to all interfaces */ wlan_hdd_cfg80211_register_frames(adapter); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (!hdd_is_interface_up(adapter)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } if (adapter->device_mode == QDF_P2P_GO_MODE) hdd_stop_p2p_go(adapter); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } hdd_exit(); @@ -8624,35 +8507,6 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) return QDF_STATUS_SUCCESS; } -void hdd_adapter_dev_hold_debug(struct hdd_adapter *adapter, - wlan_net_dev_ref_dbgid dbgid) -{ - if (dbgid >= NET_DEV_HOLD_ID_MAX) { - hdd_err("Invalid debug id: %d", dbgid); - QDF_BUG(0); - } - dev_hold(adapter->dev); - adapter->net_dev_hold_ref_count[dbgid]++; -} - -void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, - wlan_net_dev_ref_dbgid dbgid) -{ - if (dbgid >= NET_DEV_HOLD_ID_MAX) { - hdd_err("Invalid debug id: %d", dbgid); - QDF_BUG(0); - } - - if (adapter->net_dev_hold_ref_count[dbgid] == 0) { - hdd_err("dev_put detected without dev_hold for debug id: %s", - net_dev_ref_debug_string_from_id(dbgid)); - QDF_BUG(0); - } - - dev_put(adapter->dev); - adapter->net_dev_hold_ref_count[dbgid]--; -} - QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx, struct hdd_adapter **out_adapter) { @@ -8841,23 +8695,19 @@ struct hdd_adapter *hdd_get_adapter_by_rand_macaddr( struct hdd_context *hdd_ctx, tSirMacAddr mac_addr) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if ((adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE) && ucfg_p2p_check_random_mac(hdd_ctx->psoc, adapter->vdev_id, mac_addr)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; @@ -8867,19 +8717,16 @@ struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (!qdf_mem_cmp(adapter->mac_addr.bytes, mac_addr, sizeof(tSirMacAddr))) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; @@ -8889,18 +8736,15 @@ struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx, uint32_t vdev_id) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_VDEV; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->vdev_id == vdev_id) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; @@ -8910,19 +8754,16 @@ struct hdd_adapter *hdd_adapter_get_by_reference(struct hdd_context *hdd_ctx, struct hdd_adapter *reference) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter == reference) { dev_hold(adapter->dev); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return adapter; @@ -8937,18 +8778,15 @@ struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx, const char *iface_name) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (!qdf_str_cmp(adapter->dev->name, iface_name)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; @@ -8968,18 +8806,15 @@ struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx, enum QDF_OPMODE mode) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == mode) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; @@ -9010,20 +8845,17 @@ uint32_t hdd_get_operating_chan_freq(struct hdd_context *hdd_ctx, { struct hdd_adapter *adapter, *next_adapter = NULL; uint32_t oper_chan_freq = 0; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (mode == adapter->device_mode) { oper_chan_freq = hdd_get_adapter_home_channel(adapter); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return oper_chan_freq; @@ -9033,13 +8865,10 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS; hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || @@ -9047,7 +8876,7 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * adapter->device_mode == QDF_P2P_GO_MODE) { hdd_unregister_wext(adapter->dev); } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } hdd_exit(); @@ -9058,13 +8887,10 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS; hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || @@ -9074,7 +8900,7 @@ QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx) adapter->vdev_id, INVALID_SCAN_ID, true); } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } hdd_exit(); @@ -9093,11 +8919,8 @@ static QDF_STATUS hdd_abort_sched_scan_all_adapters(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; int err; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || @@ -9107,7 +8930,7 @@ static QDF_STATUS hdd_abort_sched_scan_all_adapters(struct hdd_context *hdd_ctx) if (err) hdd_err("Unable to stop scheduled scan"); } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return QDF_STATUS_SUCCESS; @@ -9463,18 +9286,15 @@ QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx) struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter && adapter->magic == WLAN_HDD_ADAPTER_MAGIC) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return adapter; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return NULL; @@ -9748,11 +9568,9 @@ static void hdd_clear_rps_cpu_mask(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_CLEAR_RPS_CPU_MASK) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { hdd_send_rps_disable_ind(adapter); - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_CLEAR_RPS_CPU_MASK); + dev_put(adapter->dev); } } @@ -10441,7 +10259,6 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) bool connected = false; uint32_t ipa_tx_packets = 0, ipa_rx_packets = 0; uint64_t sta_tx_bytes = 0, sap_tx_bytes = 0; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_BUS_BW_WORK_HANDLER; if (wlan_hdd_validate_context(hdd_ctx)) goto stop_work; @@ -10449,14 +10266,13 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) if (hdd_ctx->is_wiphy_suspended) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { /* * Validate magic so we don't end up accessing * an invalid adapter. */ if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -10464,14 +10280,16 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) adapter->device_mode == QDF_P2P_CLIENT_MODE) && WLAN_HDD_GET_STATION_CTX_PTR(adapter)->conn_info.conn_state != eConnectionState_Associated) { - hdd_adapter_dev_put_debug(adapter, dbgid); + + dev_put(adapter->dev); continue; } if ((adapter->device_mode == QDF_SAP_MODE || adapter->device_mode == QDF_P2P_GO_MODE) && WLAN_HDD_GET_AP_CTX_PTR(adapter)->ap_active == false) { - hdd_adapter_dev_put_debug(adapter, dbgid); + + dev_put(adapter->dev); continue; } @@ -10529,7 +10347,7 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) adapter->prev_tx_bytes = adapter->stats.tx_bytes; qdf_spin_unlock_bh(&hdd_ctx->bus_bw_lock); connected = true; - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } if (!connected) { @@ -10936,8 +10754,6 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) char *comb_log_str; uint32_t comb_log_str_size; struct hdd_adapter *adapter = NULL, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT; comb_log_str_size = (ADAP_NETIFQ_LOG_LEN * WLAN_MAX_VDEVS) + 1; comb_log_str = qdf_mem_malloc(comb_log_str_size); @@ -10946,8 +10762,7 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) bytes_written = 0; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { curr_time = qdf_system_ticks(); total = curr_time - adapter->start_time; delta = curr_time - adapter->last_time; @@ -10992,7 +10807,7 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) adapter_num++; /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } /* using QDF_TRACE to avoid printing function name */ @@ -11107,23 +10922,20 @@ wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx, enum qdf_stats_verbosity_level verb_lvl) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = - NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY; if (verb_lvl == QDF_STATS_VERBOSITY_LEVEL_LOW) { hdd_display_netif_queue_history_compact(hdd_ctx); return; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->vdev_id == CDP_INVALID_VDEV_ID) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } wlan_hdd_display_adapter_netif_queue_stats(adapter); /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -11136,10 +10948,8 @@ wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx, void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { qdf_mem_zero(adapter->queue_oper_stats, sizeof(adapter->queue_oper_stats)); qdf_mem_zero(adapter->queue_oper_history, @@ -11148,7 +10958,7 @@ void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx) adapter->start_time = adapter->last_time = qdf_system_ticks(); adapter->total_pause_time = 0; adapter->total_unpause_time = 0; - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -11419,16 +11229,14 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) bool is_acs_support_for_dfs_ltecoex = cfg_default(CFG_USER_ACS_DFS_LTE); bool is_vendor_acs_support = cfg_default(CFG_USER_AUTO_CHANNEL_SELECTION); - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP; - hdd_for_each_adapter_dev_held_safe(hdd_ctxt, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctxt, adapter, next_adapter) { if (!(adapter->device_mode == QDF_SAP_MODE && adapter->session.ap.sap_config.acs_cfg.acs_mode)) { hdd_debug_rl("skip device mode:%d acs:%d", adapter->device_mode, adapter->session.ap.sap_config.acs_cfg.acs_mode); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -11472,7 +11280,7 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) restart_chan_store); hdd_debug("ch:%d is safe. no need to change channel", ap_chan); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -11491,7 +11299,7 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) if (is_vendor_acs_support && is_acs_support_for_dfs_ltecoex) { hdd_update_acs_timer_reason(adapter, QCA_WLAN_VENDOR_ACS_SELECT_REASON_LTE_COEX); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -11535,10 +11343,9 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) CSA_REASON_UNSAFE_CHANNEL); hdd_switch_sap_channel(adapter, restart_chan, true); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return; } else { @@ -11546,15 +11353,14 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) wlan_hdd_send_svc_nlink_msg( hdd_ctxt->radio_index, WLAN_SVC_LTE_COEX_IND, NULL, 0); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return; } } /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -11734,7 +11540,6 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) (struct ieee80211_mgmt *)frame_ind->frameBuf; QDF_STATUS status; struct wlan_objmgr_vdev *vdev; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_INDICATE_MGMT_FRAME; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (wlan_hdd_validate_context(hdd_ctx)) @@ -11755,11 +11560,11 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) } else if (SME_SESSION_ID_BROADCAST == frame_ind->sessionId) { num_adapters = 0; hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, - next_adapter, dbgid) { + next_adapter) { vdev_id[num_adapters] = adapter->vdev_id; num_adapters++; /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } adapter = NULL; @@ -14576,7 +14381,6 @@ static void hdd_state_info_dump(char **buf_ptr, uint16_t *size) struct hdd_adapter *adapter, *next_adapter = NULL; uint16_t len = 0; char *buf = *buf_ptr; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_STATE_INFO_DUMP; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { @@ -14592,8 +14396,7 @@ static void hdd_state_info_dump(char **buf_ptr, uint16_t *size) "\n is_scheduler_suspended %d", hdd_ctx->is_scheduler_suspended); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { len += scnprintf(buf + len, *size - len, "\n device name: %s", adapter->dev->name); len += scnprintf(buf + len, *size - len, @@ -14610,7 +14413,7 @@ static void hdd_state_info_dump(char **buf_ptr, uint16_t *size) default: break; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } *size -= len; @@ -15523,13 +15326,11 @@ wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter, struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_adapter); struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISABLE_ROAMING; if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (cur_adapter->vdev_id != adapter->vdev_id && @@ -15541,7 +15342,7 @@ wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter, REASON_DRIVER_DISABLED, rso_op_requestor); } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -15552,13 +15353,11 @@ wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter, struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_adapter); struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_ENABLE_ROAMING; if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (cur_adapter->vdev_id != adapter->vdev_id && @@ -15570,7 +15369,7 @@ wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter, REASON_DRIVER_ENABLED, rso_op_requestor); } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -15695,7 +15494,6 @@ void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable) struct hdd_adapter *adapter, *next_adapter = NULL; bool ap_connected = false, sta_connected = false; mac_handle_t mac_handle; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE; mac_handle = hdd_ctx->mac_handle; if (!mac_handle) @@ -15717,18 +15515,15 @@ void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable) /* To enable shutdown timer check conncurrency */ if (policy_mgr_concurrent_open_sessions_running(hdd_ctx->psoc)) { hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, - next_adapter, dbgid) { + next_adapter) { if (adapter->device_mode == QDF_STA_MODE) { if (WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> conn_info.conn_state == eConnectionState_Associated) { sta_connected = true; - hdd_adapter_dev_put_debug(adapter, - dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug( - next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } } @@ -15737,16 +15532,13 @@ void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable) if (WLAN_HDD_GET_AP_CTX_PTR(adapter)-> ap_active == true) { ap_connected = true; - hdd_adapter_dev_put_debug(adapter, - dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug( - next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -15771,12 +15563,10 @@ hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter, { struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(this_sap_adapter); struct hdd_adapter *adapter, *con_sap_adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_CON_SAP_ADAPTER; con_sap_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter && ((adapter->device_mode == QDF_SAP_MODE) || (adapter->device_mode == QDF_P2P_GO_MODE)) && adapter != this_sap_adapter) { @@ -15784,24 +15574,20 @@ hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter, if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { con_sap_adapter = adapter; - hdd_adapter_dev_put_debug(adapter, - dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug( - next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } } else { con_sap_adapter = adapter; - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return con_sap_adapter; @@ -15822,39 +15608,34 @@ static inline bool hdd_adapter_is_ap(struct hdd_adapter *adapter) bool hdd_is_any_adapter_connected(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (hdd_adapter_is_sta(adapter) && WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> conn_info.conn_state == eConnectionState_Associated) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } if (hdd_adapter_is_ap(adapter) && WLAN_HDD_GET_AP_CTX_PTR(adapter)->ap_active) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } if (adapter->device_mode == QDF_NDI_MODE && WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> conn_info.conn_state == eConnectionState_NdiConnected) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return false; @@ -18031,7 +17812,6 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; uint8_t vdev_id; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS; if (!hdd_ctx) { hdd_err("HDD context is NULL"); @@ -18041,8 +17821,7 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx) if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) return false; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { vdev_id = adapter->vdev_id; if (adapter->device_mode == QDF_STA_MODE && (MLME_IS_ROAM_SYNCH_IN_PROGRESS(hdd_ctx->psoc, vdev_id) || @@ -18051,13 +17830,12 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx) vdev_id))) { hdd_debug("Roaming is in progress on:vdev_id:%d", adapter->vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return true; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return false; @@ -18595,8 +18373,7 @@ wlan_hdd_del_p2p_interface(struct hdd_context *hdd_ctx) struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct osif_vdev_sync *vdev_sync; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_DEL_P2P_INTERFACE) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || adapter->device_mode == QDF_P2P_GO_MODE) { @@ -18609,8 +18386,7 @@ wlan_hdd_del_p2p_interface(struct hdd_context *hdd_ctx) if (vdev_sync) osif_vdev_sync_destroy(vdev_sync); } - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_DEL_P2P_INTERFACE); + dev_put(adapter->dev); } } diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index a6c6f65a6b80..98a8e4cfc9bd 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -124,18 +124,15 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_NDP_ALLOWED; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { switch (adapter->device_mode) { case QDF_P2P_GO_MODE: if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return false; } break; @@ -143,17 +140,16 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (hdd_conn_is_connected(sta_ctx) || hdd_is_connecting(sta_ctx)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return false; } break; default: break; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return true; @@ -163,19 +159,16 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_NDP_ALLOWED; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { switch (adapter->device_mode) { case QDF_P2P_GO_MODE: case QDF_SAP_MODE: if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return false; } break; @@ -183,17 +176,16 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (hdd_conn_is_connected(sta_ctx) || hdd_is_connecting(sta_ctx)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return false; } break; default: break; } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } return true; @@ -584,11 +576,10 @@ int hdd_ndi_open(char *iface_name) return -EINVAL; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_NDI_OPEN) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (WLAN_HDD_IS_NDI(adapter)) ndi_adapter_count++; - hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_NDI_OPEN); + dev_put(adapter->dev); } if (ndi_adapter_count >= MAX_NDI_ADAPTERS) { hdd_err("Can't allow more than %d NDI adapters", diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 0194b48f9911..6d17436b6734 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -191,7 +191,6 @@ static void send_oem_reg_rsp_nlink_msg(void) uint8_t *device_mode; uint8_t *vdev_id; struct hdd_adapter *adapter, *next_adapter = NULL; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG; /* OEM msg is always to a specific process & cannot be a broadcast */ if (p_hdd_ctx->oem_pid == 0) { @@ -222,8 +221,7 @@ static void send_oem_reg_rsp_nlink_msg(void) *num_interfaces = 0; /* Iterate through each adapter and fill device mode and vdev id */ - hdd_for_each_adapter_dev_held_safe(p_hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(p_hdd_ctx, adapter, next_adapter) { device_mode = buf++; vdev_id = buf++; *device_mode = adapter->device_mode; @@ -232,7 +230,7 @@ static void send_oem_reg_rsp_nlink_msg(void) hdd_debug("num_interfaces: %d, device_mode: %d, vdev_id: %d", *num_interfaces, *device_mode, *vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } ani_hdr->length = diff --git a/core/hdd/src/wlan_hdd_periodic_sta_stats.c b/core/hdd/src/wlan_hdd_periodic_sta_stats.c index 887813ba1ce9..c9dd8eb3415b 100644 --- a/core/hdd/src/wlan_hdd_periodic_sta_stats.c +++ b/core/hdd/src/wlan_hdd_periodic_sta_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -46,17 +46,15 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx) struct hdd_config *hdd_cfg; char *dev_name; bool should_log; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY; if (!hdd_ctx) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { should_log = false; if (adapter->device_mode != QDF_STA_MODE) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -65,7 +63,7 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx) if (!adapter->is_sta_periodic_stats_enabled) { qdf_mutex_release(&adapter->sta_periodic_stats_lock); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -94,7 +92,7 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx) hdd_nofl_info("%s: Rx DNS responses: %d", dev_name, sta_stats.hdd_dns_stats.rx_dns_rsp_count); } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index a43b17c6fb25..0031c8a95b10 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1320,11 +1320,9 @@ hdd_suspend_wlan(void) return -EINVAL; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_SUSPEND_WLAN) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_SUSPEND_WLAN); + dev_put(adapter->dev); continue; } @@ -1341,7 +1339,7 @@ hdd_suspend_wlan(void) /* Configure supported OffLoads */ hdd_enable_host_offloads(adapter, pmo_apps_suspend); hdd_update_conn_state_mask(adapter, &conn_state_mask); - hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_SUSPEND_WLAN); + dev_put(adapter->dev); } status = ucfg_pmo_psoc_user_space_suspend_req(hdd_ctx->psoc, @@ -1387,11 +1385,9 @@ static int hdd_resume_wlan(void) hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_RESUME); /*loop through all adapters. Concurrency */ - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_RESUME_WLAN) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_RESUME_WLAN); + dev_put(adapter->dev); continue; } @@ -1408,7 +1404,7 @@ static int hdd_resume_wlan(void) if (adapter->device_mode == QDF_STA_MODE) status = hdd_disable_default_pkt_filters(adapter); - hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_RESUME_WLAN); + dev_put(adapter->dev); } ucfg_ipa_resume(hdd_ctx->pdev); @@ -1445,16 +1441,14 @@ static void hdd_ssr_restart_sap(struct hdd_context *hdd_ctx) hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_SSR_RESTART_SAP) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->device_mode == QDF_SAP_MODE) { if (test_bit(SOFTAP_INIT_DONE, &adapter->event_flags)) { hdd_debug("Restart prev SAP session"); wlan_hdd_start_sap(adapter, true); } } - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_SSR_RESTART_SAP); + dev_put(adapter->dev); } hdd_exit(); @@ -1576,8 +1570,7 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (hdd_is_interface_up(adapter) && (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE) && @@ -1587,8 +1580,7 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx) adapter->scan_info.default_scan_ies, adapter->scan_info.default_scan_ies_len); } - hdd_adapter_dev_put_debug(adapter, - NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES); + dev_put(adapter->dev); } } @@ -2017,7 +2009,6 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, mac_handle_t mac_handle; struct wlan_objmgr_vdev *vdev; int rc; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CFG80211_SUSPEND_WLAN; hdd_enter(); @@ -2051,10 +2042,9 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, * "dfs_cac_block_tx" is set to true when RADAR is found and stay true * until CAC is done for a SoftAP which is in started state. */ - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -2067,10 +2057,9 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, hdd_err("RADAR detection in progress, do not allow suspend"); wlan_hdd_inc_suspend_stats(hdd_ctx, SUSPEND_FAIL_RADAR); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return -EAGAIN; } else if (!ucfg_pmo_get_enable_sap_suspend( hdd_ctx->psoc)) { @@ -2078,10 +2067,9 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, * suspend */ hdd_err("SAP does not support suspend!!"); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return -EOPNOTSUPP; } } else if (QDF_P2P_GO_MODE == adapter->device_mode) { @@ -2091,14 +2079,13 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, * suspend */ hdd_err("GO does not support suspend!!"); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); return -EOPNOTSUPP; } } - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } /* p2p cleanup task based on scheduler */ ucfg_p2p_cleanup_tx_by_psoc(hdd_ctx->psoc); @@ -2110,15 +2097,14 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, } /* flush any pending powersave timers */ - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } sme_ps_timer_flush_sync(mac_handle, adapter->vdev_id); - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } /* diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 2f573f65b250..391cd376e4ab 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1397,12 +1397,10 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx) bool freq_changed, phy_changed; qdf_freq_t oper_freq; eCsrPhyMode csr_phy_mode; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA; pdev = hdd_ctx->pdev; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { oper_freq = hdd_get_adapter_home_channel(adapter); freq_changed = wlan_reg_is_disable_for_freq(pdev, oper_freq); @@ -1435,7 +1433,7 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx) break; } /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } @@ -1527,12 +1525,10 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx) bool phy_changed; qdf_freq_t oper_freq; eCsrPhyMode csr_phy_mode; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP; pdev = hdd_ctx->pdev; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { oper_freq = hdd_get_adapter_home_channel(adapter); switch (adapter->device_mode) { @@ -1565,7 +1561,7 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx) break; } /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); } } diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 5e2c809fe940..484889ff8d9e 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1747,20 +1747,17 @@ static void cache_station_stats_cb(struct stats_event *ev, void *cookie) struct hdd_adapter *adapter = cookie, *next_adapter = NULL; struct hdd_context *hdd_ctx = adapter->hdd_ctx; uint8_t vdev_id = adapter->vdev_id; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISPLAY_TXRX_STATS; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { if (adapter->vdev_id != vdev_id) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } copy_station_stats_to_adapter(adapter, ev); /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); if (next_adapter) - hdd_adapter_dev_put_debug(next_adapter, - dbgid); + dev_put(next_adapter->dev); break; } } @@ -6573,10 +6570,8 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) int i = 0; uint32_t total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused; - wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CACHE_STATION_STATS_CB; - hdd_for_each_adapter_dev_held_safe(ctx, adapter, next_adapter, - dbgid) { + hdd_for_each_adapter_dev_held_safe(ctx, adapter, next_adapter) { total_rx_pkt = 0; total_rx_dropped = 0; total_rx_delv = 0; @@ -6584,7 +6579,7 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) stats = &adapter->hdd_stats.tx_rx_stats; if (adapter->vdev_id == INVAL_VDEV_ID) { - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); continue; } @@ -6597,7 +6592,7 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) } /* dev_put has to be done here */ - hdd_adapter_dev_put_debug(adapter, dbgid); + dev_put(adapter->dev); hdd_debug("TX - called %u, dropped %u orphan %u", stats->tx_called, stats->tx_dropped, From b331bbdee16b3916e77d4879d71abffce6d0793e Mon Sep 17 00:00:00 2001 From: Niranjan Reddy Dumbala Date: Sun, 21 Feb 2021 14:08:54 +0530 Subject: [PATCH 08/55] Revert "Revert "qcacld-3.0: Add debug infra to detect reference leaks for dev_hold"" This reverts commit bdfc26efc4c178eded3e3748e1542df65e483f83. Change-Id: I0d2a4cd35027215acdb971744eb7732a0d0d74bf --- core/hdd/inc/wlan_hdd_main.h | 156 +++++-- core/hdd/src/wlan_hdd_assoc.c | 19 +- core/hdd/src/wlan_hdd_cfg80211.c | 25 +- core/hdd/src/wlan_hdd_hang_event.c | 15 +- core/hdd/src/wlan_hdd_hostapd.c | 19 +- core/hdd/src/wlan_hdd_ioctl.c | 13 +- core/hdd/src/wlan_hdd_ipa.c | 15 +- core/hdd/src/wlan_hdd_main.c | 484 +++++++++++++++------ core/hdd/src/wlan_hdd_nan_datapath.c | 39 +- core/hdd/src/wlan_hdd_oemdata.c | 8 +- core/hdd/src/wlan_hdd_periodic_sta_stats.c | 12 +- core/hdd/src/wlan_hdd_power.c | 60 ++- core/hdd/src/wlan_hdd_regulatory.c | 12 +- core/hdd/src/wlan_hdd_stats.c | 21 +- 14 files changed, 631 insertions(+), 267 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index d6e634915d12..ac3fa3c46475 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -439,6 +439,79 @@ enum hdd_auth_key_mgmt { HDD_AUTH_KEY_MGMT_CCKM = BIT(2) }; +/** + * wlan_net_dev_ref_dbgid - Debug IDs to detect net device reference leaks + */ +/* + * New value added to the enum must also be reflected in function + * net_dev_ref_debug_string_from_id() + */ +typedef enum { + NET_DEV_HOLD_ID_RESERVED = 0, + NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS = 1, + NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER = 2, + NET_DEV_HOLD_GET_SAP_OPERATING_BAND = 3, + NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL = 4, + NET_DEV_HOLD_IS_ANY_STA_CONNECTING = 5, + NET_DEV_HOLD_SAP_DESTROY_CTX_ALL = 6, + NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER = 7, + NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO = 8, + NET_DEV_HOLD_SET_RPS_CPU_MASK = 9, + NET_DEV_HOLD_DFS_INDICATE_RADAR = 10, + NET_DEV_HOLD_MAX_STA_INTERFACE_UP_COUNT_REACHED = 11, + NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS = 12, + NET_DEV_HOLD_STA_DESTROY_CTX_ALL = 13, + NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR = 14, + NET_DEV_HOLD_DEINIT_ALL_ADAPTERS = 15, + NET_DEV_HOLD_STOP_ALL_ADAPTERS = 16, + NET_DEV_HOLD_RESET_ALL_ADAPTERS = 17, + NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN = 18, + NET_DEV_HOLD_START_ALL_ADAPTERS = 19, + NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR = 20, + NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR = 21, + NET_DEV_HOLD_GET_ADAPTER_BY_VDEV = 22, + NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE = 23, + NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME = 24, + NET_DEV_HOLD_GET_ADAPTER = 25, + NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ = 26, + NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS = 27, + NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS = 28, + NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS = 29, + NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER = 30, + NET_DEV_HOLD_CLEAR_RPS_CPU_MASK = 31, + NET_DEV_HOLD_BUS_BW_WORK_HANDLER = 32, + NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT = 33, + NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY = 34, + NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY = 35, + NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP = 36, + NET_DEV_HOLD_INDICATE_MGMT_FRAME = 37, + NET_DEV_HOLD_STATE_INFO_DUMP = 38, + NET_DEV_HOLD_DISABLE_ROAMING = 39, + NET_DEV_HOLD_ENABLE_ROAMING = 40, + NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE = 41, + NET_DEV_HOLD_GET_CON_SAP_ADAPTER = 42, + NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED = 43, + NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS = 44, + NET_DEV_HOLD_DEL_P2P_INTERFACE = 45, + NET_DEV_HOLD_IS_NDP_ALLOWED = 46, + NET_DEV_HOLD_NDI_OPEN = 47, + NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG = 48, + NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY = 49, + NET_DEV_HOLD_SUSPEND_WLAN = 50, + NET_DEV_HOLD_RESUME_WLAN = 51, + NET_DEV_HOLD_SSR_RESTART_SAP = 52, + NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES = 53, + NET_DEV_HOLD_CFG80211_SUSPEND_WLAN = 54, + NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA = 55, + NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP = 56, + NET_DEV_HOLD_CACHE_STATION_STATS_CB = 57, + NET_DEV_HOLD_DISPLAY_TXRX_STATS = 58, + NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT = 59, + + /* Keep it at the end */ + NET_DEV_HOLD_ID_MAX +} wlan_net_dev_ref_dbgid; + /** * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets * received over 100ms intervals @@ -1445,6 +1518,7 @@ struct hdd_adapter { /* Flag to indicate whether it is a pre cac adapter or not */ bool is_pre_cac_adapter; bool delete_in_progress; + uint8_t net_dev_hold_ref_count[NET_DEV_HOLD_ID_MAX]; }; #define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station) @@ -2368,16 +2442,24 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb, void *context); /** - * __hdd_take_ref_and_fetch_front_adapter - Helper macro to lock, fetch front - * adapter, take ref and unlock. - * @hdd_ctx: the global HDD context - * @adapter: an hdd_adapter pointer to use as a cursor + * hdd_adapter_dev_hold_debug - Debug API to call dev_hold + * @adapter: hdd_adapter pointer + * @dbgid: Debug ID corresponding to API that is requesting the dev_hold + * + * Return: none */ -#define __hdd_take_ref_and_fetch_front_adapter(hdd_ctx, adapter) \ - qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ - hdd_get_front_adapter_no_lock(hdd_ctx, &adapter), \ - (adapter) ? dev_hold(adapter->dev) : (false), \ - qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) +void hdd_adapter_dev_hold_debug(struct hdd_adapter *adapter, + wlan_net_dev_ref_dbgid dbgid); + +/** + * hdd_adapter_dev_put_debug - Debug API to call dev_put + * @adapter: hdd_adapter pointer + * @dbgid: Debug ID corresponding to API that is requesting the dev_put + * + * Return: none + */ +void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, + wlan_net_dev_ref_dbgid dbgid); /** * __hdd_take_ref_and_fetch_front_adapter_safe - Helper macro to lock, fetch @@ -2385,26 +2467,16 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb, * @hdd_ctx: the global HDD context * @adapter: an hdd_adapter pointer to use as a cursor * @next_adapter: hdd_adapter pointer to next adapter + * @dbgid: debug ID to detect reference leaks */ #define __hdd_take_ref_and_fetch_front_adapter_safe(hdd_ctx, adapter, \ - next_adapter) \ + next_adapter, dbgid) \ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ hdd_get_front_adapter_no_lock(hdd_ctx, &adapter), \ - (adapter) ? dev_hold(adapter->dev) : (false), \ + (adapter) ? hdd_adapter_dev_hold_debug(adapter, dbgid) : (false), \ hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &next_adapter), \ - (next_adapter) ? dev_hold(next_adapter->dev) : (false), \ - qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) - -/** - * __hdd_take_ref_and_fetch_next_adapter - Helper macro to lock, fetch next - * adapter, take ref and unlock. - * @hdd_ctx: the global HDD context - * @adapter: an hdd_adapter pointer to use as a cursor - */ -#define __hdd_take_ref_and_fetch_next_adapter(hdd_ctx, adapter) \ - qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ - hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &adapter), \ - (adapter) ? dev_hold(adapter->dev) : (false), \ + (next_adapter) ? hdd_adapter_dev_hold_debug(next_adapter, dbgid) : \ + (false), \ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) /** @@ -2413,13 +2485,15 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb, * @hdd_ctx: the global HDD context * @adapter: hdd_adapter pointer to use as a cursor * @next_adapter: hdd_adapter pointer to next adapter + * @dbgid: debug ID to detect reference leaks */ #define __hdd_take_ref_and_fetch_next_adapter_safe(hdd_ctx, adapter, \ - next_adapter) \ + next_adapter, dbgid) \ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \ adapter = next_adapter, \ hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &next_adapter), \ - (next_adapter) ? dev_hold(next_adapter->dev) : (false), \ + (next_adapter) ? hdd_adapter_dev_hold_debug(next_adapter, dbgid) : \ + (false), \ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock) /** @@ -2443,25 +2517,27 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb, * inside the loop body then the dev_hold has been invoked. * * ***** NOTE ***** - * Before the end of each iteration, dev_put(adapter->dev) must be - * called. Not calling this will keep hold of a reference, thus preventing - * unregister of the netdevice. If the loop is terminated in between with - * return/goto/break statements, dev_put(next_adapter->dev) must be done - * along with dev_put(adapter->dev) before termination of the loop. + * Before the end of each iteration, hdd_adapter_dev_put_debug(adapter, dbgid) + * must be called. Not calling this will keep hold of a reference, thus + * preventing unregister of the netdevice. If the loop is terminated in + * between with return/goto/break statements, + * hdd_adapter_dev_put_debug(next_adapter, dbgid) must be done along with + * hdd_adapter_dev_put_debug(adapter, dbgid) before termination of the loop. * * Usage example: - * hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { - * - * - * dev_put(adapter->dev) - * } + * hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, dbgid) { + * + * + * hdd_adapter_dev_put_debug(adapter, dbgid) + * } */ -#define hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) \ +#define hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, \ + dbgid) \ for (__hdd_take_ref_and_fetch_front_adapter_safe(hdd_ctx, adapter, \ - next_adapter); \ + next_adapter, dbgid); \ __hdd_is_adapter_valid(adapter); \ __hdd_take_ref_and_fetch_next_adapter_safe(hdd_ctx, adapter, \ - next_adapter)) + next_adapter, dbgid)) /** * wlan_hdd_get_adapter_by_vdev_id_from_objmgr() - Fetch adapter from objmgr diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index a29943e74c26..f19f610cf97b 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -408,13 +408,16 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *hdd_sta_ctx; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS; if (!hdd_ctx) { hdd_err("HDD context is NULL"); return NULL; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if ((QDF_STA_MODE == adapter->device_mode) || (QDF_P2P_CLIENT_MODE == adapter->device_mode) || @@ -423,9 +426,10 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( hdd_sta_ctx->conn_info.conn_state) { hdd_debug("vdev_id %d: Connection is in progress", adapter->vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } else if ((eConnectionState_Associated == hdd_sta_ctx->conn_info.conn_state) && @@ -434,13 +438,14 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( adapter->vdev_id)) { hdd_debug("vdev_id %d: Key exchange is in progress", adapter->vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index c92f38370ebd..43e8160e17d0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -5765,8 +5765,11 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter, *next_adapter = NULL; struct hdd_ap_ctx *ap_ctx; struct hdd_station_ctx *sta_ctx; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if ((device_mode == adapter->device_mode) && (device_mode == QDF_SAP_MODE)) { ap_ctx = @@ -5783,9 +5786,10 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx, hdd_ctx->pdev, ap_ctx->operating_chan_freq)) { hdd_err("SAP running on DFS channel"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } } @@ -5804,13 +5808,14 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx, hdd_ctx->pdev, sta_ctx->conn_info.chan_freq))) { hdd_err("client connected on DFS channel"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return false; @@ -11965,10 +11970,12 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx) struct hdd_adapter *adapter, *next_adapter = NULL; uint32_t operating_chan_freq; uint8_t sap_operating_band = 0; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_SAP_OPERATING_BAND; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->device_mode != QDF_SAP_MODE) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -11981,7 +11988,7 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx) else sap_operating_band = BAND_ALL; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return sap_operating_band; diff --git a/core/hdd/src/wlan_hdd_hang_event.c b/core/hdd/src/wlan_hdd_hang_event.c index 93e2f715e3f0..4302180762f8 100644 --- a/core/hdd/src/wlan_hdd_hang_event.c +++ b/core/hdd/src/wlan_hdd_hang_event.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2021, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -50,6 +50,7 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, struct wlan_objmgr_vdev *vdev; struct hdd_hang_event_fixed_param *cmd; struct hdd_scan_fixed_param *cmd_scan; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL; if (!data) return NOTIFY_STOP_MASK; @@ -76,10 +77,11 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, hdd_hang_data->offset += total_len; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { vdev = hdd_objmgr_get_vdev(adapter); if (!vdev) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } total_len = sizeof(*cmd); @@ -87,9 +89,10 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, if (hdd_hang_data->offset + total_len > QDF_WLAN_HANG_FW_OFFSET) { hdd_objmgr_put_vdev(vdev); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return NOTIFY_STOP_MASK; } cmd = (struct hdd_hang_event_fixed_param *)hdd_buf_ptr; @@ -102,7 +105,7 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block, cmd->vdev_substate = wlan_vdev_mlme_get_substate(vdev); hdd_hang_data->offset += total_len; hdd_objmgr_put_vdev(vdev); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NOTIFY_OK; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index ba3a612bdcbb..dce087e71630 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -2894,13 +2894,15 @@ static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_STA_CONNECTING; if (!hdd_ctx) { hdd_err("HDD context is NULL"); return false; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if ((adapter->device_mode == QDF_STA_MODE) || (adapter->device_mode == QDF_P2P_CLIENT_MODE) || @@ -2909,13 +2911,14 @@ static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx) eConnectionState_Connecting) { hdd_debug("vdev_id %d: connecting", adapter->vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return false; @@ -3465,10 +3468,12 @@ void hdd_sap_destroy_ctx_all(struct hdd_context *hdd_ctx, bool is_ssr) hdd_debug("destroying all the sap context"); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_SAP_DESTROY_CTX_ALL) { if (adapter->device_mode == QDF_SAP_MODE) hdd_sap_destroy_ctx(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_SAP_DESTROY_CTX_ALL); } } diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 890f7fc50aa5..0e60e658a779 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -5155,6 +5155,7 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter, struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT; struct qdf_mac_addr selfmac = QDF_MAC_ADDR_BCAST_INIT; struct hdd_adapter *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER; ret = hdd_parse_setmaxtxpower_command(value, &tx_power); if (ret) { @@ -5162,7 +5163,8 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter, return ret; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { /* Assign correct self MAC address */ qdf_copy_macaddr(&bssid, &adapter->mac_addr); @@ -5180,13 +5182,14 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter, if (QDF_STATUS_SUCCESS != status) { hdd_err("Set max tx power failed"); ret = -EINVAL; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); goto exit; } hdd_debug("Set max tx power success"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } exit: diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 29bf717eabb7..87edbd5c8316 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -55,6 +55,7 @@ void hdd_ipa_set_tx_flow_info(void) void *soc = cds_get_context(QDF_MODULE_ID_SOC); #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ struct wlan_objmgr_psoc *psoc; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { @@ -70,7 +71,8 @@ void hdd_ipa_set_tx_flow_info(void) psoc = hdd_ctx->psoc; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { switch (adapter->device_mode) { case QDF_STA_MODE: sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); @@ -207,7 +209,8 @@ void hdd_ipa_set_tx_flow_info(void) if (!preAdapterContext) { hdd_err("SCC: Previous adapter context NULL"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug( + adapter, dbgid); continue; } @@ -256,7 +259,8 @@ void hdd_ipa_set_tx_flow_info(void) if (!adapter5) { hdd_err("MCC: 5GHz adapter context NULL"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug( + adapter, dbgid); continue; } adapter5->tx_flow_low_watermark = @@ -285,7 +289,8 @@ void hdd_ipa_set_tx_flow_info(void) if (!adapter2_4) { hdd_err("MCC: 2.4GHz adapter context NULL"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug( + adapter, dbgid); continue; } adapter2_4->tx_flow_low_watermark = @@ -318,7 +323,7 @@ void hdd_ipa_set_tx_flow_info(void) } targetChannel = 0; #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c809ceee5669..312de270d0e4 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -627,9 +627,11 @@ static void hdd_set_rps_cpu_mask(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_SET_RPS_CPU_MASK) { hdd_send_rps_ind(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_SET_RPS_CPU_MASK); } } @@ -2630,7 +2632,8 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx) return true; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_DFS_INDICATE_RADAR) { ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter); if ((QDF_SAP_MODE == adapter->device_mode || @@ -2646,7 +2649,8 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx) cds_get_context(QDF_MODULE_ID_SOC), adapter->vdev_id); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_DFS_INDICATE_RADAR); } return true; @@ -3350,19 +3354,23 @@ static bool hdd_is_chan_switch_in_progress(void) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if ((adapter->device_mode == QDF_SAP_MODE || adapter->device_mode == QDF_P2P_GO_MODE) && qdf_atomic_read(&adapter->ch_switch_in_progress)) { hdd_debug("channel switch progress for vdev_id %d", adapter->vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return false; @@ -5852,6 +5860,94 @@ error_init_txrx: } #endif +static char *net_dev_ref_debug_string_from_id(wlan_net_dev_ref_dbgid dbgid) +{ + static const char *strings[] = { + "NET_DEV_HOLD_ID_RESERVED", + "NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS", + "NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER", + "NET_DEV_HOLD_GET_SAP_OPERATING_BAND", + "NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL", + "NET_DEV_HOLD_IS_ANY_STA_CONNECTING", + "NET_DEV_HOLD_SAP_DESTROY_CTX_ALL", + "NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER", + "NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO", + "NET_DEV_HOLD_SET_RPS_CPU_MASK", + "NET_DEV_HOLD_DFS_INDICATE_RADAR", + "NET_DEV_HOLD_MAX_STA_INTERFACE_UP_COUNT_REACHED", + "NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS", + "NET_DEV_HOLD_STA_DESTROY_CTX_ALL", + "NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR", + "NET_DEV_HOLD_DEINIT_ALL_ADAPTERS", + "NET_DEV_HOLD_STOP_ALL_ADAPTERS", + "NET_DEV_HOLD_RESET_ALL_ADAPTERS", + "NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN", + "NET_DEV_HOLD_START_ALL_ADAPTERS", + "NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR", + "NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR", + "NET_DEV_HOLD_GET_ADAPTER_BY_VDEV", + "NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE", + "NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME", + "NET_DEV_HOLD_GET_ADAPTER", + "NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ", + "NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS", + "NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS", + "NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS", + "NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER", + "NET_DEV_HOLD_CLEAR_RPS_CPU_MASK", + "NET_DEV_HOLD_BUS_BW_WORK_HANDLER", + "NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT", + "NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY", + "NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY", + "NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP", + "NET_DEV_HOLD_INDICATE_MGMT_FRAME", + "NET_DEV_HOLD_STATE_INFO_DUMP", + "NET_DEV_HOLD_DISABLE_ROAMING", + "NET_DEV_HOLD_ENABLE_ROAMING", + "NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE", + "NET_DEV_HOLD_GET_CON_SAP_ADAPTER", + "NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED", + "NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS", + "NET_DEV_HOLD_DEL_P2P_INTERFACE", + "NET_DEV_HOLD_IS_NDP_ALLOWED", + "NET_DEV_HOLD_NDI_OPEN", + "NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG", + "NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY", + "NET_DEV_HOLD_SUSPEND_WLAN", + "NET_DEV_HOLD_RESUME_WLAN", + "NET_DEV_HOLD_SSR_RESTART_SAP", + "NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES", + "NET_DEV_HOLD_CFG80211_SUSPEND_WLAN", + "NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA", + "NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP", + "NET_DEV_HOLD_CACHE_STATION_STATS_CB", + "NET_DEV_HOLD_DISPLAY_TXRX_STATS", + "NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT", + "NET_DEV_HOLD_ID_MAX"}; + int32_t num_dbg_strings = QDF_ARRAY_SIZE(strings); + + if (dbgid >= num_dbg_strings) { + char *ret = ""; + + hdd_err("Debug string not found for debug id %d", dbgid); + return ret; + } + + return (char *)strings[dbgid]; +} + +static void hdd_check_for_net_dev_ref_leak(struct hdd_adapter *adapter) +{ + int id; + + for (id = 0; id < NET_DEV_HOLD_ID_MAX; id++) { + if (adapter->net_dev_hold_ref_count[id]) { + hdd_err("net_dev hold reference leak detected for debug id: %s", + net_dev_ref_debug_string_from_id(id)); + } + } +} + /** * hdd_deinit_station_mode() - De-initialize the station adapter * @hdd_ctx: global hdd context @@ -5943,10 +6039,12 @@ void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_STA_DESTROY_CTX_ALL) { if (adapter->device_mode == QDF_STA_MODE) hdd_cleanup_conn_info(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_STA_DESTROY_CTX_ALL); } } #endif @@ -5972,6 +6070,7 @@ static void hdd_cleanup_adapter(struct hdd_context *hdd_ctx, qdf_spinlock_destroy(&adapter->vdev_lock); hdd_sta_info_deinit(&adapter->sta_info_list); hdd_sta_info_deinit(&adapter->cache_sta_info_list); + hdd_check_for_net_dev_ref_leak(adapter); wlan_hdd_debugfs_csr_deinit(adapter); @@ -6004,16 +6103,19 @@ static QDF_STATUS hdd_check_for_existing_macaddr(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (!qdf_mem_cmp(adapter->mac_addr.bytes, mac_addr, sizeof(tSirMacAddr))) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return QDF_STATUS_E_FAILURE; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return QDF_STATUS_SUCCESS; @@ -6514,11 +6616,14 @@ static u8 hdd_get_mode_specific_interface_count(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter = NULL, *next_adapter = NULL; u8 intf_count = 0; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe( + hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT) { if (adapter->device_mode == mode) intf_count++; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug( + adapter, NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT); } return intf_count; } @@ -7395,9 +7500,11 @@ void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held) hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_DEINIT_ALL_ADAPTERS) { hdd_deinit_adapter(hdd_ctx, adapter, rtnl_held); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_DEINIT_ALL_ADAPTERS); } hdd_exit(); @@ -7412,9 +7519,11 @@ QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx) if (hdd_ctx->sap_pre_cac_work.fn) cds_flush_work(&hdd_ctx->sap_pre_cac_work); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_STOP_ALL_ADAPTERS) { hdd_stop_adapter(hdd_ctx, adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_STOP_ALL_ADAPTERS); } hdd_exit(); @@ -7566,7 +7675,8 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx) ucfg_mlme_get_sap_internal_restart(hdd_ctx->psoc, &value); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_RESET_ALL_ADAPTERS) { hdd_info("[SSR] reset adapter with device mode %s(%d)", qdf_opmode_str(adapter->device_mode), adapter->device_mode); @@ -7619,7 +7729,8 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx) hdd_set_disconnect_status(adapter, false); hdd_debug("Flush any mgmt references held by peer"); hdd_stop_adapter(hdd_ctx, adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_RESET_ALL_ADAPTERS); } hdd_exit(); @@ -7630,21 +7741,24 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx) bool hdd_is_any_interface_open(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN; if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) { hdd_info("FTM mode, don't close the module"); return true; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags) || test_bit(SME_SESSION_OPENED, &adapter->event_flags)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return false; @@ -8340,13 +8454,15 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) eConnectionState conn_state; bool value; struct wlan_objmgr_vdev *vdev; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_START_ALL_ADAPTERS; hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (!hdd_is_interface_up(adapter) && adapter->device_mode != QDF_NDI_MODE) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -8487,19 +8603,20 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) * applicable to all interfaces */ wlan_hdd_cfg80211_register_frames(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (!hdd_is_interface_up(adapter)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } if (adapter->device_mode == QDF_P2P_GO_MODE) hdd_stop_p2p_go(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } hdd_exit(); @@ -8507,6 +8624,35 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) return QDF_STATUS_SUCCESS; } +void hdd_adapter_dev_hold_debug(struct hdd_adapter *adapter, + wlan_net_dev_ref_dbgid dbgid) +{ + if (dbgid >= NET_DEV_HOLD_ID_MAX) { + hdd_err("Invalid debug id: %d", dbgid); + QDF_BUG(0); + } + dev_hold(adapter->dev); + adapter->net_dev_hold_ref_count[dbgid]++; +} + +void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter, + wlan_net_dev_ref_dbgid dbgid) +{ + if (dbgid >= NET_DEV_HOLD_ID_MAX) { + hdd_err("Invalid debug id: %d", dbgid); + QDF_BUG(0); + } + + if (adapter->net_dev_hold_ref_count[dbgid] == 0) { + hdd_err("dev_put detected without dev_hold for debug id: %s", + net_dev_ref_debug_string_from_id(dbgid)); + QDF_BUG(0); + } + + dev_put(adapter->dev); + adapter->net_dev_hold_ref_count[dbgid]--; +} + QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx, struct hdd_adapter **out_adapter) { @@ -8695,19 +8841,23 @@ struct hdd_adapter *hdd_get_adapter_by_rand_macaddr( struct hdd_context *hdd_ctx, tSirMacAddr mac_addr) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if ((adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE) && ucfg_p2p_check_random_mac(hdd_ctx->psoc, adapter->vdev_id, mac_addr)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; @@ -8717,16 +8867,19 @@ struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx, tSirMacAddr mac_addr) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (!qdf_mem_cmp(adapter->mac_addr.bytes, mac_addr, sizeof(tSirMacAddr))) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; @@ -8736,15 +8889,18 @@ struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx, uint32_t vdev_id) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_VDEV; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->vdev_id == vdev_id) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; @@ -8754,16 +8910,19 @@ struct hdd_adapter *hdd_adapter_get_by_reference(struct hdd_context *hdd_ctx, struct hdd_adapter *reference) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter == reference) { dev_hold(adapter->dev); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); break; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return adapter; @@ -8778,15 +8937,18 @@ struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx, const char *iface_name) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (!qdf_str_cmp(adapter->dev->name, iface_name)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; @@ -8806,15 +8968,18 @@ struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx, enum QDF_OPMODE mode) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->device_mode == mode) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; @@ -8845,17 +9010,20 @@ uint32_t hdd_get_operating_chan_freq(struct hdd_context *hdd_ctx, { struct hdd_adapter *adapter, *next_adapter = NULL; uint32_t oper_chan_freq = 0; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (mode == adapter->device_mode) { oper_chan_freq = hdd_get_adapter_home_channel(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); break; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return oper_chan_freq; @@ -8865,10 +9033,13 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS; hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || @@ -8876,7 +9047,7 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * adapter->device_mode == QDF_P2P_GO_MODE) { hdd_unregister_wext(adapter->dev); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } hdd_exit(); @@ -8887,10 +9058,13 @@ static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS; hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || @@ -8900,7 +9074,7 @@ QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx) adapter->vdev_id, INVALID_SCAN_ID, true); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } hdd_exit(); @@ -8919,8 +9093,11 @@ static QDF_STATUS hdd_abort_sched_scan_all_adapters(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; int err; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || @@ -8930,7 +9107,7 @@ static QDF_STATUS hdd_abort_sched_scan_all_adapters(struct hdd_context *hdd_ctx) if (err) hdd_err("Unable to stop scheduled scan"); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return QDF_STATUS_SUCCESS; @@ -9286,15 +9463,18 @@ QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx) struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter && adapter->magic == WLAN_HDD_ADAPTER_MAGIC) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return adapter; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return NULL; @@ -9568,9 +9748,11 @@ static void hdd_clear_rps_cpu_mask(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_CLEAR_RPS_CPU_MASK) { hdd_send_rps_disable_ind(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_CLEAR_RPS_CPU_MASK); } } @@ -10259,6 +10441,7 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) bool connected = false; uint32_t ipa_tx_packets = 0, ipa_rx_packets = 0; uint64_t sta_tx_bytes = 0, sap_tx_bytes = 0; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_BUS_BW_WORK_HANDLER; if (wlan_hdd_validate_context(hdd_ctx)) goto stop_work; @@ -10266,13 +10449,14 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) if (hdd_ctx->is_wiphy_suspended) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { /* * Validate magic so we don't end up accessing * an invalid adapter. */ if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -10280,16 +10464,14 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) adapter->device_mode == QDF_P2P_CLIENT_MODE) && WLAN_HDD_GET_STATION_CTX_PTR(adapter)->conn_info.conn_state != eConnectionState_Associated) { - - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } if ((adapter->device_mode == QDF_SAP_MODE || adapter->device_mode == QDF_P2P_GO_MODE) && WLAN_HDD_GET_AP_CTX_PTR(adapter)->ap_active == false) { - - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -10347,7 +10529,7 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx) adapter->prev_tx_bytes = adapter->stats.tx_bytes; qdf_spin_unlock_bh(&hdd_ctx->bus_bw_lock); connected = true; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } if (!connected) { @@ -10754,6 +10936,8 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) char *comb_log_str; uint32_t comb_log_str_size; struct hdd_adapter *adapter = NULL, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT; comb_log_str_size = (ADAP_NETIFQ_LOG_LEN * WLAN_MAX_VDEVS) + 1; comb_log_str = qdf_mem_malloc(comb_log_str_size); @@ -10762,7 +10946,8 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) bytes_written = 0; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { curr_time = qdf_system_ticks(); total = curr_time - adapter->start_time; delta = curr_time - adapter->last_time; @@ -10807,7 +10992,7 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) adapter_num++; /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } /* using QDF_TRACE to avoid printing function name */ @@ -10922,20 +11107,23 @@ wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx, enum qdf_stats_verbosity_level verb_lvl) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = + NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY; if (verb_lvl == QDF_STATS_VERBOSITY_LEVEL_LOW) { hdd_display_netif_queue_history_compact(hdd_ctx); return; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->vdev_id == CDP_INVALID_VDEV_ID) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } wlan_hdd_display_adapter_netif_queue_stats(adapter); /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -10948,8 +11136,10 @@ wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx, void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { qdf_mem_zero(adapter->queue_oper_stats, sizeof(adapter->queue_oper_stats)); qdf_mem_zero(adapter->queue_oper_history, @@ -10958,7 +11148,7 @@ void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx) adapter->start_time = adapter->last_time = qdf_system_ticks(); adapter->total_pause_time = 0; adapter->total_unpause_time = 0; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -11229,14 +11419,16 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) bool is_acs_support_for_dfs_ltecoex = cfg_default(CFG_USER_ACS_DFS_LTE); bool is_vendor_acs_support = cfg_default(CFG_USER_AUTO_CHANNEL_SELECTION); + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP; - hdd_for_each_adapter_dev_held_safe(hdd_ctxt, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctxt, adapter, next_adapter, + dbgid) { if (!(adapter->device_mode == QDF_SAP_MODE && adapter->session.ap.sap_config.acs_cfg.acs_mode)) { hdd_debug_rl("skip device mode:%d acs:%d", adapter->device_mode, adapter->session.ap.sap_config.acs_cfg.acs_mode); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -11280,7 +11472,7 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) restart_chan_store); hdd_debug("ch:%d is safe. no need to change channel", ap_chan); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -11299,7 +11491,7 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) if (is_vendor_acs_support && is_acs_support_for_dfs_ltecoex) { hdd_update_acs_timer_reason(adapter, QCA_WLAN_VENDOR_ACS_SELECT_REASON_LTE_COEX); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -11343,9 +11535,10 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) CSA_REASON_UNSAFE_CHANNEL); hdd_switch_sap_channel(adapter, restart_chan, true); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return; } else { @@ -11353,14 +11546,15 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) wlan_hdd_send_svc_nlink_msg( hdd_ctxt->radio_index, WLAN_SVC_LTE_COEX_IND, NULL, 0); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return; } } /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -11540,6 +11734,7 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) (struct ieee80211_mgmt *)frame_ind->frameBuf; QDF_STATUS status; struct wlan_objmgr_vdev *vdev; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_INDICATE_MGMT_FRAME; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (wlan_hdd_validate_context(hdd_ctx)) @@ -11560,11 +11755,11 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) } else if (SME_SESSION_ID_BROADCAST == frame_ind->sessionId) { num_adapters = 0; hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, - next_adapter) { + next_adapter, dbgid) { vdev_id[num_adapters] = adapter->vdev_id; num_adapters++; /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } adapter = NULL; @@ -14381,6 +14576,7 @@ static void hdd_state_info_dump(char **buf_ptr, uint16_t *size) struct hdd_adapter *adapter, *next_adapter = NULL; uint16_t len = 0; char *buf = *buf_ptr; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_STATE_INFO_DUMP; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { @@ -14396,7 +14592,8 @@ static void hdd_state_info_dump(char **buf_ptr, uint16_t *size) "\n is_scheduler_suspended %d", hdd_ctx->is_scheduler_suspended); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { len += scnprintf(buf + len, *size - len, "\n device name: %s", adapter->dev->name); len += scnprintf(buf + len, *size - len, @@ -14413,7 +14610,7 @@ static void hdd_state_info_dump(char **buf_ptr, uint16_t *size) default: break; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } *size -= len; @@ -15326,11 +15523,13 @@ wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter, struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_adapter); struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISABLE_ROAMING; if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (cur_adapter->vdev_id != adapter->vdev_id && @@ -15342,7 +15541,7 @@ wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter, REASON_DRIVER_DISABLED, rso_op_requestor); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -15353,11 +15552,13 @@ wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter, struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_adapter); struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_ENABLE_ROAMING; if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (cur_adapter->vdev_id != adapter->vdev_id && @@ -15369,7 +15570,7 @@ wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter, REASON_DRIVER_ENABLED, rso_op_requestor); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -15494,6 +15695,7 @@ void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable) struct hdd_adapter *adapter, *next_adapter = NULL; bool ap_connected = false, sta_connected = false; mac_handle_t mac_handle; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE; mac_handle = hdd_ctx->mac_handle; if (!mac_handle) @@ -15515,15 +15717,18 @@ void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable) /* To enable shutdown timer check conncurrency */ if (policy_mgr_concurrent_open_sessions_running(hdd_ctx->psoc)) { hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, - next_adapter) { + next_adapter, dbgid) { if (adapter->device_mode == QDF_STA_MODE) { if (WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> conn_info.conn_state == eConnectionState_Associated) { sta_connected = true; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug( + next_adapter, + dbgid); break; } } @@ -15532,13 +15737,16 @@ void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable) if (WLAN_HDD_GET_AP_CTX_PTR(adapter)-> ap_active == true) { ap_connected = true; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug( + next_adapter, + dbgid); break; } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -15563,10 +15771,12 @@ hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter, { struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(this_sap_adapter); struct hdd_adapter *adapter, *con_sap_adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_CON_SAP_ADAPTER; con_sap_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter && ((adapter->device_mode == QDF_SAP_MODE) || (adapter->device_mode == QDF_P2P_GO_MODE)) && adapter != this_sap_adapter) { @@ -15574,20 +15784,24 @@ hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter, if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { con_sap_adapter = adapter; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug( + next_adapter, + dbgid); break; } } else { con_sap_adapter = adapter; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); break; } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return con_sap_adapter; @@ -15608,34 +15822,39 @@ static inline bool hdd_adapter_is_ap(struct hdd_adapter *adapter) bool hdd_is_any_adapter_connected(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (hdd_adapter_is_sta(adapter) && WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> conn_info.conn_state == eConnectionState_Associated) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } if (hdd_adapter_is_ap(adapter) && WLAN_HDD_GET_AP_CTX_PTR(adapter)->ap_active) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } if (adapter->device_mode == QDF_NDI_MODE && WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> conn_info.conn_state == eConnectionState_NdiConnected) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return false; @@ -17812,6 +18031,7 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; uint8_t vdev_id; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS; if (!hdd_ctx) { hdd_err("HDD context is NULL"); @@ -17821,7 +18041,8 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx) if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) return false; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { vdev_id = adapter->vdev_id; if (adapter->device_mode == QDF_STA_MODE && (MLME_IS_ROAM_SYNCH_IN_PROGRESS(hdd_ctx->psoc, vdev_id) || @@ -17830,12 +18051,13 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx) vdev_id))) { hdd_debug("Roaming is in progress on:vdev_id:%d", adapter->vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return true; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return false; @@ -18373,7 +18595,8 @@ wlan_hdd_del_p2p_interface(struct hdd_context *hdd_ctx) struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct osif_vdev_sync *vdev_sync; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_DEL_P2P_INTERFACE) { if (adapter->device_mode == QDF_P2P_CLIENT_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE || adapter->device_mode == QDF_P2P_GO_MODE) { @@ -18386,7 +18609,8 @@ wlan_hdd_del_p2p_interface(struct hdd_context *hdd_ctx) if (vdev_sync) osif_vdev_sync_destroy(vdev_sync); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_DEL_P2P_INTERFACE); } } diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index 98a8e4cfc9bd..a6c6f65a6b80 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -124,15 +124,18 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_NDP_ALLOWED; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { switch (adapter->device_mode) { case QDF_P2P_GO_MODE: if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return false; } break; @@ -140,16 +143,17 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (hdd_conn_is_connected(sta_ctx) || hdd_is_connecting(sta_ctx)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return false; } break; default: break; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return true; @@ -159,16 +163,19 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_NDP_ALLOWED; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { switch (adapter->device_mode) { case QDF_P2P_GO_MODE: case QDF_SAP_MODE: if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return false; } break; @@ -176,16 +183,17 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx) sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (hdd_conn_is_connected(sta_ctx) || hdd_is_connecting(sta_ctx)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return false; } break; default: break; } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } return true; @@ -576,10 +584,11 @@ int hdd_ndi_open(char *iface_name) return -EINVAL; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_NDI_OPEN) { if (WLAN_HDD_IS_NDI(adapter)) ndi_adapter_count++; - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_NDI_OPEN); } if (ndi_adapter_count >= MAX_NDI_ADAPTERS) { hdd_err("Can't allow more than %d NDI adapters", diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 6d17436b6734..0194b48f9911 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -191,6 +191,7 @@ static void send_oem_reg_rsp_nlink_msg(void) uint8_t *device_mode; uint8_t *vdev_id; struct hdd_adapter *adapter, *next_adapter = NULL; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG; /* OEM msg is always to a specific process & cannot be a broadcast */ if (p_hdd_ctx->oem_pid == 0) { @@ -221,7 +222,8 @@ static void send_oem_reg_rsp_nlink_msg(void) *num_interfaces = 0; /* Iterate through each adapter and fill device mode and vdev id */ - hdd_for_each_adapter_dev_held_safe(p_hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(p_hdd_ctx, adapter, next_adapter, + dbgid) { device_mode = buf++; vdev_id = buf++; *device_mode = adapter->device_mode; @@ -230,7 +232,7 @@ static void send_oem_reg_rsp_nlink_msg(void) hdd_debug("num_interfaces: %d, device_mode: %d, vdev_id: %d", *num_interfaces, *device_mode, *vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } ani_hdr->length = diff --git a/core/hdd/src/wlan_hdd_periodic_sta_stats.c b/core/hdd/src/wlan_hdd_periodic_sta_stats.c index c9dd8eb3415b..887813ba1ce9 100644 --- a/core/hdd/src/wlan_hdd_periodic_sta_stats.c +++ b/core/hdd/src/wlan_hdd_periodic_sta_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -46,15 +46,17 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx) struct hdd_config *hdd_cfg; char *dev_name; bool should_log; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY; if (!hdd_ctx) return; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { should_log = false; if (adapter->device_mode != QDF_STA_MODE) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -63,7 +65,7 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx) if (!adapter->is_sta_periodic_stats_enabled) { qdf_mutex_release(&adapter->sta_periodic_stats_lock); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -92,7 +94,7 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx) hdd_nofl_info("%s: Rx DNS responses: %d", dev_name, sta_stats.hdd_dns_stats.rx_dns_rsp_count); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 0031c8a95b10..a43b17c6fb25 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1320,9 +1320,11 @@ hdd_suspend_wlan(void) return -EINVAL; } - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_SUSPEND_WLAN) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_SUSPEND_WLAN); continue; } @@ -1339,7 +1341,7 @@ hdd_suspend_wlan(void) /* Configure supported OffLoads */ hdd_enable_host_offloads(adapter, pmo_apps_suspend); hdd_update_conn_state_mask(adapter, &conn_state_mask); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_SUSPEND_WLAN); } status = ucfg_pmo_psoc_user_space_suspend_req(hdd_ctx->psoc, @@ -1385,9 +1387,11 @@ static int hdd_resume_wlan(void) hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_RESUME); /*loop through all adapters. Concurrency */ - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_RESUME_WLAN) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_RESUME_WLAN); continue; } @@ -1404,7 +1408,7 @@ static int hdd_resume_wlan(void) if (adapter->device_mode == QDF_STA_MODE) status = hdd_disable_default_pkt_filters(adapter); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_RESUME_WLAN); } ucfg_ipa_resume(hdd_ctx->pdev); @@ -1441,14 +1445,16 @@ static void hdd_ssr_restart_sap(struct hdd_context *hdd_ctx) hdd_enter(); - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_SSR_RESTART_SAP) { if (adapter->device_mode == QDF_SAP_MODE) { if (test_bit(SOFTAP_INIT_DONE, &adapter->event_flags)) { hdd_debug("Restart prev SAP session"); wlan_hdd_start_sap(adapter, true); } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_SSR_RESTART_SAP); } hdd_exit(); @@ -1570,7 +1576,8 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter, *next_adapter = NULL; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES) { if (hdd_is_interface_up(adapter) && (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_DEVICE_MODE) && @@ -1580,7 +1587,8 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx) adapter->scan_info.default_scan_ies, adapter->scan_info.default_scan_ies_len); } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, + NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES); } } @@ -2009,6 +2017,7 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, mac_handle_t mac_handle; struct wlan_objmgr_vdev *vdev; int rc; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CFG80211_SUSPEND_WLAN; hdd_enter(); @@ -2042,9 +2051,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, * "dfs_cac_block_tx" is set to true when RADAR is found and stay true * until CAC is done for a SoftAP which is in started state. */ - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -2057,9 +2067,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, hdd_err("RADAR detection in progress, do not allow suspend"); wlan_hdd_inc_suspend_stats(hdd_ctx, SUSPEND_FAIL_RADAR); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return -EAGAIN; } else if (!ucfg_pmo_get_enable_sap_suspend( hdd_ctx->psoc)) { @@ -2067,9 +2078,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, * suspend */ hdd_err("SAP does not support suspend!!"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return -EOPNOTSUPP; } } else if (QDF_P2P_GO_MODE == adapter->device_mode) { @@ -2079,13 +2091,14 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, * suspend */ hdd_err("GO does not support suspend!!"); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); return -EOPNOTSUPP; } } - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } /* p2p cleanup task based on scheduler */ ucfg_p2p_cleanup_tx_by_psoc(hdd_ctx->psoc); @@ -2097,14 +2110,15 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, } /* flush any pending powersave timers */ - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } sme_ps_timer_flush_sync(mac_handle, adapter->vdev_id); - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } /* diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 391cd376e4ab..2f573f65b250 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1397,10 +1397,12 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx) bool freq_changed, phy_changed; qdf_freq_t oper_freq; eCsrPhyMode csr_phy_mode; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA; pdev = hdd_ctx->pdev; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { oper_freq = hdd_get_adapter_home_channel(adapter); freq_changed = wlan_reg_is_disable_for_freq(pdev, oper_freq); @@ -1433,7 +1435,7 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx) break; } /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } @@ -1525,10 +1527,12 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx) bool phy_changed; qdf_freq_t oper_freq; eCsrPhyMode csr_phy_mode; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP; pdev = hdd_ctx->pdev; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { oper_freq = hdd_get_adapter_home_channel(adapter); switch (adapter->device_mode) { @@ -1561,7 +1565,7 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx) break; } /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); } } diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 484889ff8d9e..5e2c809fe940 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1747,17 +1747,20 @@ static void cache_station_stats_cb(struct stats_event *ev, void *cookie) struct hdd_adapter *adapter = cookie, *next_adapter = NULL; struct hdd_context *hdd_ctx = adapter->hdd_ctx; uint8_t vdev_id = adapter->vdev_id; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISPLAY_TXRX_STATS; - hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, + dbgid) { if (adapter->vdev_id != vdev_id) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } copy_station_stats_to_adapter(adapter, ev); /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); if (next_adapter) - dev_put(next_adapter->dev); + hdd_adapter_dev_put_debug(next_adapter, + dbgid); break; } } @@ -6570,8 +6573,10 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) int i = 0; uint32_t total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused; + wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CACHE_STATION_STATS_CB; - hdd_for_each_adapter_dev_held_safe(ctx, adapter, next_adapter) { + hdd_for_each_adapter_dev_held_safe(ctx, adapter, next_adapter, + dbgid) { total_rx_pkt = 0; total_rx_dropped = 0; total_rx_delv = 0; @@ -6579,7 +6584,7 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) stats = &adapter->hdd_stats.tx_rx_stats; if (adapter->vdev_id == INVAL_VDEV_ID) { - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); continue; } @@ -6592,7 +6597,7 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) } /* dev_put has to be done here */ - dev_put(adapter->dev); + hdd_adapter_dev_put_debug(adapter, dbgid); hdd_debug("TX - called %u, dropped %u orphan %u", stats->tx_called, stats->tx_dropped, From a03aa9b389e3d9ff27165231211ea3bc6c6ea465 Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Mon, 5 Apr 2021 14:19:18 +0530 Subject: [PATCH 09/55] qcacld-3.0: Don't enable HIF_DETECTION_LATENCY feature for all targets The feature HIF_DETECTION_LATENCY_ENABLE is not applicable for all targets. To avoid issues, enable this feature based on target. Change-Id: Ia7bab02710ee2bbb9f487571ec98992ac338961f CRs-Fixed: 2915968 --- configs/default_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/default_defconfig b/configs/default_defconfig index a56d35ded91e..aae2261be5f6 100644 --- a/configs/default_defconfig +++ b/configs/default_defconfig @@ -1037,8 +1037,11 @@ ifeq ($(CONFIG_SLUB_DEBUG_ON), y) CONFIG_UNIT_TEST := y CONFIG_REGISTER_OP_DEBUG := y CONFIG_ENABLE_QDF_PTR_HASH_DEBUG := y + +ifneq ($(CONFIG_ARCH_HOLI), y) CONFIG_HIF_DETECTION_LATENCY_ENABLE := y endif +endif ifeq ($(CONFIG_UNIT_TEST), y) CONFIG_DSC_TEST := y From 27e7c2ba0c6d991b1ef77e1f86c3577ec988fc7d Mon Sep 17 00:00:00 2001 From: Jianmin Zhu Date: Mon, 19 Apr 2021 08:56:03 +0800 Subject: [PATCH 10/55] qcacld-3.0: Return 0 if rx aggregation missed In QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION cmd parameters, If attribute QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION is missed, should return 0 instead of failed. Change-Id: I5e570b9237768800e06d839814919d058a5e1d1f CRs-Fixed: 2926104 --- core/hdd/src/wlan_hdd_cfg80211.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index e406d0f8e08f..55cab62f85c3 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -7617,10 +7617,8 @@ static int hdd_config_mpdu_aggregation(struct hdd_adapter *adapter, uint8_t rx_size; QDF_STATUS status; - if (!rx_attr) { - hdd_err("Missing attribute for RX"); - return -EINVAL; - } + if (!rx_attr) + return 0; rx_size = nla_get_u8(rx_attr); if (!cfg_in_range(CFG_RX_AGGREGATION_SIZE, rx_size)) { @@ -7645,10 +7643,8 @@ static int hdd_config_msdu_aggregation(struct hdd_adapter *adapter, uint8_t rx_size; QDF_STATUS status; - if (!rx_attr) { - hdd_err("Missing attribute for RX"); - return -EINVAL; - } + if (!rx_attr) + return 0; rx_size = nla_get_u8(rx_attr); if (!cfg_in_range(CFG_RX_AGGREGATION_SIZE, rx_size)) { From d950af83d782ea3dab23326450921529b303fe59 Mon Sep 17 00:00:00 2001 From: hangtian Date: Thu, 23 Sep 2021 15:12:53 +0800 Subject: [PATCH 11/55] qcacld-3.0: Invalid rem_len computation in roam stats evt handler rem_len is calculated based on MAX size of the WMI message (WMI_SVC_MSG_MAX_SIZE) while extracting data from WMI_ROAM_STATS_EVENTID event data. Correct this by considering the actual message length received in the event. Change-Id: If24f732a8fdc0ad403e9b8a936ff8cfa0b7f7737 CRs-Fixed: 3035196 --- core/wma/src/wma_scan_roam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 365e04d6d7dc..a3ec8ac65b4d 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -2192,7 +2192,7 @@ int wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event, num_tlv = MAX_ROAM_SCAN_STATS_TLV; } - rem_len = WMI_SVC_MSG_MAX_SIZE - sizeof(*fixed_param); + rem_len = len - sizeof(*fixed_param); if (rem_len < num_tlv * sizeof(wmi_roam_trigger_reason)) { wma_err_rl("Invalid roam trigger data"); goto err; From 24029d72e60b18170a4535b74533a8b4c0efc3b4 Mon Sep 17 00:00:00 2001 From: Vijay Patil Date: Thu, 10 Mar 2022 17:28:09 +0530 Subject: [PATCH 12/55] qcacld-3.0: Add PLD API to check if ipa offload is disabled Add PLD API to check if ipa offload is disabled or not in PLD layer. Change-Id: If2ef19cdc16a399cf5abfa495e01bab6da799c8d CRs-Fixed: 3148041 --- core/pld/inc/pld_common.h | 26 +++++++++++++++++++++++++ core/pld/src/pld_common.c | 40 +++++++++++++++++++++++++++++++++++++++ core/pld/src/pld_snoc.h | 12 +++++++++++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 04be7b202da4..c8f1f437da48 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -153,6 +154,16 @@ enum pld_uevent { PLD_SMMU_FAULT, }; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) +/** + * enum pld_device_config - Get PLD device config + * @PLD_IPA_DISABLD: IPA is disabled + */ +enum pld_device_config { + PLD_IPA_DISABLED, +}; +#endif + /** * struct pld_uevent_data - uevent status received from platform driver * @uevent: uevent type @@ -942,6 +953,21 @@ void pld_thermal_unregister(struct device *dev, int mon_id); int pld_get_thermal_state(struct device *dev, unsigned long *thermal_state, int mon_id); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) +/** + * pld_is_ipa_offload_disabled() - Check if IPA offload is enabled or not + * @dev: The device structure + * + * Return: Non-zero code for IPA offload disable; zero for IPA offload enable + */ +int pld_is_ipa_offload_disabled(struct device *dev); +#else +int pld_is_ipa_offload_disabled(struct device *dev); +{ + return 0; +} +#endif + #if IS_ENABLED(CONFIG_WCNSS_MEM_PRE_ALLOC) && defined(FEATURE_SKB_PRE_ALLOC) /** diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index 13e161862b0f..08fedf1f3e77 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -3182,6 +3183,45 @@ int pld_get_thermal_state(struct device *dev, unsigned long *thermal_state, return errno; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) +/** + * pld_is_ipa_offload_disabled() - Check if IPA offload is disabled or not + * + * @dev: device + * + * This API will be called to check if IPA offload is disabled or not. + * + * Return: Non-zero for IPA offload is disabled + * Otherwise IPA offload is enabled + */ +int pld_is_ipa_offload_disabled(struct device *dev) +{ + unsigned long dev_cfg = 0; + + enum pld_bus_type type = pld_get_bus_type(dev); + + switch (type) { + case PLD_BUS_TYPE_SNOC: + dev_cfg = pld_snoc_get_device_config(); + break; + case PLD_BUS_TYPE_IPCI: + case PLD_BUS_TYPE_PCIE: + case PLD_BUS_TYPE_SDIO: + case PLD_BUS_TYPE_USB: + case PLD_BUS_TYPE_SNOC_FW_SIM: + case PLD_BUS_TYPE_PCIE_FW_SIM: + case PLD_BUS_TYPE_IPCI_FW_SIM: + pr_err("Not supported on type %d\n", type); + break; + default: + pr_err("Invalid device type %d\n", type); + break; + } + + return test_bit(PLD_IPA_DISABLED, &dev_cfg); +} +#endif + #ifdef FEATURE_WLAN_TIME_SYNC_FTM /** * pld_get_audio_wlan_timestamp() - Get audio timestamp diff --git a/core/pld/src/pld_snoc.h b/core/pld/src/pld_snoc.h index 969504dd2e6c..1ee110486e0d 100644 --- a/core/pld/src/pld_snoc.h +++ b/core/pld/src/pld_snoc.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -124,6 +124,11 @@ static inline int pld_snoc_idle_shutdown(struct device *dev) return 0; } +static inline unsigned long pld_snoc_get_device_config(void) +{ + return 0; +} + static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr, uint32_t *iova_addr, size_t size) { @@ -393,5 +398,10 @@ static inline int pld_snoc_idle_shutdown(struct device *dev) { return icnss_idle_shutdown(dev); } + +static inline unsigned long pld_snoc_get_device_config(void) +{ + return icnss_get_device_config(); +} #endif #endif From ce5c5b6ccf17619fba8032d539640068c2a86936 Mon Sep 17 00:00:00 2001 From: Ananya Gupta Date: Thu, 10 Mar 2022 16:20:37 +0530 Subject: [PATCH 13/55] qcacld-3.0: Enable global IPA struct if enabled in pld and ini Enable global IPA structure, g_ipa_config only if it is enabled in both platform driver and ini file. Change-Id: I1bd4e03eadf420f736bb91478b0f2e04bcd60ebd CRs-Fixed: 3148820 --- components/ipa/core/src/wlan_ipa_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/ipa/core/src/wlan_ipa_main.c b/components/ipa/core/src/wlan_ipa_main.c index 9e2a681683ac..1df90540aca4 100644 --- a/components/ipa/core/src/wlan_ipa_main.c +++ b/components/ipa/core/src/wlan_ipa_main.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all @@ -754,6 +754,7 @@ void ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev) void ipa_component_config_update(struct wlan_objmgr_psoc *psoc) { + struct device *dev = wlan_psoc_get_qdf_dev(psoc)->dev; QDF_STATUS status; status = ipa_config_mem_alloc(); @@ -762,8 +763,15 @@ void ipa_component_config_update(struct wlan_objmgr_psoc *psoc) return; } - g_ipa_config->ipa_config = - cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG); + if (!pld_is_ipa_offload_disabled(dev)) { + g_ipa_config->ipa_config = + cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG); + ipa_info("IPA ini configuration: 0x%x", + g_ipa_config->ipa_config); + } else { + g_ipa_config->ipa_config = 0; + ipa_info("IPA disabled from platform driver"); + } g_ipa_config->desc_size = cfg_get(psoc, CFG_DP_IPA_DESC_SIZE); g_ipa_config->txbuf_count = From 1b0c9445fd90609e21aac02bfcb6e1de2bfa87dc Mon Sep 17 00:00:00 2001 From: sandhu Date: Thu, 15 Sep 2022 12:21:25 -0700 Subject: [PATCH 14/55] qcacld-3.0: check staId index bound into timer array Check whether staId is not out of bound while accessing the timer array. Change-Id: I347c314a324934d4a62808551b1552aa4a76a5d7 CRs-Fixed: 3290301 --- core/mac/src/pe/lim/lim_timer_utils.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/mac/src/pe/lim/lim_timer_utils.c b/core/mac/src/pe/lim/lim_timer_utils.c index a43ba3293280..2e3892e5293c 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.c +++ b/core/mac/src/pe/lim/lim_timer_utils.c @@ -751,11 +751,16 @@ lim_deactivate_and_change_per_sta_id_timer(struct mac_context *mac, uint32_t tim switch (timerId) { case eLIM_CNF_WAIT_TIMER: - if (tx_timer_deactivate - (&mac->lim.lim_timers.gpLimCnfWaitTimer[staId]) - != TX_SUCCESS) { + if (staId >= (mac->lim.maxStation + 1)) { + pe_err("Invalid staId = %d ", staId); + return; + } + + if (tx_timer_deactivate(&mac->lim.lim_timers.gpLimCnfWaitTimer[staId]) + != TX_SUCCESS) { pe_err("unable to deactivate CNF wait timer"); } + /* Change timer to reactivate it in future */ val = mac->mlme_cfg->sta.wait_cnf_timeout; val = SYS_MS_TO_TICKS(val); From 091070f5acab5d3827b272660524225fdf592b9c Mon Sep 17 00:00:00 2001 From: Ranjeet Gupta Date: Thu, 20 Apr 2017 14:57:32 -0500 Subject: [PATCH 15/55] :prop (CR) for 12M WLAN Radiated Power test Changes based on new TLV2 format to support 12M wlan radiated power test on Production SW. Change-Id: I90e2dfe8d2828f054cb5f540d51e3ef71d5112a5 Reviewed-on: https://gerrit.mot.com/983481 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Reviewed-by: Santhosh Kumar Gillella Tested-by: Jira Key Submit-Approved: Jira Key --- Kbuild | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Kbuild b/Kbuild index fe0d494ee7a7..09448442dee4 100644 --- a/Kbuild +++ b/Kbuild @@ -3072,6 +3072,13 @@ cppflags-$(CONFIG_QCA_WIFI_FTM) += -DQCA_WIFI_FTM cppflags-$(CONFIG_NL80211_TESTMODE) += -DQCA_WIFI_FTM_NL80211 cppflags-$(CONFIG_LINUX_QCMBR) += -DLINUX_QCMBR -DQCA_WIFI_FTM_IOCTL +# WLAN_WHITE_LIST - WLAN Radiated Power Test +# For user software build, wlan driver needs to allow the factory +# commnds only for Tx_opcode and NART commands based off 12M doc +ifeq ($(TARGET_BUILD_VARIANT),user) +CDEFINES += -DWLAN_WHITE_LIST +endif + #Enable Checksum Offload support cppflags-$(CONFIG_CHECKSUM_OFFLOAD) += -DCHECKSUM_OFFLOAD From 96ee88b19bf9c4a56dc7a3cef2ae13ab7fbdec27 Mon Sep 17 00:00:00 2001 From: liaoxl Date: Fri, 19 Oct 2018 14:12:17 +0800 Subject: [PATCH 16/55] WLAN: Implement reading of MAC address from UTAG for sm6150 - Read MAC Address from UTAG - Generate new MAC address from serial number, if UTAG is not programmed with MAC addresses in Factory. Port changes from (CR) to new Helium platform(sm6150). Change-Id: If6d2e532907ff0cd267262710b3c694bf73c9129 Reviewed-on: https://gerrit.mot.com/1257719 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- Kbuild | 2 + core/hdd/inc/wlan_hdd_cfg.h | 5 + core/hdd/src/wlan_hdd_cfg.c | 230 +++++++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_main.c | 8 ++ 4 files changed, 245 insertions(+) mode change 100644 => 100755 core/hdd/src/wlan_hdd_cfg.c diff --git a/Kbuild b/Kbuild index 09448442dee4..5194b2b6ae87 100644 --- a/Kbuild +++ b/Kbuild @@ -3422,6 +3422,8 @@ cppflags-$(CONFIG_WLAN_HANG_EVENT) += -DHIF_BUS_LOG_INFO cppflags-$(CONFIG_WLAN_HANG_EVENT) += -DDP_SUPPORT_RECOVERY_NOTIFY #endof dummy flags +cppflags-y += -DMOTO_UTAGS_MAC + ccflags-$(CONFIG_ENABLE_SIZE_OPTIMIZE) += -Os # DFS component diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index a81d4e66ceb7..e56281f917d1 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -280,6 +280,11 @@ struct hdd_config { eCsrRoamWmmUserModeType hdd_to_csr_wmm_mode(uint8_t mode); QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx); +#ifdef MOTO_UTAGS_MAC +QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx); +QDF_STATUS hdd_generate_random_mac_from_serialno(char *serialNo, + int serialength, char *computedMac); +#endif QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx); QDF_STATUS hdd_set_policy_mgr_user_cfg(struct hdd_context *hdd_ctx); QDF_STATUS hdd_set_sme_chan_list(struct hdd_context *hdd_ctx); diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c old mode 100644 new mode 100755 index 9e8f348016ad..570ed019f625 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -51,6 +51,151 @@ #include #include "wlan_hdd_object_manager.h" +#ifdef MOTO_UTAGS_MAC +#include +#include +#include +#include + +#define WIFI_MAC_BOOTARG "androidboot.wifimacaddr=" +#define DEVICE_SERIALNO_BOOTARG "androidboot.serialno=" +#define MACSTRLEN 12 +#define MACSTRCOLON 58 +#define MACADDRESSUSED 1 + +struct sdesc { + struct shash_desc shash; + char ctx[]; +}; + +QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx) +{ + QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; + + int len = 0; + int serialnoLen = 0; + + char *buffer = NULL; + char *bufferPtr = NULL; + char *computedMac = NULL; + const char *cmd_line = NULL; + + struct device_node *chosen_node = NULL; + computedMac = (char*)qdf_mem_malloc(QDF_MAC_ADDR_SIZE); + + chosen_node = of_find_node_by_name(NULL, "chosen"); + hdd_err("%s: get chosen node \n", __func__); + + if (!chosen_node) + { + hdd_err("%s: get chosen node read failed \n", __func__); + goto config_exit; + } else { + cmd_line = of_get_property(chosen_node, "bootargs", &len); + if (!cmd_line || len <= 0) { + hdd_err("%s: get the barcode bootargs failed \n", __func__); + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } else { + buffer = strstr(cmd_line, DEVICE_SERIALNO_BOOTARG); + if (buffer == NULL) { + hdd_err("%s: " DEVICE_SERIALNO_BOOTARG" not present cmd line argc", + __func__); + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } else { + buffer += strlen(DEVICE_SERIALNO_BOOTARG); + bufferPtr = buffer; + while (*bufferPtr != ' ') { + bufferPtr++; + serialnoLen = serialnoLen + 1; + } + } + } + } + /*Data have been read from boot serial no */ + /*Now generate random unique the 6 byte string */ + if (hdd_generate_random_mac_from_serialno(buffer, serialnoLen, + computedMac) != QDF_STATUS_SUCCESS) { + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } + qdf_mem_copy(&hdd_ctx->config->intfMacAddr[0].bytes[0], + (uint8_t *)computedMac, QDF_MAC_ADDR_SIZE); + +config_exit: + qdf_mem_free(computedMac); + return qdf_status; +} + +QDF_STATUS hdd_generate_random_mac_from_serialno(char *serialNo, int serialnoLen, + char *macAddr) +{ + unsigned int size; + struct crypto_shash *md5; + struct sdesc *sdescmd5; + char *hashBuf = NULL; + + QDF_STATUS cryptoStatus = QDF_STATUS_SUCCESS; + hashBuf = (char*)qdf_mem_malloc(16); + + /*Motorola OUI*/ + macAddr[0] = 0xA4; + macAddr[1] = 0x07; + macAddr[2] = 0xd6; + + md5 = crypto_alloc_shash("md5", 0, 0); + if (IS_ERR(md5)) { + cryptoStatus = QDF_STATUS_E_FAILURE; + hdd_err("%s: Crypto md5 allocation error \n", __func__); + qdf_mem_free(hashBuf); + return QDF_STATUS_E_FAILURE; + } + + size = sizeof(struct shash_desc) + crypto_shash_descsize(md5); + + sdescmd5 = kmalloc(size, GFP_KERNEL); + if (!sdescmd5) { + cryptoStatus = QDF_STATUS_E_FAILURE; + hdd_err("%s: Memory allocation error \n", __func__); + goto crypto_hash_err; + } + + sdescmd5->shash.tfm = md5; + sdescmd5->shash.flags = 0x0; + + if (crypto_shash_init(&sdescmd5->shash)) { + cryptoStatus = QDF_STATUS_E_FAILURE; + goto crypto_hash_err; + } + + if (crypto_shash_update(&sdescmd5->shash, serialNo, serialnoLen)) { + cryptoStatus = QDF_STATUS_E_FAILURE; + goto crypto_hash_err; + } + + if (crypto_shash_final(&sdescmd5->shash, &hashBuf[0])) { + cryptoStatus = QDF_STATUS_E_FAILURE; + goto crypto_hash_err; + } + + macAddr[3] = hashBuf[0]; + macAddr[4] = hashBuf[1]; + macAddr[5] = hashBuf[2]; + + hdd_err("%02X:%02X:%02X:%02X:%02X:%02X is the new MAC generated from serial number \n", macAddr[0], + macAddr[1], macAddr[2], macAddr[3], + macAddr[4], macAddr[5]); + crypto_hash_err: + qdf_mem_free(hashBuf); + crypto_free_shash(md5); + kfree(sdescmd5); + + return cryptoStatus; +} +#endif + + /** * get_next_line() - find and locate the new line pointer * @str: pointer to string @@ -246,6 +391,7 @@ static void hdd_set_power_save_offload_config(struct hdd_context *hdd_ctx) * Return: QDF_STATUS_SUCCESS if the MAC address is found from cfg file * and overwritten, otherwise QDF_STATUS_E_INVAL */ +#ifndef MOTO_UTAGS_MAC QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) { int status, i = 0; @@ -363,6 +509,90 @@ config_exit: return qdf_status; } +#else +QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) +{ + int len = 0; + int iteration = 0; + + char *bufferPtr = NULL; + char buffer_temp[MACSTRLEN]; + const char *cmd_line = NULL; + struct device_node *chosen_node = NULL; + char *buffer = NULL; + + struct hdd_cfg_entry macTable[QDF_MAX_CONCURRENCY_PERSONA]; + tSirMacAddr customMacAddr; + + QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; + + memset(macTable, 0, sizeof(macTable)); + + /*Implemenation of QCOM is to read the MAC address from the predefined*/ + /*location where WLAN MMAC File have the MAC Address */ + /* Read MACs from bootparams. */ + chosen_node = of_find_node_by_name(NULL, "chosen"); + hdd_err("%s: get chosen node \n", __func__); + if (!chosen_node) + { + hdd_err("%s: get chosen node read failed \n", __func__); + goto config_exit; + } else { + cmd_line = of_get_property(chosen_node, "bootargs", &len); + + if (!cmd_line || len <= 0) { + hdd_err("%s: get wlan MACs bootargs failed \n", __func__); + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } else { + buffer = strstr(cmd_line, WIFI_MAC_BOOTARG); + if (buffer == NULL) { + hdd_err("%s: " WIFI_MAC_BOOTARG " bootarg cmd line is null", __func__); + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } else { + buffer += strlen(WIFI_MAC_BOOTARG); + bufferPtr = buffer; + } + } + } + /* Mac address data format used by qcom: + * Intf0MacAddress=00AA00BB00CC + * Intf1MacAddress=00AA00BB00CD + * xxxxxxxxxxxxxxxxxxxxxxxxxxxx + * From bootarg we need to strip off : from macaddress + */ + for (iteration = 0; iteration < MACSTRLEN; iteration++) { + if (*bufferPtr != MACSTRCOLON) { + buffer_temp[iteration] = *bufferPtr; + } else { + iteration = iteration - 1; + } + bufferPtr++; + } + /* Mac address data format used by qcom: + * Intf0MacAddress used for 1 macaddress + * if gp2pdeviceAdmistered is set to 1 + * if s020deviceAdmisnited is set to 0 + * it will use Intf1MacAddress for P2P seprately + * Motorola decided to use gp2pdeviceAdmistered = 1 i.e use + * locally gerated bin MAC addr for P2P + */ + macTable[0].name = "Intf0MacAddress"; + macTable[0].value = &buffer_temp[0]; + update_mac_from_string(hdd_ctx, &macTable[0], MACADDRESSUSED); + qdf_mem_copy(&customMacAddr, + &hdd_ctx->config->intfMacAddr[0].bytes[0], + sizeof(tSirMacAddr)); + sme_set_custom_mac_addr(customMacAddr); + +config_exit: + + return qdf_status; +} + +#endif + #ifdef FEATURE_RUNTIME_PM /** * hdd_disable_runtime_pm() - Override to disable runtime_pm. diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 6ff051ffb47d..1576d18dfaad 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13857,6 +13857,14 @@ static int hdd_initialize_mac_address(struct hdd_context *hdd_ctx) return 0; } +#ifdef MOTO_UTAGS_MAC + hdd_warn("Can't update mac config via wlan_mac.bin, using MAC from serial number"); + + status = hdd_update_mac_serial(hdd_ctx); + if (QDF_IS_STATUS_SUCCESS(status)) + return; +#endif + hdd_info("using default MAC address"); /* Use fw provided MAC */ From 9683861d8978d5e0d7d7d55c69be52ff361b61e2 Mon Sep 17 00:00:00 2001 From: Santhosh Gillella Date: Tue, 19 Jun 2018 15:49:29 -0500 Subject: [PATCH 17/55] : Rework reading MAC address from UTAG In WLAN driver for Helium family, QC has updated hdd_context_t structure and removed intfMacAddr variable. As a result, with Motorola MAC address changes, compilation was failing. Replaced intfMacAddr with new provisioned and derived variables to read and use MAC address from UTAG properly. Updated the MOT OUI with latest MOT OUI values. Change-Id: I78e942aefc5b802e6297402c796d5d002b6d955a Reviewed-on: https://gerrit.mot.com/1196122 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Yun Ma --- core/hdd/src/wlan_hdd_cfg.c | 12 +++++++----- core/hdd/src/wlan_hdd_main.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 570ed019f625..b8d8277475ee 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -120,8 +120,9 @@ QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx) qdf_status = QDF_STATUS_E_FAILURE; goto config_exit; } - qdf_mem_copy(&hdd_ctx->config->intfMacAddr[0].bytes[0], + qdf_mem_copy(&pHddCtx->derived_mac_addr[0].bytes, (uint8_t *)computedMac, QDF_MAC_ADDR_SIZE); + pHddCtx->num_derived_addr++; config_exit: qdf_mem_free(computedMac); @@ -140,9 +141,9 @@ QDF_STATUS hdd_generate_random_mac_from_serialno(char *serialNo, int serialnoLen hashBuf = (char*)qdf_mem_malloc(16); /*Motorola OUI*/ - macAddr[0] = 0xA4; - macAddr[1] = 0x07; - macAddr[2] = 0xd6; + macAddr[0] = 0x38; + macAddr[1] = 0x80; + macAddr[2] = 0xDF; md5 = crypto_alloc_shash("md5", 0, 0); if (IS_ERR(md5)) { @@ -581,8 +582,9 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) macTable[0].name = "Intf0MacAddress"; macTable[0].value = &buffer_temp[0]; update_mac_from_string(hdd_ctx, &macTable[0], MACADDRESSUSED); + pHddCtx->num_provisioned_addr = MACADDRESSUSED; qdf_mem_copy(&customMacAddr, - &hdd_ctx->config->intfMacAddr[0].bytes[0], + &pHddCtx->provisioned_mac_addr[0].bytes[0], sizeof(tSirMacAddr)); sme_set_custom_mac_addr(customMacAddr); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 1576d18dfaad..50a8e44d98b3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13862,7 +13862,7 @@ static int hdd_initialize_mac_address(struct hdd_context *hdd_ctx) status = hdd_update_mac_serial(hdd_ctx); if (QDF_IS_STATUS_SUCCESS(status)) - return; + return 0; #endif hdd_info("using default MAC address"); From a2dd989ad83067a7050e58767575aaf958bf73b3 Mon Sep 17 00:00:00 2001 From: jmng34 Date: Tue, 12 Nov 2019 11:19:40 +0530 Subject: [PATCH 18/55] prop (CR) STA+MHS concurrency mode Add the code to read the 2nd MAC address from the utag for SAP to support STA+SAP concurrency Change-Id: Ibb884c39a3751569429aabff1f757783eb4f76c8 --- core/hdd/src/wlan_hdd_cfg.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index b8d8277475ee..f1d57fef2ea9 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -61,7 +61,7 @@ #define DEVICE_SERIALNO_BOOTARG "androidboot.serialno=" #define MACSTRLEN 12 #define MACSTRCOLON 58 -#define MACADDRESSUSED 1 +#define MACADDRESSUSED 2 struct sdesc { struct shash_desc shash; @@ -518,6 +518,7 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) char *bufferPtr = NULL; char buffer_temp[MACSTRLEN]; + char buffer_mac2[MACSTRLEN]; const char *cmd_line = NULL; struct device_node *chosen_node = NULL; char *buffer = NULL; @@ -571,6 +572,17 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) } bufferPtr++; } + if( *bufferPtr == ',' || *bufferPtr == '-') { + bufferPtr++; + } + for (iteration = 0; iteration < MACSTRLEN; iteration++) { + if (*bufferPtr != MACSTRCOLON) { + buffer_mac2[iteration] = *bufferPtr; + } else { + iteration = iteration - 1; + } + bufferPtr++; + } /* Mac address data format used by qcom: * Intf0MacAddress used for 1 macaddress * if gp2pdeviceAdmistered is set to 1 @@ -581,8 +593,10 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) */ macTable[0].name = "Intf0MacAddress"; macTable[0].value = &buffer_temp[0]; + macTable[1].value = &buffer_mac2[0]; update_mac_from_string(hdd_ctx, &macTable[0], MACADDRESSUSED); pHddCtx->num_provisioned_addr = MACADDRESSUSED; + hdd_populate_random_mac_addr(pHddCtx, QDF_MAX_CONCURRENCY_PERSONA - MACADDRESSUSED); qdf_mem_copy(&customMacAddr, &pHddCtx->provisioned_mac_addr[0].bytes[0], sizeof(tSirMacAddr)); From 8473475c52981096da0a93aaa9dc02ad6f42a702 Mon Sep 17 00:00:00 2001 From: hurui1 Date: Wed, 9 Aug 2017 14:46:53 +0800 Subject: [PATCH 19/55] update NOTICE for vendor/qcom/opensource/wlan/qcacld-3.0$ Change-Id: I4e04919006ea6ba01f0e395259251e0e9a32126f Signed-off-by: hurui1 Change-Id: Iecc20e489869bb2380016fb59f0fe429c3126f1f Reviewed-on: https://gerrit.mot.com/1038433 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hongcheng Xia Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1077672 Reviewed-by: Ranjeet Gupta --- NOTICE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 NOTICE diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000000..cab58c63efb4 --- /dev/null +++ b/NOTICE @@ -0,0 +1,21 @@ +Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. + +Previously licensed under the ISC license by Qualcomm Atheros, Inc. + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all +copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +This file was originally distributed by Qualcomm Atheros, Inc. +under proprietary terms before Copyright ownership was assigned +to the Linux Foundation. From a4bc69de9161473e861f00e1680fd18fef2c5ac1 Mon Sep 17 00:00:00 2001 From: jmng34 Date: Tue, 12 Nov 2019 19:24:48 +0530 Subject: [PATCH 20/55] : Resolve compilation issues changes in the interface of APIs related to generating mac address Change-Id: I440e07452c2ffb7b3cb15528e7777d6db0012909 --- core/hdd/src/wlan_hdd_cfg.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index f1d57fef2ea9..2a819e2492de 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -120,9 +120,10 @@ QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx) qdf_status = QDF_STATUS_E_FAILURE; goto config_exit; } - qdf_mem_copy(&pHddCtx->derived_mac_addr[0].bytes, + hdd_ctx->num_provisioned_addr = MACADDRESSUSED; + qdf_mem_copy(&hdd_ctx->provisioned_mac_addr[0].bytes[0], (uint8_t *)computedMac, QDF_MAC_ADDR_SIZE); - pHddCtx->num_derived_addr++; + //hdd_ctx->num_derived_addr++; config_exit: qdf_mem_free(computedMac); @@ -194,8 +195,7 @@ QDF_STATUS hdd_generate_random_mac_from_serialno(char *serialNo, int serialnoLen return cryptoStatus; } -#endif - +#else /** * get_next_line() - find and locate the new line pointer @@ -274,6 +274,8 @@ static char *i_trim(char *str) return str; } +#endif + /** struct hdd_cfg_entry - ini configuration entry * @name: name of the entry * @value: value of the entry @@ -595,10 +597,10 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) macTable[0].value = &buffer_temp[0]; macTable[1].value = &buffer_mac2[0]; update_mac_from_string(hdd_ctx, &macTable[0], MACADDRESSUSED); - pHddCtx->num_provisioned_addr = MACADDRESSUSED; - hdd_populate_random_mac_addr(pHddCtx, QDF_MAX_CONCURRENCY_PERSONA - MACADDRESSUSED); + hdd_ctx->num_provisioned_addr = MACADDRESSUSED; + hdd_populate_random_mac_addr(hdd_ctx, QDF_MAX_CONCURRENCY_PERSONA - MACADDRESSUSED); qdf_mem_copy(&customMacAddr, - &pHddCtx->provisioned_mac_addr[0].bytes[0], + &hdd_ctx->provisioned_mac_addr[0].bytes[0], sizeof(tSirMacAddr)); sme_set_custom_mac_addr(customMacAddr); From 4de485412c11f37bf73eff3bf3915a816ade887c Mon Sep 17 00:00:00 2001 From: Prashanth Chakravarthy Date: Fri, 2 Nov 2018 15:23:51 +0530 Subject: [PATCH 21/55] : prop (CR): Add new sysfs entries for SAR cutback Create sar_mhs and sar_sta sysfs entries for recording wlan states for SAR cutback. The WLAN driver does not care about these entries but they are needed as IPC over to the mdmcutback daemon. Change-Id: I277f7c68e3b74557edb6ff82fa0224d1f470fd95 Reviewed-on: https://gerrit.mot.com/1264155 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Binesh Balasingh Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1456500 Reviewed-by: Prashanth Chakravarthy Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 50a8e44d98b3..85ab73d32571 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -287,6 +287,17 @@ static int enable_11d = -1; static int enable_dfs_chan_scan = -1; static bool is_mode_change_psoc_idle_shutdown; +#define BUF_LEN_SAR 10 +static char sar_sta_buffer[BUF_LEN_SAR]; +static struct kparam_string sar_sta = { + .string = sar_sta_buffer, + .maxlen = BUF_LEN_SAR, +}; +static char sar_mhs_buffer[BUF_LEN_SAR]; +static struct kparam_string sar_mhs = { + .string = sar_mhs_buffer, + .maxlen = BUF_LEN_SAR, +}; #define WLAN_NLINK_CESIUM 30 static qdf_wake_lock_t wlan_wake_lock; @@ -17745,6 +17756,11 @@ exit: return errno; } +static int sar_changed_handler(const char *kmessage, + const struct kernel_param *kp) +{ + return param_set_copystring(kmessage, kp); +} static int hdd_set_con_mode(enum QDF_GLOBAL_MODE mode) { con_mode = mode; @@ -19584,6 +19600,11 @@ static const struct kernel_param_ops fwpath_ops = { .get = param_get_string, }; +static const struct kernel_param_ops sar_ops = { + .set = sar_changed_handler, + .get = param_get_string, +}; + static int __pcie_set_gen_speed_handler(void) { int ret; @@ -19650,6 +19671,11 @@ module_param_cb(con_mode_epping, &con_mode_epping_ops, module_param_cb(fwpath, &fwpath_ops, &fwpath, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +module_param_cb(sar_sta, &sar_ops, &sar_sta, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +module_param_cb(sar_mhs, &sar_ops, &sar_mhs, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + module_param(enable_dfs_chan_scan, int, S_IRUSR | S_IRGRP | S_IROTH); From 4d67856a2a1685b8d8c89857ce18313a4c0d5708 Mon Sep 17 00:00:00 2001 From: jmng34 Date: Fri, 15 Nov 2019 17:50:24 +0530 Subject: [PATCH 22/55] : Fix iwpriv panic iwpriv tool uses extra parameter whereas Mot ioctl uses wrqu data structure. Need to differentiate between the two to resolve panic Change-Id: Icb1c9e4f75ad1f89f43ff2be5fc7f551f3176851 Reviewed-on: https://gerrit.mot.com/1456946 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_hostapd_wext.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 89bb5de70db3..060a5243ec58 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -345,15 +345,33 @@ static __iw_softap_setparam(struct net_device *dev, { struct hdd_adapter *adapter = (netdev_priv(dev)); mac_handle_t mac_handle; - int *value = (int *)extra; - int sub_cmd = value[0]; - int set_value = value[1]; + //BEGIN MOT a19110 IKDREL3KK-11113 Fix iwpriv panic + int *value; + int sub_cmd; + int set_value; + int *tmp = (int *) extra; + //END IKDREL3KK-11113 QDF_STATUS status; int ret = 0; struct hdd_context *hdd_ctx; bool bval = false; hdd_enter_dev(dev); + //BEGIN MOT a19110 IKDREL3KK-11113 Fix iwpriv panic to 8998 + if (tmp[0] < 0 || tmp[0] > QCASAP_SET_TM_LEVEL) { + value = (int *)(wrqu->data.pointer); + } else { + value = (int *)extra; + } + + sub_cmd = value[0]; + set_value = value[1]; + + if (!adapter || !adapter->hdd_ctx) { + hdd_err("Either hostpad adapter is null or Hal ctx is null"); + return -EINVAL; + } + //END IKDREL3KK-11113 hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); From 2152b3eff4f72ae53fd85a25e332418408a605ee Mon Sep 17 00:00:00 2001 From: jmng34 Date: Fri, 15 Nov 2019 18:06:23 +0530 Subject: [PATCH 23/55] :(CR):Not able to disconnect any connected device Ioctls value was being filled up with wrq data structure in softap sdk, but extra parameter was being read from driver. Fix to read the wrq data structure in driver Change-Id: I06d8be4e3665bad937614fcb579c36f5f1159e10 Reviewed-on: https://gerrit.mot.com/1456947 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_hostapd_wext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 060a5243ec58..ce21d807b5fc 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -1424,7 +1424,7 @@ int __iw_softap_modify_acl(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct hdd_adapter *adapter = (netdev_priv(dev)); - uint8_t *value = (uint8_t *) extra; + uint8_t *value = (uint8_t *)(wrqu->data.pointer); uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; int list_type, cmd, i; int ret; @@ -1843,7 +1843,7 @@ static __iw_softap_disassoc_sta(struct net_device *dev, /* iwpriv tool or framework calls this ioctl with * data passed in extra (less than 16 octets); */ - peer_macaddr = (uint8_t *) (extra); + peer_macaddr = (uint8_t *) (wrqu->data.pointer); hdd_debug("data " QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(peer_macaddr)); From 89f884deab3f9010d62b401b7660f5ae7f90012f Mon Sep 17 00:00:00 2001 From: Santhosh Gillella Date: Thu, 26 Jan 2017 16:44:50 -0600 Subject: [PATCH 24/55] prop (CR) ioctl called from Motcode The ioctl handling needs to be differentiated between calls made by Mot code and iwpriv code since they fill in different parameters. Change-Id: If5276c14e20f87c88123c8d3c68849ac8f4e6173 Reviewed-on: https://gerrit.mot.com/1456948 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Reviewed-by: Prashanth Chakravarthy Tested-by: Jira Key Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_wext.c | 40 +++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index a273c996d0a0..cc67a448f21c 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -973,6 +973,8 @@ */ #define WE_SET_CHANNEL 88 #define WE_SET_CONC_SYSTEM_PREF 89 +#define MAX_SUB_CMD 91 // Motorola, IKDREL3KK-10418 + /* * @@ -5867,9 +5869,13 @@ static int __iw_set_three_ints_getnone(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); - int *value = (int *)extra; - int sub_cmd = value[0]; - int ret; + //BEGIN MOT a19110 IKSWL-15774 Ioctl from Mot code + int *value; + int sub_cmd, cmd_len; + int *tmp_value; + int *get_value = NULL; + int ret = 0; + //END IKSWL-15774 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); QDF_STATUS status; @@ -5884,6 +5890,29 @@ static int __iw_set_three_ints_getnone(struct net_device *dev, ret = wlan_hdd_validate_context(hdd_ctx); if (0 != ret) return ret; + //BEGIN MOT a19110 IKSWL-15774 Ioctl from Mot code + tmp_value = (int *)extra; + + // Copy from wrqu structure if it was a ioctl from Motorola code + if(tmp_value[0] < 0 || (tmp_value[0] >= MAX_SUB_CMD)) { + cmd_len = wrqu->data.length; + get_value = (int *) kmalloc(cmd_len+1, GFP_KERNEL); // Motorola, IKHSS7-39028 + + if(get_value == NULL) + return -ENOMEM; + + if(copy_from_user((char *) get_value, (char*)(wrqu->data.pointer), cmd_len)) { + hdd_alert("copy_from_user --data pointer failed! bailing"); + kfree(get_value); + return -EFAULT; + } + + value = (int *)get_value; + } else { + value = (int *)extra; + } + sub_cmd = value[0]; + //END IKSWL-15774 ret = hdd_check_private_wext_control(hdd_ctx, info); if (0 != ret) @@ -5928,6 +5957,11 @@ static int __iw_set_three_ints_getnone(struct net_device *dev, break; } + + //BEGIN MOT a19110 IKSWL-15774 Ioctl from Mot code + if(get_value != NULL) + kfree(get_value); + //END IKSWL-15774 hdd_exit(); return ret; } From 7e471374362ea26280c8e0d42967f7ddc26a5b12 Mon Sep 17 00:00:00 2001 From: jmng34 Date: Fri, 15 Nov 2019 18:33:55 +0530 Subject: [PATCH 25/55] Prop (CR) WLAN Clark Enable extended iwpriv cmnds Enable hostapd ioctl handling fore new iwpriv range added in Rome 2 driver Change-Id: I04ea509aede003fa987f4ebbb012f674eb33a185 Reviewed-on: https://gerrit.mot.com/1456949 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_hostapd_wext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index ce21d807b5fc..45121a32d4b6 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -358,7 +358,7 @@ static __iw_softap_setparam(struct net_device *dev, hdd_enter_dev(dev); //BEGIN MOT a19110 IKDREL3KK-11113 Fix iwpriv panic to 8998 - if (tmp[0] < 0 || tmp[0] > QCASAP_SET_TM_LEVEL) { + if (tmp[0] < 0 || tmp[0] > QCASAP_SET_PHYMODE) { value = (int *)(wrqu->data.pointer); } else { value = (int *)extra; From efab238c4444947ad1baac8dc8ed796739d3290d Mon Sep 17 00:00:00 2001 From: jmng34 Date: Mon, 18 Nov 2019 10:59:49 +0530 Subject: [PATCH 26/55] get correct tx power from ioctl Propogate (CR) : get correct tx power from ioctl. Restructured based on the 8250 files Change-Id: I2216a0442cbb8dbb7fd9a1fcbbed5be9bec177ac Reviewed-on: https://gerrit.mot.com/1456950 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_hostapd_wext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 45121a32d4b6..5a799a32ecd2 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -1540,7 +1540,7 @@ static __iw_softap_set_max_tx_power(struct net_device *dev, { struct hdd_adapter *adapter = (netdev_priv(dev)); struct hdd_context *hdd_ctx; - int *value = (int *)extra; + int *value = (int *)(wrqu->data.pointer); int set_value; int ret; struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT; From 865c90e3b628e491f806a4e27ac51a44bde832d3 Mon Sep 17 00:00:00 2001 From: jmng34 Date: Mon, 18 Nov 2019 11:42:28 +0530 Subject: [PATCH 27/55] : Restructure (CR): Use copy_from_user function Since we use wrqu structure to pass data from qsap, use copy_from_user function to avoid data corruption. Change-Id: Ic5f4f8631246c932432fc2317829534b521ec438 Reviewed-on: https://gerrit.mot.com/1456951 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Raja Phani K --- core/hdd/src/wlan_hdd_hostapd_wext.c | 79 ++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 5a799a32ecd2..1fd564cd165d 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -347,6 +347,7 @@ static __iw_softap_setparam(struct net_device *dev, mac_handle_t mac_handle; //BEGIN MOT a19110 IKDREL3KK-11113 Fix iwpriv panic int *value; + uint8_t *mot_value; //MOT a19110 IKLOCSEN-3014 Use copy from user int sub_cmd; int set_value; int *tmp = (int *) extra; @@ -358,15 +359,24 @@ static __iw_softap_setparam(struct net_device *dev, hdd_enter_dev(dev); //BEGIN MOT a19110 IKDREL3KK-11113 Fix iwpriv panic to 8998 - if (tmp[0] < 0 || tmp[0] > QCASAP_SET_PHYMODE) { - value = (int *)(wrqu->data.pointer); + //BEGIN MOT a19110 IKLOCSEN-3014 use copy_from_user to avoid junk value + if (tmp[0] < 0 || tmp[0] > QCSAP_SET_BTCOEX_LOW_RSSI_THRESHOLD) { + mot_value = (uint8_t *)kmalloc(wrqu->data.length+1, GFP_KERNEL); + if(copy_from_user((uint8_t *) mot_value, (uint8_t *)(wrqu->data.pointer), wrqu->data.length)) { + hdd_err("%s -- copy_from_user --data pointer failed! bailing", + __func__); + kfree(mot_value); + return -EFAULT; + } + sub_cmd = (int )(*(mot_value + 0)); + set_value = (int )(*(mot_value + 1)); + kfree(mot_value); } else { value = (int *)extra; + sub_cmd = value[0]; + set_value = value[1]; } - - sub_cmd = value[0]; - set_value = value[1]; - + //END IKLOCSEN-3014 if (!adapter || !adapter->hdd_ctx) { hdd_err("Either hostpad adapter is null or Hal ctx is null"); return -EINVAL; @@ -1424,7 +1434,7 @@ int __iw_softap_modify_acl(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct hdd_adapter *adapter = (netdev_priv(dev)); - uint8_t *value = (uint8_t *)(wrqu->data.pointer); + uint8_t *value = (uint8_t *) kmalloc(wrqu->data.length+1, GFP_KERNEL); //MOT IKLOCSEN-3014 uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; int list_type, cmd, i; int ret; @@ -1435,8 +1445,18 @@ int __iw_softap_modify_acl(struct net_device *dev, hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); - if (0 != ret) - return ret; + if (0 != ret) { + kfree(value); //MOT IKLOCSEN-3014 + return ret; + } + //BEGIN MOT a19110 IKLOCSEN-3014 use copy_from_user to avoid junk value + if(copy_from_user((uint8_t *) value, (uint8_t *)(wrqu->data.pointer), wrqu->data.length)) { + hdd_err("%s -- copy_from_user --data pointer failed! bailing", + __func__); + kfree(value); + return -EFAULT; + } + //END IKLOCSEN-3014 ret = hdd_check_private_wext_control(hdd_ctx, info); if (0 != ret) @@ -1449,6 +1469,7 @@ int __iw_softap_modify_acl(struct net_device *dev, i++; cmd = (int)(*(value + i)); + kfree(value);//MOT IKLOCSEN-3014 hdd_debug("Modify ACL mac:" QDF_MAC_ADDR_FMT " type: %d cmd: %d", QDF_MAC_ADDR_REF(peer_mac), list_type, cmd); @@ -1540,17 +1561,23 @@ static __iw_softap_set_max_tx_power(struct net_device *dev, { struct hdd_adapter *adapter = (netdev_priv(dev)); struct hdd_context *hdd_ctx; - int *value = (int *)(wrqu->data.pointer); + uint8_t *mot_value; int set_value; int ret; struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT; struct qdf_mac_addr selfMac = QDF_MAC_ADDR_BCAST_INIT; hdd_enter_dev(dev); - - if (!value) + mot_value = (uint8_t*)kmalloc(wrqu->data.length+1, GFP_KERNEL); + if (NULL == mot_value) return -ENOMEM; - + if(copy_from_user((uint8_t *)mot_value, (uint8_t *)(wrqu->data.pointer), wrqu->data.length)) { + hdd_err("%s -- copy from user -- data pointer failed! bailing", __func__); + kfree(mot_value); + return -EFAULT; + } + set_value = (int)(*(mot_value + 0)); + kfree(mot_value); hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); if (0 != ret) @@ -1564,8 +1591,7 @@ static __iw_softap_set_max_tx_power(struct net_device *dev, qdf_copy_macaddr(&bssid, &adapter->mac_addr); qdf_copy_macaddr(&selfMac, &adapter->mac_addr); - set_value = value[0]; - if (QDF_STATUS_SUCCESS != + if (QDF_STATUS_SUCCESS != sme_set_max_tx_power(hdd_ctx->mac_handle, bssid, selfMac, set_value)) { hdd_err("Setting maximum tx power failed"); @@ -1820,7 +1846,7 @@ static __iw_softap_disassoc_sta(struct net_device *dev, { struct hdd_adapter *adapter = (netdev_priv(dev)); struct hdd_context *hdd_ctx; - uint8_t *peer_macaddr; + uint8_t *peer_macaddr = (uint8_t *)kmalloc(wrqu->data.length+1, GFP_KERNEL); //MOT IKLOCSEN-3014 int ret; struct csr_del_sta_params del_sta_params; @@ -1828,22 +1854,33 @@ static __iw_softap_disassoc_sta(struct net_device *dev, if (!capable(CAP_NET_ADMIN)) { hdd_err("permission check failed"); + kfree(peer_macaddr); //MOT IKLOCSEN-3014 return -EPERM; } hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); - if (0 != ret) + if (0 != ret){ + kfree(peer_macaddr); //MOT IKLOCSEN-3014 return ret; - + } ret = hdd_check_private_wext_control(hdd_ctx, info); - if (0 != ret) + if (0 != ret){ + kfree(peer_macaddr); //MOT IKLOCSEN-3014 return ret; + } /* iwpriv tool or framework calls this ioctl with * data passed in extra (less than 16 octets); */ - peer_macaddr = (uint8_t *) (wrqu->data.pointer); + //BEGIN MOT a19110 IKLOCSEN-3014 use copy_from_user to avoid junk value + if(copy_from_user((uint8_t *) peer_macaddr, (uint8_t *)(wrqu->data.pointer), wrqu->data.length)) { + hdd_err("%s -- copy_from_user --data pointer failed! bailing", + __func__); + kfree(peer_macaddr); + return -EFAULT; + } + //END IKLOCSEN-3014 hdd_debug("data " QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(peer_macaddr)); @@ -1852,7 +1889,7 @@ static __iw_softap_disassoc_sta(struct net_device *dev, SIR_MAC_MGMT_DISASSOC, &del_sta_params); hdd_softap_sta_disassoc(adapter, &del_sta_params); - + kfree(peer_macaddr); //MOT IKLOCSEN-3014 hdd_exit(); return 0; } From 6eaa516707df95425d38417a52fd6e3068797930 Mon Sep 17 00:00:00 2001 From: Prashanth Chakravarthy Date: Fri, 13 Oct 2017 12:28:29 +0530 Subject: [PATCH 28/55] prop (CR) Dont initialise ACL list Dont initialise ACL list when soft ap turns on, Qsap sends ioctl command to set the list. Change-Id: Iaee9a7c85dcb12798b7ec871bffc6f006c9ab4fb Reviewed-on: https://gerrit.mot.com/1073553 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Coverity Analysis Reviewed-by: Ishwara J A Reviewed-by: Ranjeet Gupta Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1463706 Reviewed-by: Prashanth Chakravarthy --- core/sap/src/sap_module.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index e0262ec99646..13199719d16d 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -844,6 +844,9 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, pmac->sap.SapDfsInfo.sap_ch_switch_mode, pmac->sap.SapDfsInfo.reduced_beacon_interval); + //BEGIN MOT a19110 IKSWO-8490 Comment out initialisation of + //acl list. We use driver ioctl to set it +#if 0 /* Copy MAC filtering settings to sap context */ sap_ctx->eSapMacAddrAclMode = config->SapMacaddr_acl; qdf_mem_copy(sap_ctx->acceptMacList, config->accept_mac, @@ -854,7 +857,10 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, sizeof(config->deny_mac)); sap_ctx->nDenyMac = config->num_deny_mac; sap_sort_mac_list(sap_ctx->denyMacList, sap_ctx->nDenyMac); - sap_ctx->beacon_tx_rate = config->beacon_tx_rate; +#endif + //END IKSWO-8490 + sap_ctx->beacon_tx_rate = config->beacon_tx_rate; + /* Fill in the event structure for FSM */ sap_event.event = eSAP_HDD_START_INFRA_BSS; From 8fe4176085f933c8b429e74125d3316f404eb780 Mon Sep 17 00:00:00 2001 From: Abhay Kumar Date: Tue, 10 Dec 2019 14:12:20 +0530 Subject: [PATCH 29/55] : demsg error logs cleaup Moving this log as debug logs by Motorola as Qualcomm need to support multiple configuration. Change-Id: Ic7dbfe906b844d23f159e73d2795159158e4dbcc Reviewed-on: https://gerrit.mot.com/1469662 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_debugfs_csr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_debugfs_csr.c b/core/hdd/src/wlan_hdd_debugfs_csr.c index f3ceb75f3ef0..3020027e464c 100644 --- a/core/hdd/src/wlan_hdd_debugfs_csr.c +++ b/core/hdd/src/wlan_hdd_debugfs_csr.c @@ -327,7 +327,7 @@ void wlan_hdd_debugfs_csr_init(struct hdd_adapter *adapter) adapter->debugfs_phy, csr, &fops_csr_debugfs); if (!csr->entry) - hdd_err("Failed to create generic_info debugfs file"); + hdd_debug("Failed to create generic_info debugfs file"); // MOT IKSWQ-39460 abhkumar Error logs cleanup } csr = &adapter->csr_file[HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO]; @@ -339,7 +339,7 @@ void wlan_hdd_debugfs_csr_init(struct hdd_adapter *adapter) adapter->debugfs_phy, csr, &fops_csr_debugfs); if (!csr->entry) - hdd_err("Failed to create generic_info debugfs file"); + hdd_debug("Failed to create generic_info debugfs file"); // MOT IKSWQ-39460 abhkumar Error logs cleanup } } From dd78410f07ea4a15f46bd61a388fcb4f964e97d1 Mon Sep 17 00:00:00 2001 From: jmng34 Date: Thu, 9 Jan 2020 15:06:35 +0530 Subject: [PATCH 30/55] : generate 2 mac address based on serial number For the concurrency mode sta+sap , we need 2 mac addresses DUT is generating only 1 mac address based on serial number added the code to generate the remaining mac addresses Change-Id: I6d2880f746656d332ace67417edb29ad8b97b44a Reviewed-on: https://gerrit.mot.com/1481319 Reviewed-by: Prashanth Chakravarthy SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_cfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 2a819e2492de..e9d6a53c8869 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -62,6 +62,7 @@ #define MACSTRLEN 12 #define MACSTRCOLON 58 #define MACADDRESSUSED 2 +#define MACSERIALADDR 1 struct sdesc { struct shash_desc shash; @@ -120,9 +121,10 @@ QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx) qdf_status = QDF_STATUS_E_FAILURE; goto config_exit; } - hdd_ctx->num_provisioned_addr = MACADDRESSUSED; + hdd_ctx->num_provisioned_addr = MACSERIALADDR; qdf_mem_copy(&hdd_ctx->provisioned_mac_addr[0].bytes[0], (uint8_t *)computedMac, QDF_MAC_ADDR_SIZE); + hdd_populate_random_mac_addr(hdd_ctx, QDF_MAX_CONCURRENCY_PERSONA - MACSERIALADDR); //hdd_ctx->num_derived_addr++; config_exit: From afb3706a7e7985e396e225ff2bffcf0fc99727e8 Mon Sep 17 00:00:00 2001 From: K Purushotham Reddy Date: Wed, 17 Jan 2018 15:15:28 +0530 Subject: [PATCH 31/55] Prop (CR): Store WLAN Unstripped in build archives Copy qca_cld3_wlan.ko.unstripped to out symbols folder during build time. This will save significant time to fetch the unstripped during Kernel panic analysis by avoiding repo Sync and rebuilding the image on which issue happened. Change-Id: I1fc720560e0f74178Montana0ef604413e5b553dbd2f Reviewed-on: https://gerrit.mot.com/1119046 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1456501 Submit-Approved: Raja Phani K --- Android.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Android.mk b/Android.mk index e38633439607..4027832c3434 100644 --- a/Android.mk +++ b/Android.mk @@ -146,6 +146,15 @@ ifneq ($(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME)),) KBUILD_OPTIONS += "$(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME))" endif +########################################################## +# Copy the unstrip file to out symbols folders +WLAN_SYMBOLS_OUT := $(TARGET_OUT_UNSTRIPPED)/$(LOCAL_PATH) +UNSTRIPPED_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko.unstripped +UNSTRIPPED_FILE_PATH := $(TARGET_OUT_INTERMEDIATES)/$(LOCAL_PATH)/$(UNSTRIPPED_MODULE) + +INSTALL_WLAN_UNSTRIPPED_MODULE := mkdir -p $(WLAN_SYMBOLS_OUT); \ + cp -rf $(UNSTRIPPED_FILE_PATH) $(WLAN_SYMBOLS_OUT) + include $(CLEAR_VARS) LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko LOCAL_MODULE_KBUILD_NAME := $(LOCAL_MOD_NAME).ko @@ -160,6 +169,9 @@ else LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET) endif +# Once unstripped file is generated, copy the same to out symbols folder +LOCAL_POST_INSTALL_CMD := $(INSTALL_WLAN_UNSTRIPPED_MODULE) + include $(DLKM_DIR)/AndroidKernelModule.mk ########################################################### From dfb5d709fb813fc31cea5f7504f89b7235c049a7 Mon Sep 17 00:00:00 2001 From: vineetv Date: Thu, 25 Jun 2020 10:12:58 +0530 Subject: [PATCH 32/55] : Disable CH14 for JAPAN We do not enable CH14 for JAPAN on all of our products and have disabled it on 8998 as well. QC SR : 04679882 Change-Id: Ibd37d238877c81b180dcd1e3e72e84ef4d868592 Signed-off-by: vineetv Reviewed-on: https://gerrit.mot.com/1642393 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Prashanth Chakravarthy Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_cfg80211.c | 4 ++-- core/sap/src/sap_module.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 3c5cd5e6ad03..c0216bd2c447 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -269,7 +269,7 @@ static const struct ieee80211_channel hdd_channels_2_4_ghz[] = { HDD2GHZCHAN(2462, 11, 0), HDD2GHZCHAN(2467, 12, 0), HDD2GHZCHAN(2472, 13, 0), - HDD2GHZCHAN(2484, 14, 0), + }; static const struct ieee80211_channel hdd_channels_5_ghz[] = { @@ -1944,7 +1944,7 @@ static int wlan_hdd_set_acs_ch_range( sap_cfg->acs_cfg.start_ch_freq = wlan_reg_ch_to_freq(CHAN_ENUM_2412); sap_cfg->acs_cfg.end_ch_freq = - wlan_reg_ch_to_freq(CHAN_ENUM_2484); + wlan_reg_ch_to_freq(CHAN_ENUM_2472); } else if (hw_mode == QCA_ACS_MODE_IEEE80211G) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11g; sap_cfg->acs_cfg.start_ch_freq = diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 13199719d16d..dd3cdc0d1c09 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2337,11 +2337,11 @@ void wlansap_extend_to_acs_range(mac_handle_t mac_handle, } if (*end_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484)) { - *bandEndChannel = CHAN_ENUM_2484; + *bandEndChannel = CHAN_ENUM_2472; tmp_end_ch_freq = (*end_ch_freq + ACS_2G_EXTEND) <= - wlan_reg_ch_to_freq(CHAN_ENUM_2484) ? + wlan_reg_ch_to_freq(CHAN_ENUM_2472) ? (*end_ch_freq + ACS_2G_EXTEND) : - wlan_reg_ch_to_freq(CHAN_ENUM_2484); + wlan_reg_ch_to_freq(CHAN_ENUM_2472); } else if (*end_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_5885)) { *bandEndChannel = CHAN_ENUM_5885; tmp_end_ch_freq = (*end_ch_freq + ACS_5G_EXTEND) <= From 7e7dbea388cab104687788878d95f962ed551d5c Mon Sep 17 00:00:00 2001 From: K Purushotham Reddy Date: Wed, 17 Jan 2018 15:15:28 +0530 Subject: [PATCH 33/55] Store WLAN Unstripped and ELF in build archives Copy qca_cld3_wlan.ko.unstripped and WLAN_MERGED.elf files to out symbols folder during build time. This will save significant time to fetch the unstripped and elf files during Kernel panic analysis by avoiding repo Sync and rebuilding the image on which issue happened. This is a squash for all Helium products. Change-Id: I5a4ce7b77e9ead134ae969efa46bbecedc0f9d37 --- Android.mk | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Android.mk b/Android.mk index 4027832c3434..7c995d281d6a 100644 --- a/Android.mk +++ b/Android.mk @@ -147,13 +147,35 @@ KBUILD_OPTIONS += "$(WLAN_KBUILD_OPTIONS_$(LOCAL_DEV_NAME))" endif ########################################################## -# Copy the unstrip file to out symbols folders +# Copy the unstrip file and corresponding elf file to out symbols folders WLAN_SYMBOLS_OUT := $(TARGET_OUT_UNSTRIPPED)/$(LOCAL_PATH) UNSTRIPPED_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko.unstripped UNSTRIPPED_FILE_PATH := $(TARGET_OUT_INTERMEDIATES)/$(LOCAL_PATH)/$(UNSTRIPPED_MODULE) INSTALL_WLAN_UNSTRIPPED_MODULE := mkdir -p $(WLAN_SYMBOLS_OUT); \ - cp -rf $(UNSTRIPPED_FILE_PATH) $(WLAN_SYMBOLS_OUT) + cp -rf $(UNSTRIPPED_FILE_PATH) $(WLAN_SYMBOLS_OUT); + +ifneq ($(filter msm8998 sdm845 sdm670 sdm710, $(TARGET_BOARD_PLATFORM)),) + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/wlan_proc/build/ms/WLAN_MERGED.elf +else ifneq ($(filter sdm660, $(TARGET_BOARD_PLATFORM)),) + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.1.0.1/wlan_proc/build/ms/WLAN_MERGED.elf +else ifneq ($(filter sm6150, $(TARGET_BOARD_PLATFORM)),) + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.0.1/wlan_proc/build/ms/*.elf +else ifneq ($(filter trinket, $(TARGET_BOARD_PLATFORM)),) + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.0.2/wlan_proc/build/ms/WLAN_MERGED.elf +else ifneq ($(filter lito, $(TARGET_BOARD_PLATFORM)),) + ifeq ($(WLAN_FW_ALT_VER), 5) + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.5/wlan_proc/build/ms/Msaipan_WLAN_MERGED.elf + else + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.1/wlan_proc/build/ms/Msaipan_WLAN_MERGED.elf + endif +else ifneq ($(filter bengal, $(TARGET_BOARD_PLATFORM)),) + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.4/wlan_proc/build/ms/WLAN_MERGED.elf +endif + +ifneq ($(WLAN_ELF_FILE_PATH),) + INSTALL_WLAN_UNSTRIPPED_MODULE += cp -rf $(WLAN_ELF_FILE_PATH) $(WLAN_SYMBOLS_OUT) +endif include $(CLEAR_VARS) LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko From 2d15eaf50742f076f60bcea2844855c2705eb877 Mon Sep 17 00:00:00 2001 From: liubin7 Date: Sat, 30 Nov 2019 10:36:54 +0800 Subject: [PATCH 34/55] use bt_coex_mode_set to deterministically signify the DHCP start / Stop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the current infrastructure , “setPowerSave false” is known for DHCP start and “setPowerSave true” for DHCP stop. Thus, the BT Coex will give preference to Wi-Fi during this period of DHCP start – stop. This setPowerSave false / true interface is not only triggered on DHCP start / stop but this is also a public API which can be triggered by the applications when they want the Wi-Fi system to go in to WIFI_MODE_FULL_HIGH_PERF. Thus , the “setpowersave false“ will be triggered but not the corresponding “true” . As a result , the BT Coex module shall assume that the DHCP is still in progress and keeps giving preference to Wi-Fi. and WifiNative.setBluetoothCoexistenceMode() is invoked only when DHCP start & stop, hence we can use bt_coex_mode_set to deterministically signify the DHCP start / Stop and send DHCP start / stop indication to FW Change-Id: If5cca595aec22b7a10af4b127a5f75118d1ddc26 Signed-off-by: liubin7 Reviewed-on: https://gerrit.mot.com/1464100 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_power.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 7099e39b2498..bdf3f1344a25 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2621,8 +2621,10 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, if (hdd_adapter_is_connected_sta(adapter)) { hdd_debug("vdev mode %d enable dhcp protection", adapter->device_mode); - allow_power_save ? hdd_stop_dhcp_ind(adapter) : - hdd_start_dhcp_ind(adapter); + if ( hdd_ctx->bt_coex_mode_set ) { + allow_power_save ? hdd_stop_dhcp_ind(adapter) : + hdd_start_dhcp_ind(adapter); + } } else { hdd_debug("vdev mod %d disconnected ignore dhcp protection", adapter->device_mode); From 9f9347eab4178d05e92065b247f9bbc0e923ad53 Mon Sep 17 00:00:00 2001 From: liaoxl Date: Wed, 12 Feb 2020 13:42:52 +0800 Subject: [PATCH 35/55] add wifi tx pwr limit cmd for mimo device (CR) add wifi tx pwr limit cmd for mimo device (CR) add wifi mimo tx pwr limit cmd under softap mode Per RF team req, add cmd to call QCom wmi api, so we can change TX power limit values of each ANT channel. add sub ioctl for wifi mimo tx pwr limit settings under softap mode reworked for Android R. Change-Id: Ibafe21c99b6f91e6ddf881a6109cb1a478e9284f --- core/hdd/inc/qc_sap_ioctl.h | 3 + core/hdd/src/wlan_hdd_hostapd_wext.c | 7 +++ core/hdd/src/wlan_hdd_wext.c | 83 ++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/core/hdd/inc/qc_sap_ioctl.h b/core/hdd/inc/qc_sap_ioctl.h index f460b40a1478..b10fb0dba83a 100644 --- a/core/hdd/inc/qc_sap_ioctl.h +++ b/core/hdd/inc/qc_sap_ioctl.h @@ -89,6 +89,9 @@ struct channel_list_info { #define WE_SET_THERMAL_THROTTLE_CFG 27 +/* for moto SAR features, support tx pwr limit settings on mimo device */ +#define WE_SET_MIMO_TX_POWER 32 + #define WE_P2P_NOA_CMD 2 #define QCSAP_IOCTL_MODIFY_ACL (SIOCIWFIRSTPRIV + 18) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 1fd564cd165d..9bf4860b1ec1 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -3136,6 +3136,13 @@ static const struct iw_priv_args hostapd_private_args[] = { } , #endif /* FW_THERMAL_THROTTLE_SUPPORT */ + /* for moto SAR feature */ + { + WE_SET_MIMO_TX_POWER, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, "setTxPowerM" + } + , /* handlers for main ioctl */ { QCSAP_IOCTL_MODIFY_ACL, diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index cc67a448f21c..8e5ba551ee91 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -2532,6 +2532,9 @@ #define WE_SET_TXRX_STATS 24 +/* for moto SAR features, support tx pwr limit settings on mimo device */ +#define WE_SET_MIMO_TX_POWER 32 + #ifdef FEATURE_WLAN_TDLS #undef MAX_VAR_ARGS #define MAX_VAR_ARGS 11 @@ -7417,6 +7420,81 @@ static int __iw_set_var_ints_getnone(struct net_device *dev, break; } #endif /* FW_THERMAL_THROTTLE_SUPPORT */ + + /* for moto SAR features, support tx pwr limit settings on mimo device */ + case WE_SET_MIMO_TX_POWER: + { + struct sar_limit_cmd_params *sar_limit_cmd; + mac_handle_t mac_handle = hdd_ctx->mac_handle; + int ret = -EINVAL; + uint32_t num_limit_rows = 4; + struct sar_limit_cmd_row *row; + + if (!mac_handle) + return -EINVAL; + + sar_limit_cmd = qdf_mem_malloc(sizeof(struct sar_limit_cmd_params)); + if (!sar_limit_cmd) + return -ENOMEM; + + sar_limit_cmd->commit_limits = 1; + sar_limit_cmd->sar_enable = WMI_SAR_FEATURE_ON_USER_DEFINED; + + row = qdf_mem_malloc(sizeof(*row) * num_limit_rows); + if (!row) { + qdf_mem_free(sar_limit_cmd); + hdd_err("Failed to allocate memory for sar_limit_row_list"); + return -EINVAL; + } + + //Below band/chain/limit_value number will get from Modem + //either CCK or OFDM, set the validity_bitmap as WMI_SAR_BAND_ID_VALID_MASK |WMI_SAR_CHAIN_ID_VALID_MASK + row[0].band_id = WMI_SAR_2G_ID; //WMI_SAR_2G_ID - 0; WMI_SAR_5G_ID - 1 + row[0].chain_id = 0; + row[0].mod_id = WMI_SAR_MOD_OFDM; + row[0].limit_value = apps_args[0]; + row[0].validity_bitmap = WMI_SAR_BAND_ID_VALID_MASK |WMI_SAR_CHAIN_ID_VALID_MASK; + + row[1].band_id = WMI_SAR_2G_ID; //WMI_SAR_2G_ID - 0; WMI_SAR_5G_ID - 1 + row[1].chain_id = 1; + row[1].mod_id = WMI_SAR_MOD_OFDM; + row[1].limit_value = apps_args[1]; + row[1].validity_bitmap = WMI_SAR_BAND_ID_VALID_MASK |WMI_SAR_CHAIN_ID_VALID_MASK; + + row[2].band_id = WMI_SAR_5G_ID; //WMI_SAR_2G_ID - 0; WMI_SAR_5G_ID - 1 + row[2].chain_id = 0; + row[2].mod_id = WMI_SAR_MOD_OFDM; + row[2].limit_value = apps_args[2]; + row[2].validity_bitmap = WMI_SAR_BAND_ID_VALID_MASK |WMI_SAR_CHAIN_ID_VALID_MASK |WMI_SAR_MOD_ID_VALID_MASK; + + row[3].band_id = WMI_SAR_5G_ID; //WMI_SAR_2G_ID - 0; WMI_SAR_5G_ID - 1 + row[3].chain_id = 1; + row[3].mod_id = WMI_SAR_MOD_OFDM; + row[3].limit_value = apps_args[3]; + row[3].validity_bitmap = WMI_SAR_BAND_ID_VALID_MASK |WMI_SAR_CHAIN_ID_VALID_MASK |WMI_SAR_MOD_ID_VALID_MASK; + + sar_limit_cmd->num_limit_rows = num_limit_rows; + sar_limit_cmd->sar_limit_row_list = row; + hdd_info("change pwr limit to [%d, %d, %d, %d].", + row[0].limit_value, row[1].limit_value, row[2].limit_value, row[3].limit_value); + if (sme_set_sar_power_limits(mac_handle,sar_limit_cmd) + != QDF_STATUS_SUCCESS) { + hdd_err("Setting maximum tx power failed"); + if(sar_limit_cmd) { + qdf_mem_free(sar_limit_cmd->sar_limit_row_list); + qdf_mem_free(sar_limit_cmd); + } + ret = -EIO; + break; + } + else{ + /* save settings in hdd_ctx, so can restore configs after SSR */ + hdd_store_sar_config(hdd_ctx, sar_limit_cmd); + hdd_info("Setting maximum tx power successful"); + } + } + break; + default: { hdd_err("Invalid IOCTL command %d", sub_cmd); @@ -10054,6 +10132,11 @@ static const struct iw_priv_args we_private_args[] = { 0, "ch_avoid"}, #endif + /* for moto SAR features, support tx pwr limit settings on mimo device */ + {WE_SET_MIMO_TX_POWER, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, + "setTxPowerM"}, /* handlers for main ioctl */ {WLAN_PRIV_FIPS_TEST, IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, From 291dff86c1810416dd300028db862928b9d86f47 Mon Sep 17 00:00:00 2001 From: Mark Reed-MREED1 Date: Tue, 4 Aug 2020 09:34:14 -0500 Subject: [PATCH 36/55] - Update wifimacaddr command line arg Remove wifimacaddr from android ro.boot property set as this property is not required and just leaks information. Change-Id: If097394bc4e9dff819fd871bcff66575a4db04c7 Reviewed-on: https://gerrit.mot.com/1714017 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Reviewed-by: Sireesha Kosuri Reviewed-by: Prashanth Chakravarthy Tested-by: Jira Key Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index e9d6a53c8869..d85b0b34d99f 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -57,7 +57,7 @@ #include #include -#define WIFI_MAC_BOOTARG "androidboot.wifimacaddr=" +#define WIFI_MAC_BOOTARG "wifimacaddr=" #define DEVICE_SERIALNO_BOOTARG "androidboot.serialno=" #define MACSTRLEN 12 #define MACSTRCOLON 58 From 7547f8bb949c5b2b45cbe2f9866bc8e5a502e454 Mon Sep 17 00:00:00 2001 From: Daniel Finimundi Date: Thu, 16 Jul 2020 15:06:30 -0300 Subject: [PATCH 37/55] lito: Update FW version for R 7250 products will use the same WLAN version on R WLAN.HL.3.3.1. Only copy this version. Change-Id: I8d97d00a5271f23b7723020d5740e4677f51a338 Signed-off-by: Daniel Finimundi Reviewed-on: https://gerrit.mot.com/1687654 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Yinjun Chen Submit-Approved: Jira Key --- Android.mk | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Android.mk b/Android.mk index 7c995d281d6a..0acbbe9a076a 100644 --- a/Android.mk +++ b/Android.mk @@ -164,11 +164,7 @@ else ifneq ($(filter sm6150, $(TARGET_BOARD_PLATFORM)),) else ifneq ($(filter trinket, $(TARGET_BOARD_PLATFORM)),) WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.0.2/wlan_proc/build/ms/WLAN_MERGED.elf else ifneq ($(filter lito, $(TARGET_BOARD_PLATFORM)),) - ifeq ($(WLAN_FW_ALT_VER), 5) - WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.5/wlan_proc/build/ms/Msaipan_WLAN_MERGED.elf - else - WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.1/wlan_proc/build/ms/Msaipan_WLAN_MERGED.elf - endif + WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.3.1/wlan_proc/build/ms/Msaipan_WLAN_MERGED.elf else ifneq ($(filter bengal, $(TARGET_BOARD_PLATFORM)),) WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.4/wlan_proc/build/ms/WLAN_MERGED.elf endif From 94285571496ae1afea733fcfdf4dca3040b769f9 Mon Sep 17 00:00:00 2001 From: sunyue5 Date: Fri, 20 Mar 2020 11:05:19 +0800 Subject: [PATCH 38/55] prop (CR) the MAC address more appropriately 1. Compatible with utag that only has one MAC address 2. For the generated MAC address from serialno, set the provisioned mac address as the custom mac address Change-Id: I80e96dd906c32411a42e875447504baadd66d4b6 Signed-off-by: sunyue5 Reviewed-on: https://gerrit.mot.com/1744536 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Sireesha Kosuri Reviewed-by: Zhilu Yin Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_cfg.c | 154 +++++++++++++++++------------------- 1 file changed, 74 insertions(+), 80 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index d85b0b34d99f..3a34295f7fb0 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -60,9 +60,6 @@ #define WIFI_MAC_BOOTARG "wifimacaddr=" #define DEVICE_SERIALNO_BOOTARG "androidboot.serialno=" #define MACSTRLEN 12 -#define MACSTRCOLON 58 -#define MACADDRESSUSED 2 -#define MACSERIALADDR 1 struct sdesc { struct shash_desc shash; @@ -80,6 +77,7 @@ QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx) char *bufferPtr = NULL; char *computedMac = NULL; const char *cmd_line = NULL; + tSirMacAddr mac_addr; struct device_node *chosen_node = NULL; computedMac = (char*)qdf_mem_malloc(QDF_MAC_ADDR_SIZE); @@ -121,12 +119,13 @@ QDF_STATUS hdd_update_mac_serial(struct hdd_context *hdd_ctx) qdf_status = QDF_STATUS_E_FAILURE; goto config_exit; } - hdd_ctx->num_provisioned_addr = MACSERIALADDR; qdf_mem_copy(&hdd_ctx->provisioned_mac_addr[0].bytes[0], (uint8_t *)computedMac, QDF_MAC_ADDR_SIZE); - hdd_populate_random_mac_addr(hdd_ctx, QDF_MAX_CONCURRENCY_PERSONA - MACSERIALADDR); - //hdd_ctx->num_derived_addr++; - + qdf_mem_copy(&mac_addr, &hdd_ctx->provisioned_mac_addr[0].bytes[0], + sizeof(tSirMacAddr)); + hdd_ctx->num_provisioned_addr = 1; // Only one address was generated + hdd_populate_random_mac_addr(hdd_ctx, QDF_MAX_CONCURRENCY_PERSONA - 1); + sme_set_custom_mac_addr(mac_addr); config_exit: qdf_mem_free(computedMac); return qdf_status; @@ -518,11 +517,11 @@ config_exit: QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) { int len = 0; - int iteration = 0; - + int i = 0; + int intf = 0; char *bufferPtr = NULL; - char buffer_temp[MACSTRLEN]; - char buffer_mac2[MACSTRLEN]; + char name[QDF_MAX_CONCURRENCY_PERSONA][16] = {{0}}; + char buffer_temp[QDF_MAX_CONCURRENCY_PERSONA][MACSTRLEN+1] = {{0}}; const char *cmd_line = NULL; struct device_node *chosen_node = NULL; char *buffer = NULL; @@ -534,76 +533,71 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx) memset(macTable, 0, sizeof(macTable)); - /*Implemenation of QCOM is to read the MAC address from the predefined*/ - /*location where WLAN MMAC File have the MAC Address */ - /* Read MACs from bootparams. */ - chosen_node = of_find_node_by_name(NULL, "chosen"); - hdd_err("%s: get chosen node \n", __func__); - if (!chosen_node) - { - hdd_err("%s: get chosen node read failed \n", __func__); - goto config_exit; - } else { - cmd_line = of_get_property(chosen_node, "bootargs", &len); + /*Implemenation of QCOM is to read the MAC address from the predefined*/ + /*location where WLAN MMAC File have the MAC Address */ + /* Read MACs from bootparams. */ + chosen_node = of_find_node_by_name(NULL, "chosen"); + hdd_err("%s: get chosen node \n", __func__); + if (!chosen_node) + { + hdd_err("%s: get chosen node read failed \n", __func__); + goto config_exit; + } else { + cmd_line = of_get_property(chosen_node, "bootargs", &len); - if (!cmd_line || len <= 0) { - hdd_err("%s: get wlan MACs bootargs failed \n", __func__); - qdf_status = QDF_STATUS_E_FAILURE; - goto config_exit; - } else { - buffer = strstr(cmd_line, WIFI_MAC_BOOTARG); - if (buffer == NULL) { - hdd_err("%s: " WIFI_MAC_BOOTARG " bootarg cmd line is null", __func__); - qdf_status = QDF_STATUS_E_FAILURE; - goto config_exit; - } else { - buffer += strlen(WIFI_MAC_BOOTARG); - bufferPtr = buffer; - } - } - } - /* Mac address data format used by qcom: - * Intf0MacAddress=00AA00BB00CC - * Intf1MacAddress=00AA00BB00CD - * xxxxxxxxxxxxxxxxxxxxxxxxxxxx - * From bootarg we need to strip off : from macaddress - */ - for (iteration = 0; iteration < MACSTRLEN; iteration++) { - if (*bufferPtr != MACSTRCOLON) { - buffer_temp[iteration] = *bufferPtr; - } else { - iteration = iteration - 1; - } - bufferPtr++; - } - if( *bufferPtr == ',' || *bufferPtr == '-') { - bufferPtr++; - } - for (iteration = 0; iteration < MACSTRLEN; iteration++) { - if (*bufferPtr != MACSTRCOLON) { - buffer_mac2[iteration] = *bufferPtr; - } else { - iteration = iteration - 1; - } - bufferPtr++; - } - /* Mac address data format used by qcom: - * Intf0MacAddress used for 1 macaddress - * if gp2pdeviceAdmistered is set to 1 - * if s020deviceAdmisnited is set to 0 - * it will use Intf1MacAddress for P2P seprately - * Motorola decided to use gp2pdeviceAdmistered = 1 i.e use - * locally gerated bin MAC addr for P2P - */ - macTable[0].name = "Intf0MacAddress"; - macTable[0].value = &buffer_temp[0]; - macTable[1].value = &buffer_mac2[0]; - update_mac_from_string(hdd_ctx, &macTable[0], MACADDRESSUSED); - hdd_ctx->num_provisioned_addr = MACADDRESSUSED; - hdd_populate_random_mac_addr(hdd_ctx, QDF_MAX_CONCURRENCY_PERSONA - MACADDRESSUSED); - qdf_mem_copy(&customMacAddr, - &hdd_ctx->provisioned_mac_addr[0].bytes[0], - sizeof(tSirMacAddr)); + if (!cmd_line || len <= 0) { + hdd_err("%s: get wlan MACs bootargs failed \n", __func__); + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } else { + buffer = strstr(cmd_line, WIFI_MAC_BOOTARG); + if (buffer == NULL) { + hdd_err("%s: " WIFI_MAC_BOOTARG " bootarg cmd line is null", __func__); + qdf_status = QDF_STATUS_E_FAILURE; + goto config_exit; + } else { + buffer += strlen(WIFI_MAC_BOOTARG); + bufferPtr = buffer; + } + } + } + /* Mac address data format used by qcom: + * Intf0MacAddress=00AA00BB00CC + * Intf1MacAddress=00AA00BB00CD + * xxxxxxxxxxxxxxxxxxxxxxxxxxxx + * Intf0MacAddress used for 1 macaddress + * if gp2pdeviceAdmistered is set to 1 + * if s020deviceAdmisnited is set to 0 + * it will use Intf1MacAddress for P2P seprately + * Motorola decided to use gp2pdeviceAdmistered = 1 i.e use + * locally gerated bin MAC addr for P2P + * From bootarg we need to strip off : from macaddress + */ + while (*bufferPtr != '\0' && *bufferPtr != ' ') { + if (*bufferPtr != ':' && *bufferPtr != ',') { + buffer_temp[intf][i++] = *bufferPtr; + if (i == MACSTRLEN) { + buffer_temp[intf][i] = '\0'; + sprintf(name[intf], "Intf%dMacAddress", intf); + macTable[intf].name = name[intf]; + macTable[intf].value = buffer_temp[intf]; + i = 0; + intf++; + hdd_ctx->num_provisioned_addr++; + if (intf >= QDF_MAX_CONCURRENCY_PERSONA) + break; + } + } + bufferPtr++; + } + + for (i = 0; i < intf; i++) + hdd_err("Mac address table from utag: [%s][%s]", macTable[i].name, macTable[i].value); + + update_mac_from_string(hdd_ctx, &macTable[0], intf); + hdd_populate_random_mac_addr(hdd_ctx, QDF_MAX_CONCURRENCY_PERSONA - intf); + qdf_mem_copy(&customMacAddr, &hdd_ctx->provisioned_mac_addr[0].bytes[0], + sizeof(tSirMacAddr)); sme_set_custom_mac_addr(customMacAddr); config_exit: From 45eeff18223a74d6cbb3fce15b847162f678c285 Mon Sep 17 00:00:00 2001 From: liaoxl Date: Sun, 27 Sep 2020 16:52:19 +0800 Subject: [PATCH 39/55] fix compile errors changes in kernel & QCom wlan driver API, so we need these to meet API requirement. Change-Id: I3bf93eeacf8ab0451db72296f3dc5ba6f5f75030 --- core/hdd/src/wlan_hdd_cfg.c | 1 - core/hdd/src/wlan_hdd_wext.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 3a34295f7fb0..7bc77b604267 100755 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -165,7 +165,6 @@ QDF_STATUS hdd_generate_random_mac_from_serialno(char *serialNo, int serialnoLen } sdescmd5->shash.tfm = md5; - sdescmd5->shash.flags = 0x0; if (crypto_shash_init(&sdescmd5->shash)) { cryptoStatus = QDF_STATUS_E_FAILURE; diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 8e5ba551ee91..c1748f863a0f 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -114,6 +114,7 @@ #include "wlan_fwol_ucfg_api.h" #include "wlan_hdd_unit_test.h" #include "wlan_hdd_thermal.h" +#include "wlan_hdd_sar_limits.h" /* Private ioctls and their sub-ioctls */ #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) From 37d89e17f0f2a4998b52b0c55db36b5605975620 Mon Sep 17 00:00:00 2001 From: liaoxl Date: Wed, 18 Nov 2020 16:51:23 +0800 Subject: [PATCH 40/55] sm4350: Store WLAN Unstripped and ELF in build archives Copy qca_cld3_wlan.ko.unstripped and WLAN_MERGED.elf files to out symbols folder during build time. This will save significant time to fetch the unstripped and elf files during Kernel panic analysis by avoiding repo Sync and rebuilding the image on which issue happened. Change-Id: I5b0a7ca71eb4bd909fcec5b0bc676a5b296b0eec Reviewed-on: https://gerrit.mot.com/1805423 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- Android.mk | 4 ++++ get_value_from_xml.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 get_value_from_xml.py diff --git a/Android.mk b/Android.mk index 0acbbe9a076a..38374a454b83 100644 --- a/Android.mk +++ b/Android.mk @@ -167,6 +167,10 @@ else ifneq ($(filter lito, $(TARGET_BOARD_PLATFORM)),) WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.3.1/wlan_proc/build/ms/Msaipan_WLAN_MERGED.elf else ifneq ($(filter bengal, $(TARGET_BOARD_PLATFORM)),) WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.4/wlan_proc/build/ms/WLAN_MERGED.elf +else ifneq ($(filter holi, $(TARGET_BOARD_PLATFORM)),) + XML_PATH := vendor/qcom/nonhlos/Mannar.LA.1.0 + ELF_PATH := $(shell python3 $(LOCAL_PATH)/get_value_from_xml.py $(XML_PATH)/contents.xml) + WLAN_ELF_FILE_PATH := $(XML_PATH)/$(ELF_PATH)wlan_proc/build/ms/*.elf endif ifneq ($(WLAN_ELF_FILE_PATH),) diff --git a/get_value_from_xml.py b/get_value_from_xml.py new file mode 100644 index 000000000000..c46b21f50aa1 --- /dev/null +++ b/get_value_from_xml.py @@ -0,0 +1,28 @@ +#! /usr/bin/env python3 +#coding=utf-8 + +def main(): + import os + import sys + import xml.etree.ElementTree as ET + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument('xml', help = 'xml path') + + args = parser.parse_args() + + fp = args.xml + if not os.path.exists(fp): + print("Error: file '%s' not exist"%(fp), file=sys.stderr) + tree = ET.parse(fp) + root = tree.getroot() + for i in root.findall("./builds_flat/build"): + d = {} + for j in i: + d[j.tag] = j.text + if d.get("name") == "wlan": + print(d["linux_root_path"]) + +if __name__=="__main__": + main() From b6e40b1076d07dd8cf4242605bc5806aaf0491d6 Mon Sep 17 00:00:00 2001 From: zhangly19 Date: Mon, 17 May 2021 19:27:34 +0800 Subject: [PATCH 41/55] use NONHLOS_PLATFORM_COMMON_PATH Mananr.LA.1.0 and Mannar.LA.1.1 will coexist from r1.0_00026 so we use NONHLOS_PLATFORM_COMMON_PATH to distinguish the dirs. Change-Id: I605b6467f611d7b76891e53b6728dc87b5a2187c Reviewed-on: https://gerrit.mot.com/1950741 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 38374a454b83..d96dcb82dcbb 100644 --- a/Android.mk +++ b/Android.mk @@ -168,7 +168,7 @@ else ifneq ($(filter lito, $(TARGET_BOARD_PLATFORM)),) else ifneq ($(filter bengal, $(TARGET_BOARD_PLATFORM)),) WLAN_ELF_FILE_PATH := vendor/qcom/nonhlos/WLAN.HL.3.2.4/wlan_proc/build/ms/WLAN_MERGED.elf else ifneq ($(filter holi, $(TARGET_BOARD_PLATFORM)),) - XML_PATH := vendor/qcom/nonhlos/Mannar.LA.1.0 + XML_PATH := vendor/qcom/nonhlos/$(NONHLOS_PLATFORM_COMMON_PATH) ELF_PATH := $(shell python3 $(LOCAL_PATH)/get_value_from_xml.py $(XML_PATH)/contents.xml) WLAN_ELF_FILE_PATH := $(XML_PATH)/$(ELF_PATH)wlan_proc/build/ms/*.elf endif From ee511154a8ac05948aebf8f428c09aa0103f559f Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Mon, 1 Feb 2021 13:37:00 +0530 Subject: [PATCH 42/55] qcacld-3.0: Add support to flush fragments for a particular peer Add support for flushing fragments for a particular peer. Change-Id: I2f66036ebb30bcd16c6a88d7d0729d084ebf75a1 CVE-Fixed: CVE-2020-24587 Mot-CRs-fixed: (CR) CRs-Fixed: 2860131 Reviewed-on: https://gerrit.mot.com/1929641 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/dp/txrx/ol_txrx.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index feafa1727c72..6e7409b38133 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -3701,6 +3701,36 @@ ol_txrx_peer_flush_frags(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, ol_txrx_peer_release_ref(peer, PEER_DEBUG_ID_OL_INTERNAL); } +/** + * ol_txrx_peer_flush_frags() - Flush fragments for a particular peer + * @soc_hdl - datapath soc handle + * @vdev_id - virtual device id + * @peer_mac - peer mac address + * + * Return: None + */ +static void +ol_txrx_peer_flush_frags(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, + uint8_t *peer_mac) +{ + struct ol_txrx_peer_t *peer; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + struct ol_txrx_pdev_t *pdev = + ol_txrx_get_pdev_from_pdev_id(soc, OL_TXRX_PDEV_ID); + + if (!pdev) + return; + + peer = ol_txrx_peer_find_hash_find_get_ref(pdev, peer_mac, 0, 1, + PEER_DEBUG_ID_OL_INTERNAL); + if (!peer) + return; + + ol_rx_reorder_peer_cleanup(peer->vdev, peer); + + ol_txrx_peer_release_ref(peer, PEER_DEBUG_ID_OL_INTERNAL); +} + /** * ol_txrx_dump_tx_desc() - dump tx desc total and free count * @txrx_pdev: Pointer to txrx pdev From e95eba2bdd37be911309662bf01a572c0fffe901 Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Mon, 1 Feb 2021 19:51:31 +0530 Subject: [PATCH 43/55] qcacld-3.0: Flush frags for peer on add key request Fragments are not flushed as part of rekey which could result in fragments encrypted under different keys to be reassembled. Fix is to flush fragments for the peer for which add key request is received. Change-Id: I5ab88fd1bc5936e2aa0910f859fa222873d4e295 CVE-Fixed: CVE-2020-24587 Mot-CRs-fixed: (CR) CRs-Fixed: 2875950 Reviewed-on: https://gerrit.mot.com/1929642 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_cfg80211.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index c0216bd2c447..27ea98b36398 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -18753,6 +18753,9 @@ static int __wlan_hdd_cfg80211_add_key(struct wiphy *wiphy, cdp_peer_flush_frags(cds_get_context(QDF_MODULE_ID_SOC), wlan_vdev_get_id(vdev), mac_address.bytes); + cdp_peer_flush_frags(cds_get_context(QDF_MODULE_ID_SOC), + wlan_vdev_get_id(vdev), mac_address.bytes); + switch (adapter->device_mode) { case QDF_SAP_MODE: case QDF_P2P_GO_MODE: From 5df7339711d7bc32d239d5da581c8bc47505c08d Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Tue, 2 Feb 2021 20:33:05 +0530 Subject: [PATCH 44/55] qcacld-3.0: Drop mcast and plaintext frags in protected network Multicast frames should not be fragmented and plaintext frags should not be reassembeld in protected network. Fix is to drop mcast frags and plaintext frags received in protected network. Change-Id: I6629c2351884b880525c10cf9259d506af89dd10 CVE-Fixed: CVE-2020-26145 Mot-CRs-fixed: (CR) CRs-Fixed: 2860245 Reviewed-on: https://gerrit.mot.com/1929644 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/dp/txrx/ol_rx_defrag.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/dp/txrx/ol_rx_defrag.c b/core/dp/txrx/ol_rx_defrag.c index fc5d50bb061b..5a225e1606e1 100644 --- a/core/dp/txrx/ol_rx_defrag.c +++ b/core/dp/txrx/ol_rx_defrag.c @@ -453,6 +453,28 @@ ol_rx_reorder_store_frag(ol_txrx_pdev_handle pdev, return; } + rx_desc = htt_rx_msdu_desc_retrieve(htt_pdev, frag); + qdf_assert(htt_rx_msdu_has_wlan_mcast_flag(htt_pdev, rx_desc)); + index = htt_rx_msdu_is_wlan_mcast(htt_pdev, rx_desc) ? + txrx_sec_mcast : txrx_sec_ucast; + + /* + * Multicast/Broadcast frames should not be fragmented so drop + * such frames. + */ + if (index != txrx_sec_ucast) { + ol_rx_frames_free(htt_pdev, frag); + return; + } + + if (peer->security[index].sec_type != htt_sec_type_none && + !htt_rx_mpdu_is_encrypted(htt_pdev, rx_desc)) { + ol_txrx_err("Unencrypted fragment received in security mode %d", + peer->security[index].sec_type); + ol_rx_frames_free(htt_pdev, frag); + return; + } + if ((!more_frag) && (!fragno) && (!rx_reorder_array_elem->head)) { rx_reorder_array_elem->head = frag; rx_reorder_array_elem->tail = frag; From 8d230089bd7c34953bc7078ccba98c61a0717317 Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Mon, 1 Feb 2021 22:14:14 +0530 Subject: [PATCH 45/55] qcacld-3.0: Modify check to ensure consecutive PN for frags Modify check to ensure packet number is consecutive for fragments and drop the fragments if the check fails. Change-Id: I40fcb66526db547975e26ab914ac81Montanaabc4d36 CVE-Fixed: CVE-2020-26146 Mot-CRs-fixed: (CR) CRs-Fixed: 2860242 Reviewed-on: https://gerrit.mot.com/1929643 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/dp/txrx/ol_rx_pn.c | 2 +- core/dp/txrx/ol_txrx.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/dp/txrx/ol_rx_pn.c b/core/dp/txrx/ol_rx_pn.c index 0d8d71584588..58d4cf6b4aa5 100644 --- a/core/dp/txrx/ol_rx_pn.c +++ b/core/dp/txrx/ol_rx_pn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013-2017, 2019-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2011, 2013-2017, 2019, 2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index 6e7409b38133..25e0e19ab59b 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -1449,6 +1449,15 @@ ol_txrx_pdev_post_attach(struct cdp_soc_t *soc_hdl, uint8_t pdev_id) */ qdf_mem_zero(&pdev->rx_pn[0], sizeof(pdev->rx_pn)); + /* WEP: 24-bit PN */ + pdev->rx_pn[htt_sec_type_wep40].len = + pdev->rx_pn[htt_sec_type_wep104].len = + pdev->rx_pn[htt_sec_type_wep128].len = 24; + + pdev->rx_pn[htt_sec_type_wep40].cmp = + pdev->rx_pn[htt_sec_type_wep104].cmp = + pdev->rx_pn[htt_sec_type_wep128].cmp = ol_rx_pn_cmp24; + /* TKIP: 48-bit TSC, CCMP: 48-bit PN */ pdev->rx_pn[htt_sec_type_tkip].len = pdev->rx_pn[htt_sec_type_tkip_nomic].len = From 502bd401181af9559081e7cc3ff2375dc624233f Mon Sep 17 00:00:00 2001 From: Liyun Zhang Date: Mon, 19 Jul 2021 01:58:20 -0500 Subject: [PATCH 46/55] : Revert "qcacld-3.0: Add support to flush fragments for a particular peer" This reverts commit bdbe877e66d021e8fd5ab2516658e45c0adf3db1. Fix already present as part of folowing commit. commit d7600941a3be0054b2bff573a4051ff457f96f7c Author: Yeshwanth Sriram Guntuka Date: Mon Feb 1 13:37:00 2021 +0530 qcacld-3.0: Add support to flush fragments for a particular peer Add support for flushing fragments for a particular peer. CRs-Fixed: 2860131 Change-Id: Ib7dc3889a2aa48793ac4d2c0b479f8b70ebdb7a6 Reviewed-on: https://gerrit.mot.com/2016597 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/dp/txrx/ol_txrx.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index 25e0e19ab59b..c3250538198a 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -3710,36 +3710,6 @@ ol_txrx_peer_flush_frags(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, ol_txrx_peer_release_ref(peer, PEER_DEBUG_ID_OL_INTERNAL); } -/** - * ol_txrx_peer_flush_frags() - Flush fragments for a particular peer - * @soc_hdl - datapath soc handle - * @vdev_id - virtual device id - * @peer_mac - peer mac address - * - * Return: None - */ -static void -ol_txrx_peer_flush_frags(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, - uint8_t *peer_mac) -{ - struct ol_txrx_peer_t *peer; - struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); - struct ol_txrx_pdev_t *pdev = - ol_txrx_get_pdev_from_pdev_id(soc, OL_TXRX_PDEV_ID); - - if (!pdev) - return; - - peer = ol_txrx_peer_find_hash_find_get_ref(pdev, peer_mac, 0, 1, - PEER_DEBUG_ID_OL_INTERNAL); - if (!peer) - return; - - ol_rx_reorder_peer_cleanup(peer->vdev, peer); - - ol_txrx_peer_release_ref(peer, PEER_DEBUG_ID_OL_INTERNAL); -} - /** * ol_txrx_dump_tx_desc() - dump tx desc total and free count * @txrx_pdev: Pointer to txrx pdev From d7e0109a6374fa58a526854866c66bf23b81555e Mon Sep 17 00:00:00 2001 From: hurui1 Date: Thu, 15 Jul 2021 10:09:03 +0800 Subject: [PATCH 47/55] Revert "qcacld-3.0: Change PCL for throughput case in case of STA+GO" In SCC/MCC test for non-DBS devices when STA is on 24G, and P2p is on 5G it will bring a high TP in p2p side But sometimes the cast devices showed blurred screen and the 24G TP is low in Sta mode so we decide to revert qcom's patch and use the scc mode when STA is on 24G MOT-CRs-fixed:(CR) This reverts commit a1e965e7899ba56f86183078ffa250560907e3e1. Change-Id: I0Montana38dbed809ad98972b04c50be5301e0a80c9f Reviewed-on: https://gerrit.mot.com/2013222 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yue Sun Reviewed-by: Prashanth Chakravarthy Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/2037720 Reviewed-by: Bin Liu --- .../policy_mgr/src/wlan_policy_mgr_tables_no_dbs_i.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_no_dbs_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_no_dbs_i.h index 50dacf8009e8..93d7e7dedd5f 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_no_dbs_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_no_dbs_i.h @@ -33,7 +33,7 @@ second_connection_pcl_nodbs_table[PM_MAX_ONE_CONNECTION_MODE] [PM_STA_MODE] = {PM_5G, PM_SCC_CH, PM_SCC_CH}, [PM_SAP_MODE] = {PM_SCC_CH_5G, PM_SCC_CH, PM_SCC_CH_5G}, [PM_P2P_CLIENT_MODE] = {PM_SCC_CH, PM_SCC_CH, PM_SCC_CH_5G}, - [PM_P2P_GO_MODE] = {PM_5G, PM_SCC_CH, PM_SCC_CH_5G}, + [PM_P2P_GO_MODE] = {PM_SCC_CH, PM_SCC_CH, PM_SCC_CH_5G}, [PM_NAN_DISC_MODE] = {PM_NONE, PM_NONE, PM_NONE}, [PM_NDI_MODE] = {PM_MAX_PCL_TYPE, PM_MAX_PCL_TYPE, PM_MAX_PCL_TYPE} }, @@ -41,7 +41,7 @@ second_connection_pcl_nodbs_table[PM_MAX_ONE_CONNECTION_MODE] [PM_STA_MODE] = {PM_5G, PM_SCC_CH, PM_SCC_CH}, [PM_SAP_MODE] = {PM_SCC_CH_5G, PM_SCC_CH, PM_SCC_CH_5G}, [PM_P2P_CLIENT_MODE] = {PM_SCC_CH, PM_SCC_CH, PM_SCC_CH_5G}, - [PM_P2P_GO_MODE] = {PM_5G, PM_SCC_CH, PM_SCC_CH_5G}, + [PM_P2P_GO_MODE] = {PM_SCC_CH, PM_SCC_CH, PM_SCC_CH_5G}, [PM_NAN_DISC_MODE] = {PM_NONE, PM_NONE, PM_NONE}, [PM_NDI_MODE] = {PM_MAX_PCL_TYPE, PM_MAX_PCL_TYPE, PM_MAX_PCL_TYPE} }, From 7d0323ae5320543e9151bc8e05c2526d4b9d741c Mon Sep 17 00:00:00 2001 From: sunyue5 Date: Wed, 3 Feb 2021 21:42:08 +0800 Subject: [PATCH 48/55] wlan: Support loading moto specific ini configurations In order to reuse hardware to save cost, our projects have gradually begun to use different software but the same set of hardware. Therefore, we have been unable to override some specific ini configurations in the driver according to the different hwid. Now we introduce a new file WCNSS_mot_cfg.ini which will be packaged into different software and be read by the driver to override some specific configurations Change-Id: I954497039b69af2b193b9fcd9bf278d9ed3b06a2 Signed-off-by: sunyue5 Reviewed-on: https://gerrit.mot.com/1870064 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Zhilu Yin Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/2065834 Reviewed-by: Qiu Du Reviewed-by: Bin Liu --- Android.mk | 5 +++++ core/hdd/inc/wlan_hdd_misc.h | 3 +++ core/hdd/src/wlan_hdd_main.c | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/Android.mk b/Android.mk index d96dcb82dcbb..4d4332860cd3 100644 --- a/Android.mk +++ b/Android.mk @@ -218,6 +218,11 @@ endif $(shell mkdir -p $(TARGET_FW_PATH); \ ln -sf $(TARGET_MAC_BIN_PATH)/wlan_mac.bin $(TARGET_FW_PATH)/wlan_mac.bin) + +# BEGIN IKSWR-45692, support loading moto specific configurations +$(shell ln -sf $(TARGET_CFG_PATH)/WCNSS_mot_cfg.ini $(TARGET_FW_PATH)/WCNSS_mot_cfg.ini) +# END IKSWR-45692 + ifneq ($(GENERIC_ODM_IMAGE),true) $(shell ln -sf $(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini) endif diff --git a/core/hdd/inc/wlan_hdd_misc.h b/core/hdd/inc/wlan_hdd_misc.h index b105df1b3a98..f018d2efc3e4 100644 --- a/core/hdd/inc/wlan_hdd_misc.h +++ b/core/hdd/inc/wlan_hdd_misc.h @@ -44,6 +44,9 @@ #ifdef MSM_PLATFORM #define WLAN_INI_FILE "wlan/qca_cld/" PREFIX "WCNSS_qcom_cfg.ini" #define WLAN_MAC_FILE "wlan/qca_cld/" PREFIX "wlan_mac.bin" +// BEGIN IKSWR-45692, support loading moto specific configurations +#define WLAN_MOT_INI_FILE "wlan/qca_cld/" PREFIX "WCNSS_mot_cfg.ini" +// END IKSWR-45692 #else #define WLAN_INI_FILE "wlan/" PREFIX "qcom_cfg.ini" #define WLAN_MAC_FILE "wlan/" PREFIX "wlan_mac.bin" diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 85ab73d32571..036390c6dae3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13032,6 +13032,14 @@ struct hdd_context *hdd_context_create(struct device *dev) goto err_release_store; } + // BEGIN IKSWR-45692, support loading moto specific configurations + status = cfg_psoc_parse(hdd_ctx->psoc, WLAN_MOT_INI_FILE); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to parse cfg %s, skip!", + WLAN_MOT_INI_FILE); + } + // END IKSWR-45692 + hdd_cfg_params_init(hdd_ctx); /* apply multiplier config, if not already set via module parameter */ From c292b7a66418deadf49fa9078bfabb73e7c63caf Mon Sep 17 00:00:00 2001 From: zhuzj5 Date: Wed, 13 Apr 2022 17:11:38 +0800 Subject: [PATCH 49/55] fix wifi reconnect issue fix DUT does not reconnect to wifi network while call is active Change-Id: Ib136b1bc771715be1ac464465e0170d2fbacbcc9 Reviewed-on: https://gerrit.mot.com/2241233 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/hdd/src/wlan_hdd_power.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index bdf3f1344a25..6fa6e273a968 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2621,10 +2621,7 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, if (hdd_adapter_is_connected_sta(adapter)) { hdd_debug("vdev mode %d enable dhcp protection", adapter->device_mode); - if ( hdd_ctx->bt_coex_mode_set ) { - allow_power_save ? hdd_stop_dhcp_ind(adapter) : - hdd_start_dhcp_ind(adapter); - } + allow_power_save ? hdd_stop_dhcp_ind(adapter) : hdd_start_dhcp_ind(adapter); } else { hdd_debug("vdev mod %d disconnected ignore dhcp protection", adapter->device_mode); From b813573e2217e0a924d3fe62b8af2d6aa308dca1 Mon Sep 17 00:00:00 2001 From: sunyue5 Date: Thu, 14 Apr 2022 13:39:18 +0800 Subject: [PATCH 50/55] Print the process which is receiving data Print the process name can easily help us to know which APP is waking up the system, so that we can make some power consumption improvment for this APP Change-Id: Ib45ac56a0ed4d090eea7b5bd8ba5ecefd2b9ce2f Signed-off-by: sunyue5 Reviewed-on: https://gerrit.mot.com/2243470 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xianglong Liao Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/wma/src/wma_features.c | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 03a51f01fbd4..e598ab8fafd6 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -72,6 +72,11 @@ #include #include "cdp_txrx_host_stats.h" +// IKSWS-90973 BEGIN +#include +#include +// IKSWS-90973 END + /** * WMA_SET_VDEV_IE_SOURCE_HOST - Flag to identify the source of VDEV SET IE * command. The value is 0x0 for the VDEV SET IE WMI commands from mobile @@ -2032,6 +2037,76 @@ wma_wow_get_pkt_proto_subtype(uint8_t *data, uint32_t len) } } +// IKSWS-90973 BEGIN, print the process that causing the wow wakeup +static int wow_check_task = 0; +module_param(wow_check_task, int, 0644); +MODULE_PARM_DESC(wow_check_task, "Check wow wakeup process"); + +static void check_task(uint16_t dport) +{ + struct task_struct *p = NULL; + struct file *file = NULL; + struct files_struct *files = NULL; + struct socket *sock = NULL; + struct sock *sk = NULL; + struct inet_sock *inet = NULL; + struct fdtable *fdt = NULL; + int i = 0, err = 0; + + for_each_process(p) + { + files = p->files; + if (files != NULL) { + spin_lock(&files->file_lock); + for (i = 0; i < NR_OPEN_DEFAULT; i++) + { + file = rcu_dereference(files->fd_array[i]); + if (file != NULL) { + sock = sock_from_file(file, &err); + if (sock) { + sk = sock->sk; + if (!sk) + continue; + if (sk->sk_family == AF_INET || sk->sk_family == AF_INET6) { + inet = inet_sk(sock->sk); + if(inet->inet_sport == dport) { + wma_info("task pid[%d], comm[%s], inet_sport[%u], inet_dport[%u]", + p->pid, p->comm, qdf_cpu_to_be16(inet->inet_sport), qdf_cpu_to_be16(inet->inet_dport)); + spin_unlock(&files->file_lock); + return; + } + } + } + } + } + fdt = files_fdtable(files); + for (i = 0; i < fdt->max_fds; i++) { + file = rcu_dereference_check_fdtable(files, fdt->fd[i]); + if (!file) + continue; + sock = sock_from_file(file, &err); + if (sock) { + sk = sock->sk; + if (!sk) + continue; + if (sk->sk_family == AF_INET || sk->sk_family == AF_INET6) { + inet = inet_sk(sock->sk); + if(inet->inet_sport == dport) { + wma_info("task pid[%d], comm[%s], inet_sport[%u], inet_dport[%u]", + p->pid, p->comm, qdf_cpu_to_be16(inet->inet_sport), qdf_cpu_to_be16(inet->inet_dport)); + spin_unlock(&files->file_lock); + return; + } + } + } + } + spin_unlock(&files->file_lock); + } + } + wma_info("No process have the dport[%u]", qdf_cpu_to_be16(dport)); +} +// IKSWS-90973 END + static void wma_log_pkt_eapol(uint8_t *data, uint32_t length) { uint16_t pkt_len, key_len; @@ -2106,6 +2181,10 @@ static void wma_log_pkt_ipv4(uint8_t *data, uint32_t length) qdf_cpu_to_be16(pkt_len), qdf_cpu_to_be16(src_port), qdf_cpu_to_be16(dst_port)); + // IKSWS-90973 BEGIN + if (wow_check_task) + check_task(dst_port); + // IKSWS-90973 END } static void wma_log_pkt_ipv6(uint8_t *data, uint32_t length) @@ -2137,6 +2216,10 @@ static void wma_log_pkt_ipv6(uint8_t *data, uint32_t length) qdf_cpu_to_be16(pkt_len), qdf_cpu_to_be16(src_port), qdf_cpu_to_be16(dst_port)); + // IKSWS-90973 BEGIN + if (wow_check_task) + check_task(dst_port); + // IKSWS-90973 END } static void wma_log_pkt_tcpv4(uint8_t *data, uint32_t length) From 322920acd78a60ff9050495e5713b2961c0e6d9d Mon Sep 17 00:00:00 2001 From: sunyue5 Date: Mon, 18 Apr 2022 17:44:03 +0800 Subject: [PATCH 51/55] remove invoking "sock_from_file" function As this symbol has still not been supported in the lastest GKI abi symbol manifest file, we have to implement this function by ourselves Change-Id: I87aeaeaadb8423dbcf25ec7004b82ff8bd94971b Signed-off-by: sunyue5 Reviewed-on: https://gerrit.mot.com/2245024 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Zhilu Yin Submit-Approved: Jira Key (cherry picked from commit ab37ce5f1b5bb7268a3651eaf4ab75517dc8530d) Reviewed-on: https://gerrit.mot.com/2246079 Reviewed-by: Bin Liu Reviewed-by: Yue Sun --- core/wma/src/wma_features.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index e598ab8fafd6..dcd409da821b 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -2047,11 +2047,12 @@ static void check_task(uint16_t dport) struct task_struct *p = NULL; struct file *file = NULL; struct files_struct *files = NULL; + struct inode *inode = NULL; struct socket *sock = NULL; struct sock *sk = NULL; struct inet_sock *inet = NULL; struct fdtable *fdt = NULL; - int i = 0, err = 0; + int i = 0; for_each_process(p) { @@ -2062,7 +2063,12 @@ static void check_task(uint16_t dport) { file = rcu_dereference(files->fd_array[i]); if (file != NULL) { - sock = sock_from_file(file, &err); + inode = file_inode(file); + if (inode && S_ISSOCK(inode->i_mode)) { + sock = file->private_data; + } else { + sock = NULL; + } if (sock) { sk = sock->sk; if (!sk) @@ -2084,7 +2090,12 @@ static void check_task(uint16_t dport) file = rcu_dereference_check_fdtable(files, fdt->fd[i]); if (!file) continue; - sock = sock_from_file(file, &err); + inode = file_inode(file); + if (inode && S_ISSOCK(inode->i_mode)) { + sock = file->private_data; + } else { + sock = NULL; + } if (sock) { sk = sock->sk; if (!sk) From f4d4ad9376044f0bc8059f508d38abda189efcf0 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Tue, 6 Dec 2022 16:31:04 +0800 Subject: [PATCH 52/55] qcacld-3.0: Fix OOB issue when access wma_find_vdev_by_addr The function 'wma_find_vdev_by_addr' returns pointer to cdp_vdev, so should avoid to comapre with QDF_STATUS_SUCCESS. Change-Id: I45716651c89a53341d09737d83556bc515858361 CRs-Fixed: 3346764 Mot-CRs-fixed: (CR) CVE- fixed: CVE-2023-21669 QC-CR#3346764 Signed-off-by: Sipra Patel Change-Id: I45716651c89a53341d09737d83556bc515858361 Reviewed-on: https://gerrit.mot.com/2594404 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Zhengjie Zhu Reviewed-by: Bin Liu Submit-Approved: Jira Key --- core/wma/src/wma_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index e6136508c682..9fcafc205c6d 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -3456,7 +3456,7 @@ int wma_form_rx_packet(qdf_nbuf_t buf, if (status) return status; } else if (wma_find_vdev_id_by_addr(wma_handle, wh->i_addr1, - &vdev_id) == QDF_STATUS_SUCCESS) { + &vdev_id)) { status = wma_check_and_process_rmf_frame(wma_handle, vdev_id, &wh, From faf0133215e0a1513df950ac2d878d1f8db47c48 Mon Sep 17 00:00:00 2001 From: Yue Sun Date: Tue, 27 Jun 2023 20:14:00 -0500 Subject: [PATCH 53/55] Revert "qcacld-3.0: Fix OOB issue when access wma_find_vdev_by_addr" This reverts commit 8654c2c54d6a4668deaa89f754b6ae92716b10d3. Change-Id: I7cd38fb66ed16a93247d5a2d4f983dbc84ff6d0f Reviewed-on: https://gerrit.mot.com/2658097 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Zhilu Yin Submit-Approved: Jira Key --- core/wma/src/wma_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 9fcafc205c6d..e6136508c682 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -3456,7 +3456,7 @@ int wma_form_rx_packet(qdf_nbuf_t buf, if (status) return status; } else if (wma_find_vdev_id_by_addr(wma_handle, wh->i_addr1, - &vdev_id)) { + &vdev_id) == QDF_STATUS_SUCCESS) { status = wma_check_and_process_rmf_frame(wma_handle, vdev_id, &wh, From b2d48354301d62bafd6740aa15efaf2f9f036cc5 Mon Sep 17 00:00:00 2001 From: Aravind Kishore Sukla Date: Wed, 8 Feb 2023 14:45:03 +0530 Subject: [PATCH 54/55] qcacld-3.0: Ignore CSA request for invalid channel In present scenario, STA disconnects with AP if it receives invalid channel in CSA IE. In this case STA shouldn't disconnect with AP as this request may come from a spoof AP. Ignore this CSA request as it might be from spoof AP and if it is from genuine AP heart beat failure happens and results in disconnection. After disconnection DUT may reconnect to same or other APs. Mot-CRs-fixed: (CR) CVE-Fixed: CVE-2023-28584 Bug: 285903061 Change-Id: Ic46ac6d6fa633bd6dbcb188ce616265f297bdf44 CRs-Fixed: 3390251 Signed-off-by: Ashutosh Verma Change-Id: Ic46ac6d6fa633bd6dbcb188ce616265f297bdf44 Reviewed-on: https://gerrit.mot.com/2704837 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- core/mac/src/pe/lim/lim_utils.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 6124376906d6..4bacc753e895 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -1873,20 +1873,16 @@ static void __lim_process_channel_switch_timeout(struct pe_session *pe_session) } /* - * If the channel-list that AP is asking us to switch is invalid - * then we cannot switch the channel. Just disassociate from AP. - * We will find a better AP !!! + * The channel switch request received from AP is carrying + * invalid channel. It's ok to ignore this channel switch + * request as it might be from spoof AP. If it's from genuine + * AP, it may lead to heart beat failure and result in + * disconnection. DUT can go ahead and reconnect to it/any + * other AP once it disconnects. */ - if ((pe_session->limMlmState == - eLIM_MLM_LINK_ESTABLISHED_STATE) && - (pe_session->limSmeState != eLIM_SME_WT_DISASSOC_STATE) && - (pe_session->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) { - pe_err("Invalid channel! Disconnect"); - lim_tear_down_link_with_ap(mac, pe_session->peSessionId, - REASON_UNSUPPORTED_CHANNEL_CSA, - eLIM_LINK_MONITORING_DISASSOC); - return; - } + pe_err("Invalid channel freq %u Ignore CSA request", + channel_freq); + return; } switch (pe_session->gLimChannelSwitch.state) { case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY: From 4249d3fa5ffcc57ff8cd2049c1cfef116e491a17 Mon Sep 17 00:00:00 2001 From: Surya Prakash Sivaraj Date: Fri, 29 Mar 2024 10:33:08 +0530 Subject: [PATCH 55/55] qcacld-3.0: Remove use-after-free of frame in tx mgmt send The tx completion handler for the frame frees the buffer. Therefore, usage of frame after tx completion causes undesired effect. Remove the dereference of tx frame buffer contents in lim_tx_mgmt_frame() after the tx completion. Mot-CRs-fixed: (CR) CVE- fixed: CVE-2024-33069 Change-Id: I32211e1bce4f96ba920a2212ef65aa39831666ab CRs-Fixed: 3772014 (cherry picked from commit 2b66fcb567197854c43d8323de564b2949dfb8f5) Signed-off-by: Dharshan R Reviewed-on: https://gerrit.mot.com/3073982 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Varun Shrivastava Reviewed-by: Daniel Finimundi Submit-Approved: Jira Key --- core/mac/src/pe/lim/lim_send_management_frames.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index d9d92767aed6..7f4c95a759c8 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -5744,8 +5744,7 @@ static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, uint8_t vdev_id, MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, session->peSessionId, qdf_status)); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - pe_err("*** Could not send Auth frame (subType: %d), retCode=%X ***", - fc->subType, qdf_status); + pe_err("Could not send Auth frame, retCode=%X", qdf_status); mac_ctx->auth_ack_status = LIM_TX_FAILED; auth_ack_status = SENT_FAIL; lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT,