From 49d08a742f484c6df6740e00e03da06d43c4edf2 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Wed, 14 Feb 2018 17:36:12 +0530 Subject: [PATCH] qcacld-3.0: Move Channel convert and frame indication logic to lim_utils.c Move Channel convert and frame indication logic from lim_p2p.c to lim_utils.c and remove unused timer pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer. Change-Id: I71de90d5fb88462e52148a434d43ea80c41cfe36 CRs-Fixed: 2191282 --- Kbuild | 1 - core/mac/inc/ani_global.h | 2 - core/mac/src/include/sir_params.h | 1 - core/mac/src/pe/lim/lim_p2p.c | 169 ------------ .../src/pe/lim/lim_process_message_queue.c | 45 +-- .../src/pe/lim/lim_process_mlm_req_messages.c | 3 - .../src/pe/lim/lim_process_sme_req_messages.c | 45 --- core/mac/src/pe/lim/lim_timer_utils.c | 41 --- core/mac/src/pe/lim/lim_timer_utils.h | 1 - core/mac/src/pe/lim/lim_trace.c | 1 - core/mac/src/pe/lim/lim_types.h | 7 - core/mac/src/pe/lim/lim_utils.c | 92 ++++++- core/mac/src/pe/lim/lim_utils.h | 33 +++ .../src/sys/legacy/src/utils/src/mac_trace.c | 2 - core/sme/src/p2p/p2p_api.c | 259 ------------------ core/wma/inc/wma_types.h | 1 - 16 files changed, 120 insertions(+), 583 deletions(-) delete mode 100644 core/mac/src/pe/lim/lim_p2p.c delete mode 100644 core/sme/src/p2p/p2p_api.c diff --git a/Kbuild b/Kbuild index a63a48f581ee..4468454d7841 100644 --- a/Kbuild +++ b/Kbuild @@ -603,7 +603,6 @@ MAC_LIM_OBJS := $(MAC_SRC_DIR)/pe/lim/lim_aid_mgmt.o \ $(MAC_SRC_DIR)/pe/lim/lim_ft.o \ $(MAC_SRC_DIR)/pe/lim/lim_ibss_peer_mgmt.o \ $(MAC_SRC_DIR)/pe/lim/lim_link_monitoring_algo.o \ - $(MAC_SRC_DIR)/pe/lim/lim_p2p.o \ $(MAC_SRC_DIR)/pe/lim/lim_process_action_frame.o \ $(MAC_SRC_DIR)/pe/lim/lim_process_assoc_req_frame.o \ $(MAC_SRC_DIR)/pe/lim/lim_process_assoc_rsp_frame.o \ diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index 6bbba5a23716..54a8ef5edce8 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -318,8 +318,6 @@ typedef struct sLimTimers { TX_TIMER gLimPeriodicJoinProbeReqTimer; TX_TIMER gLimDisassocAckTimer; TX_TIMER gLimDeauthAckTimer; - /* This timer is started when single shot NOA insert msg is sent to FW for scan in P2P GO mode */ - TX_TIMER gLimP2pSingleShotNoaInsertTimer; /* This timer is used to convert active channel to * passive channel when there is no beacon * for a period of time on a particular DFS channel diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 1c2667a6aeb8..0de76bc8025a 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -762,7 +762,6 @@ struct sir_mgmt_msg { #define SIR_LIM_WPS_OVERLAP_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x1D) #define SIR_LIM_FT_PREAUTH_RSP_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x1E) -#define SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x20) #define SIR_LIM_BEACON_GEN_IND (SIR_LIM_TIMEOUT_MSG_START + 0x23) #define SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x24) diff --git a/core/mac/src/pe/lim/lim_p2p.c b/core/mac/src/pe/lim/lim_p2p.c deleted file mode 100644 index 611307624eaf..000000000000 --- a/core/mac/src/pe/lim/lim_p2p.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2012-2014,2016-2018 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. - */ - -/*=========================================================================== - L I M _ P 2 P . C - - OVERVIEW: - - This software unit holds the implementation of the WLAN Protocol Engine for - P2P. - ===========================================================================*/ - -/*=========================================================================== - - EDIT HISTORY FOR FILE - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - - $Header$$DateTime$$Author$ - - when who what, where, why - ---------- --- -------------------------------------------------------- - 2011-05-02 djindal Corrected file indentation and changed remain on channel - handling for concurrency. - ===========================================================================*/ - -#include "lim_utils.h" -#include "lim_session_utils.h" -#include "wma_types.h" -#include "lim_types.h" -#include "wlan_utility.h" - -/* A DFS channel can be ACTIVE for max 9000 msec, from the last - received Beacon/Prpbe Resp. */ -#define MAX_TIME_TO_BE_ACTIVE_CHANNEL 9000 - -/*------------------------------------------------------------------ - * - * lim Insert NOA timer timeout callback - when timer fires, deactivate it and send - * scan rsp to csr/hdd - * - *------------------------------------------------------------------*/ -void lim_process_insert_single_shot_noa_timeout(tpAniSirGlobal pMac) -{ - /* timeout means start NOA did not arrive; we need to deactivate and change the timer for - * future activations - */ - lim_deactivate_and_change_timer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER); - - /* Even if insert NOA timedout, go ahead and process/send stored SME request */ - lim_process_regd_defd_sme_req_after_noa_start(pMac); - - return; -} - -/*----------------------------------------------------------------- - * lim Insert Timer callback function to check active DFS channels - * and convert them to passive channels if there was no - * beacon/proberesp for MAX_TIME_TO_BE_ACTIVE_CHANNEL time - *------------------------------------------------------------------*/ -void lim_convert_active_channel_to_passive_channel(tpAniSirGlobal pMac) -{ - uint64_t currentTime; - uint64_t lastTime = 0; - uint64_t timeDiff; - uint8_t i; - - currentTime = (uint64_t)qdf_mc_timer_get_system_time(); - for (i = 1; i < SIR_MAX_24G_5G_CHANNEL_RANGE; i++) { - if ((pMac->lim.dfschannelList.timeStamp[i]) != 0) { - lastTime = pMac->lim.dfschannelList.timeStamp[i]; - if (currentTime >= lastTime) { - timeDiff = (currentTime - lastTime); - } else { - timeDiff = - (0xFFFFFFFF - lastTime) + currentTime; - } - - if (timeDiff >= MAX_TIME_TO_BE_ACTIVE_CHANNEL) { - lim_covert_channel_scan_type(pMac, i, false); - pMac->lim.dfschannelList.timeStamp[i] = 0; - } - } - } - /* lastTime is zero if there is no DFS active channels in the list. - * If this is non zero then we have active DFS channels so restart the timer. - */ - if (lastTime != 0) { - if (tx_timer_activate - (&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer) - != TX_SUCCESS) { - pe_err("Could not activate Active to Passive Channel timer"); - } - } - - return; - -} - -/*------------------------------------------------------------------ - * - * Indicate the Mgmt Frame received to SME to HDD callback - * handle Probe_req/Action frame currently - * - *------------------------------------------------------------------*/ -void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal pMac, uint8_t frameType, - uint8_t *frame, uint32_t frameLen, - uint16_t sessionId, uint32_t rxChannel, - tpPESession psessionEntry, int8_t rxRssi) -{ - tpSirSmeMgmtFrameInd pSirSmeMgmtFrame = NULL; - uint16_t length; - - length = sizeof(tSirSmeMgmtFrameInd) + frameLen; - - pSirSmeMgmtFrame = qdf_mem_malloc(length); - if (NULL == pSirSmeMgmtFrame) { - pe_err("AllocateMemory failed for eWNI_SME_LISTEN_RSP"); - return; - } - - if (qdf_is_macaddr_broadcast( - (struct qdf_mac_addr *) pSirSmeMgmtFrame->frameBuf + 4) && - !sessionId) { - pe_debug("Broadcast action frame"); - sessionId = SME_SESSION_ID_BROADCAST; - } - - pSirSmeMgmtFrame->frame_len = frameLen; - pSirSmeMgmtFrame->sessionId = sessionId; - pSirSmeMgmtFrame->frameType = frameType; - pSirSmeMgmtFrame->rxRssi = rxRssi; - pSirSmeMgmtFrame->rxChan = rxChannel; - - qdf_mem_zero(pSirSmeMgmtFrame->frameBuf, frameLen); - qdf_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen); - - if (pMac->mgmt_frame_ind_cb) - pMac->mgmt_frame_ind_cb(pSirSmeMgmtFrame); - else - pe_warn("Management indication callback not registered!!"); - qdf_mem_free(pSirSmeMgmtFrame); - return; -} diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 091e425bd879..8543dd6bd365 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -486,8 +486,7 @@ uint8_t static def_msg_decision(tpAniSirGlobal pMac, struct scheduler_msg *limMs && (limMsg->type != WMA_SET_MIMOPS_RSP) && (limMsg->type != WMA_SWITCH_CHANNEL_RSP) && (limMsg->type != WMA_P2P_NOA_ATTR_IND) - && (limMsg->type != WMA_P2P_NOA_START_IND) && - (limMsg->type != WMA_ADD_TS_RSP) && + && (limMsg->type != WMA_ADD_TS_RSP) && /* * LIM won't process any defer queue commands if gLimAddtsSent is * set to TRUE. gLimAddtsSent will be set TRUE to while sending @@ -1286,7 +1285,6 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, tUpdateBeaconParams beacon_params; #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ uint8_t i; - uint8_t p2p_go_exists = 0; tpPESession session_entry = NULL; uint8_t defer_msg = false; tLinkStateParams *link_state_param; @@ -1496,46 +1494,6 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, qdf_mem_free(msg->bodyptr); msg->bodyptr = NULL; break; - case SIR_HAL_P2P_NOA_START_IND: - session_entry = &mac_ctx->lim.gpSession[0]; - pe_debug("LIM received NOA start %x", msg->type); - - /* Since insert NOA is done and NOA start msg received, - * we should deactivate the Insert NOA timer - */ - lim_deactivate_and_change_timer(mac_ctx, - eLIM_INSERT_SINGLESHOT_NOA_TIMER); - - for (i = 0; i < mac_ctx->lim.maxBssId; i++) { - session_entry = &mac_ctx->lim.gpSession[i]; - if ((session_entry != NULL) && (session_entry->valid) && - (session_entry->pePersona == QDF_P2P_GO_MODE)) { - /* Save P2P NOA start attribute for Go persona*/ - p2p_go_exists = 1; - qdf_mem_copy(&session_entry->p2pGoPsNoaStartInd, - msg->bodyptr, sizeof(tSirP2PNoaStart)); - qdf_status = - session_entry->p2pGoPsNoaStartInd.status; - if (qdf_status != QDF_STATUS_SUCCESS) - QDF_TRACE(QDF_MODULE_ID_PE, LOGW, - FL( - "GO NOA start status %d by FW"), - qdf_status); - break; - } - } - - if (p2p_go_exists == 0) - QDF_TRACE(QDF_MODULE_ID_PE, LOGW, - FL( - "GO is removed by the time NOA start recvd")); - - /* We received the NOA start indication. Now we can send down - * the SME request which requires off-channel operation */ - lim_process_regd_defd_sme_req_after_noa_start(mac_ctx); - qdf_mem_free(msg->bodyptr); - msg->bodyptr = NULL; - break; #ifdef FEATURE_WLAN_TDLS case SIR_HAL_TDLS_IND: tdls_ind = (tpSirTdlsInd) msg->bodyptr; @@ -1631,7 +1589,6 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, case SIR_LIM_ASSOC_FAIL_TIMEOUT: case SIR_LIM_REASSOC_FAIL_TIMEOUT: case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT: - case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT: case SIR_LIM_DISASSOC_ACK_TIMEOUT: case SIR_LIM_DEAUTH_ACK_TIMEOUT: case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE: diff --git a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c index a8c26063ae13..4f25c72cb32d 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c @@ -168,9 +168,6 @@ void lim_process_mlm_req_messages(tpAniSirGlobal mac_ctx, case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT: lim_process_ft_preauth_rsp_timeout(mac_ctx); break; - case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT: - lim_process_insert_single_shot_noa_timeout(mac_ctx); - break; case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE: lim_convert_active_channel_to_passive_channel(mac_ctx); break; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 3c5fb192b2b3..e37996e3490a 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -4103,51 +4103,6 @@ skip_match: return; } -static void __lim_deregister_deferred_sme_req_after_noa_start(tpAniSirGlobal pMac) -{ - pe_debug("Dereg msgType %d", pMac->lim.gDeferMsgTypeForNOA); - pMac->lim.gDeferMsgTypeForNOA = 0; - if (pMac->lim.gpDefdSmeMsgForNOA != NULL) { - /* __lim_process_sme_scan_req consumed the buffer. We can free it. */ - qdf_mem_free(pMac->lim.gpDefdSmeMsgForNOA); - pMac->lim.gpDefdSmeMsgForNOA = NULL; - } -} - -/** - * lim_process_regd_defd_sme_req_after_noa_start() - * - * mac_ctx: Pointer to Global MAC structure - * - * This function is called to process deferred sme req message - * after noa start. - * - * Return: None - */ -void lim_process_regd_defd_sme_req_after_noa_start(tpAniSirGlobal mac_ctx) -{ - pe_debug("Process defd sme req %d", - mac_ctx->lim.gDeferMsgTypeForNOA); - - if ((mac_ctx->lim.gDeferMsgTypeForNOA == 0) || - (mac_ctx->lim.gpDefdSmeMsgForNOA == NULL)) { - pe_warn("start rcvd from FW when no sme deferred msg pending. Do nothing"); - pe_warn("It may happen when NOA start ind and timeout happen at the same time"); - return; - } - switch (mac_ctx->lim.gDeferMsgTypeForNOA) { - case eWNI_SME_JOIN_REQ: - __lim_process_sme_join_req(mac_ctx, - mac_ctx->lim.gpDefdSmeMsgForNOA); - break; - default: - pe_err("Unknown deferred msg type %d", - mac_ctx->lim.gDeferMsgTypeForNOA); - break; - } - __lim_deregister_deferred_sme_req_after_noa_start(mac_ctx); -} - static void __lim_process_sme_reset_ap_caps_change(tpAniSirGlobal pMac, uint32_t *pMsgBuf) { diff --git a/core/mac/src/pe/lim/lim_timer_utils.c b/core/mac/src/pe/lim/lim_timer_utils.c index 3226d920c192..2fc4f3fa4b9e 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.c +++ b/core/mac/src/pe/lim/lim_timer_utils.c @@ -340,21 +340,6 @@ uint32_t lim_create_timers(tpAniSirGlobal pMac) goto err_timer; } - /* (> no of BI* no of TUs per BI * 1TU in msec + - * p2p start time offset*1 TU in msec = 2*100*1.024 + 5*1.024 - * = 204.8 + 5.12 = 209.20) - */ - cfgValue = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE; - cfgValue = SYS_MS_TO_TICKS(cfgValue); - if (tx_timer_create(pMac, - &pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer, - "Single Shot NOA Insert timeout", lim_timer_handler, - SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT, cfgValue, 0, - TX_NO_ACTIVATE) != TX_SUCCESS) { - pe_err("Can't create Single Shot NOA Insert Timeout tmr"); - goto err_timer; - } - cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT; cfgValue = SYS_MS_TO_TICKS(cfgValue); if (tx_timer_create(pMac, @@ -386,7 +371,6 @@ err_timer: tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer); tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer); tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer); - tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer); tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer); tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer); @@ -880,31 +864,6 @@ void lim_deactivate_and_change_timer(tpAniSirGlobal pMac, uint32_t timerId) } break; - case eLIM_INSERT_SINGLESHOT_NOA_TIMER: - if (tx_timer_deactivate - (&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != - TX_SUCCESS) { - /** - ** Could not deactivate SingleShot NOA Insert - ** timer. Log error. - **/ - pe_err("Unable to deactivate SingleShot NOA Insert timer"); - return; - } - val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE; - val = SYS_MS_TO_TICKS(val); - if (tx_timer_change - (&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer, val, - 0) != TX_SUCCESS) { - /** - * Could not change Single Shot NOA Insert - * timer. Log error. - */ - pe_err("Unable to change timer"); - return; - } - break; - case eLIM_AUTH_SAE_TIMER: if (tx_timer_deactivate (&pMac->lim.limTimers.sae_auth_timer) diff --git a/core/mac/src/pe/lim/lim_timer_utils.h b/core/mac/src/pe/lim/lim_timer_utils.h index 9beb54efbc52..436be19f07af 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.h +++ b/core/mac/src/pe/lim/lim_timer_utils.h @@ -72,7 +72,6 @@ enum { }; #define LIM_DISASSOC_DEAUTH_ACK_TIMEOUT 500 -#define LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE 500 /* Timer Handler functions */ uint32_t lim_create_timers(tpAniSirGlobal); diff --git a/core/mac/src/pe/lim/lim_trace.c b/core/mac/src/pe/lim/lim_trace.c index 0cad3932e7ae..f80f7648ed7c 100644 --- a/core/mac/src/pe/lim/lim_trace.c +++ b/core/mac/src/pe/lim/lim_trace.c @@ -76,7 +76,6 @@ static uint8_t *__lim_trace_get_timer_string(uint16_t timerId) CASE_RETURN_STRING(eLIM_DISASSOC_ACK_TIMER); CASE_RETURN_STRING(eLIM_DEAUTH_ACK_TIMER); CASE_RETURN_STRING(eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); - CASE_RETURN_STRING(eLIM_INSERT_SINGLESHOT_NOA_TIMER); CASE_RETURN_STRING(eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE); CASE_RETURN_STRING(eLIM_AUTH_RETRY_TIMER); default: diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 72fa06644fe3..679425b70135 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -940,15 +940,8 @@ lim_change_channel_with_callback(tpAniSirGlobal pMac, uint8_t newChannel, CHANGE_CHANNEL_CALLBACK callback, uint32_t *cbdata, tpPESession psessionEntry); -void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal pMac, uint8_t frameType, - uint8_t *frame, uint32_t frameLen, - uint16_t sessionId, uint32_t rxChan, - tpPESession psessionEntry, int8_t rxRssi); void lim_process_remain_on_chn_timeout(tpAniSirGlobal pMac); -void lim_process_insert_single_shot_noa_timeout(tpAniSirGlobal pMac); -void lim_convert_active_channel_to_passive_channel(tpAniSirGlobal pMac); void lim_send_p2p_action_frame(tpAniSirGlobal pMac, struct scheduler_msg *pMsg); -void lim_process_regd_defd_sme_req_after_noa_start(tpAniSirGlobal pMac); void lim_process_disassoc_ack_timeout(tpAniSirGlobal pMac); void lim_process_deauth_ack_timeout(tpAniSirGlobal pMac); diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index f475a33cd7e8..8ac980f831c4 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -48,6 +48,7 @@ #include "dot11fdefs.h" #include "wmm_apsd.h" #include "lim_trace.h" + #ifdef FEATURE_WLAN_DIAG_SUPPORT #include "host_diag_core_event.h" #endif /* FEATURE_WLAN_DIAG_SUPPORT */ @@ -70,6 +71,11 @@ #endif #define ASCII_SPACE_CHARACTER 0x20 +/* A DFS channel can be ACTIVE for max 9000 msec, from the last + received Beacon/Prpbe Resp. */ +#define MAX_TIME_TO_BE_ACTIVE_CHANNEL 9000 + + /** ------------------------------------------------------------- \fn lim_delete_dialogue_token_list \brief deletes the complete lim dialogue token linked list. @@ -608,9 +614,6 @@ void lim_deactivate_timers(tpAniSirGlobal mac_ctx) tx_timer_deactivate(&lim_timer->gLimDeauthAckTimer); - tx_timer_deactivate(&lim_timer-> - gLimP2pSingleShotNoaInsertTimer); - tx_timer_deactivate(&lim_timer-> gLimActiveToPassiveChannelTimer); @@ -689,9 +692,6 @@ void lim_cleanup_mlm(tpAniSirGlobal mac_ctx) tx_timer_delete(&lim_timer->gLimDeauthAckTimer); - tx_timer_delete(&lim_timer-> - gLimP2pSingleShotNoaInsertTimer); - tx_timer_delete(&lim_timer-> gLimActiveToPassiveChannelTimer); @@ -8175,3 +8175,83 @@ enum rateid lim_get_min_session_txrate(tpPESession session) return rid; } + +void lim_convert_active_channel_to_passive_channel(tpAniSirGlobal mac_ctx) +{ + uint64_t current_time; + uint64_t last_time = 0; + uint64_t time_diff; + uint8_t i; + + current_time = (uint64_t)qdf_mc_timer_get_system_time(); + for (i = 1; i < SIR_MAX_24G_5G_CHANNEL_RANGE; i++) { + if ((mac_ctx->lim.dfschannelList.timeStamp[i]) != 0) { + last_time = mac_ctx->lim.dfschannelList.timeStamp[i]; + if (current_time >= last_time) { + time_diff = (current_time - last_time); + } else { + time_diff = + (0xFFFFFFFF - last_time) + current_time; + } + + if (time_diff >= MAX_TIME_TO_BE_ACTIVE_CHANNEL) { + lim_covert_channel_scan_type(mac_ctx, i, false); + mac_ctx->lim.dfschannelList.timeStamp[i] = 0; + } + } + } + /* + * last_time is zero if there is no DFS active channels in the list. + * If this is non zero then we have active DFS channels so restart + * the timer. + */ + if (last_time != 0) { + if (tx_timer_activate + (&mac_ctx->lim.limTimers.gLimActiveToPassiveChannelTimer) + != TX_SUCCESS) { + pe_err("Active to Passive Channel timer not activated"); + } + } + return; +} + +void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal mac_ctx, uint8_t frame_type, + uint8_t *frame, uint32_t frame_len, + uint16_t session_id, uint32_t rx_channel, + tpPESession psession_entry, int8_t rx_rssi) +{ + tpSirSmeMgmtFrameInd sme_mgmt_frame = NULL; + uint16_t length; + + length = sizeof(tSirSmeMgmtFrameInd) + frame_len; + + sme_mgmt_frame = qdf_mem_malloc(length); + if (!sme_mgmt_frame) { + pe_err("AllocateMemory failed for eWNI_SME_LISTEN_RSP"); + return; + } + + if (qdf_is_macaddr_broadcast( + (struct qdf_mac_addr *) sme_mgmt_frame->frameBuf + 4) && + !session_id) { + pe_debug("Broadcast action frame"); + session_id = SME_SESSION_ID_BROADCAST; + } + + sme_mgmt_frame->frame_len = frame_len; + sme_mgmt_frame->sessionId = session_id; + sme_mgmt_frame->frameType = frame_type; + sme_mgmt_frame->rxRssi = rx_rssi; + sme_mgmt_frame->rxChan = rx_channel; + + qdf_mem_zero(sme_mgmt_frame->frameBuf, frame_len); + qdf_mem_copy(sme_mgmt_frame->frameBuf, frame, frame_len); + + if (mac_ctx->mgmt_frame_ind_cb) + mac_ctx->mgmt_frame_ind_cb(sme_mgmt_frame); + else + pe_debug_rl("Management indication callback not registered!!"); + qdf_mem_free(sme_mgmt_frame); + return; +} + diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 9e2102235e11..d391bee22fd5 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -168,6 +168,39 @@ void lim_update_short_preamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, void lim_update_short_slot_time(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry); + +/* + * lim_send_sme_mgmt_frame_ind() - Function to send mgmt frame ind to HDD + * @mac_ctx : Pointer to Global MAC structure + * @frame_type : Type of mgmt frame + * @frame : Frame pointer + * @frame_len : Length og mgmt frame + * @session_id : session id + * @psession_entry : PE Session Entry + * @rx_channel : Channel of where packet is received + * @rx_rssi : rssi value + * + * Indicate the Mgmt Frame received to SME to HDD callback + * handle Probe_req/Action frame currently + * + * Return: None +*/ +void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal mac_ctx, uint8_t frame_type, + uint8_t *frame, uint32_t frame_len, + uint16_t session_id, uint32_t rx_channel, + tpPESession psession_entry, int8_t rx_rssi); + +/* + * lim_convert_active_channel_to_passive_channel() - Timer callback function + * @mac_ctx : Pointer to Global MAC structure + * + * It check active DFS channels and convert them to passive channels + * if there was no beacon/proberesp for MAX_TIME_TO_BE_ACTIVE_CHANNEL time + * + * Return: None +*/ +void lim_convert_active_channel_to_passive_channel(tpAniSirGlobal mac_ctx); + /* * lim_deactivate_timers() - Function to deactivate lim timers * @mac_ctx: Pointer to global mac structure diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index 4915bf7749fa..cfba1d386513 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -437,7 +437,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg) CASE_RETURN_STRING(WMA_SWITCH_CHANNEL_RSP); CASE_RETURN_STRING(WMA_P2P_NOA_ATTR_IND); - CASE_RETURN_STRING(WMA_P2P_NOA_START_IND); CASE_RETURN_STRING(WMA_PWR_SAVE_CFG); CASE_RETURN_STRING(WMA_REGISTER_PE_CALLBACK); @@ -713,7 +712,6 @@ uint8_t *mac_trace_get_lim_msg_string(uint16_t lim_msg) CASE_RETURN_STRING(SIR_LIM_QUIET_BSS_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_WPS_OVERLAP_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_FT_PREAUTH_RSP_TIMEOUT); - CASE_RETURN_STRING(SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE); CASE_RETURN_STRING(SIR_LIM_BEACON_GEN_IND); CASE_RETURN_STRING(SIR_LIM_DISASSOC_ACK_TIMEOUT); diff --git a/core/sme/src/p2p/p2p_api.c b/core/sme/src/p2p/p2p_api.c deleted file mode 100644 index 59d32bbc1113..000000000000 --- a/core/sme/src/p2p/p2p_api.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2012-2018 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. - */ - -#include "sme_api.h" -#include -#include -#include "csr_inside_api.h" -#include "sme_inside.h" -#include "p2p_api.h" -#include "cfg_api.h" -#include "wma.h" - -/* handle SME remain on channel request. */ - -QDF_STATUS p2p_process_remain_on_channel_cmd(tpAniSirGlobal pMac, - tSmeCmd *p2pRemainonChn) -{ - QDF_STATUS status = QDF_STATUS_E_FAILURE; - tSirRemainOnChnReq *pMsg; - uint32_t len; - struct csr_roam_session *pSession = - CSR_GET_SESSION(pMac, p2pRemainonChn->sessionId); - - if (!pSession) { - sme_err("session %d not found", p2pRemainonChn->sessionId); - return status; - } - - if (!pSession->sessionActive) { - sme_err("session %d is invalid or listen is disabled", - p2pRemainonChn->sessionId); - return status; - } - len = sizeof(tSirRemainOnChnReq) + pMac->p2pContext.probeRspIeLength; - - if (len > 0xFFFF) { - /*In coming len for Msg is more then 16bit value */ - sme_err("Message length is very large, %d", len); - return status; - } - - pMsg = qdf_mem_malloc(len); - if (NULL == pMsg) - return status; - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "%s call", - __func__); - pMsg->messageType = eWNI_SME_REMAIN_ON_CHANNEL_REQ; - pMsg->length = (uint16_t) len; - qdf_copy_macaddr(&pMsg->selfMacAddr, &pSession->selfMacAddr); - pMsg->chnNum = p2pRemainonChn->u.remainChlCmd.chn; - pMsg->phyMode = p2pRemainonChn->u.remainChlCmd.phyMode; - pMsg->duration = p2pRemainonChn->u.remainChlCmd.duration; - pMsg->sessionId = p2pRemainonChn->sessionId; - pMsg->isProbeRequestAllowed = - p2pRemainonChn->u.remainChlCmd.isP2PProbeReqAllowed; - pMsg->scan_id = p2pRemainonChn->u.remainChlCmd.scan_id; - if (pMac->p2pContext.probeRspIeLength) - qdf_mem_copy((void *)pMsg->probeRspIe, - (void *)pMac->p2pContext.probeRspIe, - pMac->p2pContext.probeRspIeLength); - status = umac_send_mb_message_to_mac(pMsg); - - return status; -} - -QDF_STATUS sme_p2p_open(tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - QDF_STATUS status = QDF_STATUS_SUCCESS; - - /* If static structure is too big, Need to change this function to - * allocate memory dynamically - */ - qdf_mem_zero(&pMac->p2pContext, sizeof(tp2pContext)); - - if (!QDF_IS_STATUS_SUCCESS(status)) - sme_p2p_close(hHal); - - return status; -} - -QDF_STATUS p2p_stop(tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - - if (pMac->p2pContext.probeRspIe) { - qdf_mem_free(pMac->p2pContext.probeRspIe); - pMac->p2pContext.probeRspIe = NULL; - } - - pMac->p2pContext.probeRspIeLength = 0; - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS sme_p2p_close(tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - - if (pMac->p2pContext.probeRspIe) { - qdf_mem_free(pMac->p2pContext.probeRspIe); - pMac->p2pContext.probeRspIe = NULL; - } - - pMac->p2pContext.probeRspIeLength = 0; - - return QDF_STATUS_SUCCESS; -} - -/* - * p2p_remain_on_channel() - - * API to post the remain on channel command. - * - * hHal - The handle returned by mac_open. - * sessinId - HDD session ID. - * channel - Channel to remain on channel. - * duration - Duration for which we should remain on channel - * callback - callback function. - * pContext - argument to the callback function - * Return QDF_STATUS - */ -QDF_STATUS p2p_remain_on_channel(tHalHandle hHal, uint8_t sessionId, - uint8_t channel, uint32_t duration, - remainOnChanCallback callback, - void *pContext, uint8_t isP2PProbeReqAllowed, - uint32_t scan_id) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - tSmeCmd *pRemainChlCmd = NULL; - uint32_t phyMode; - - pRemainChlCmd = csr_get_command_buffer(pMac); - if (pRemainChlCmd == NULL) - return QDF_STATUS_E_FAILURE; - - if (BAND_5G == csr_get_rf_band(channel)) - phyMode = WNI_CFG_PHY_MODE_11A; - else - phyMode = WNI_CFG_PHY_MODE_11G; - - cfg_set_int(pMac, WNI_CFG_PHY_MODE, phyMode); - - do { - /* call set in context */ - pRemainChlCmd->command = eSmeCommandRemainOnChannel; - pRemainChlCmd->sessionId = sessionId; - pRemainChlCmd->u.remainChlCmd.chn = channel; - pRemainChlCmd->u.remainChlCmd.duration = duration; - pRemainChlCmd->u.remainChlCmd.isP2PProbeReqAllowed = - isP2PProbeReqAllowed; - pRemainChlCmd->u.remainChlCmd.callback = callback; - pRemainChlCmd->u.remainChlCmd.callbackCtx = pContext; - pRemainChlCmd->u.remainChlCmd.scan_id = scan_id; - - /* Put it at the head of the Q if we just finish finding the - * peer and ready to send a frame - */ - status = csr_queue_sme_command(pMac, pRemainChlCmd, false); - } while (0); - - return status; -} - -QDF_STATUS p2p_send_action(tHalHandle hHal, uint8_t sessionId, - const uint8_t *pBuf, uint32_t len, uint16_t wait, - bool noack, uint16_t channel_freq) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tSirMbMsgP2p *pMsg; - uint16_t msgLen; - - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - " %s sends action frame", __func__); - msgLen = (uint16_t) ((sizeof(tSirMbMsgP2p)) + len); - pMsg = qdf_mem_malloc(msgLen); - if (NULL == pMsg) - status = QDF_STATUS_E_NOMEM; - else { - pMsg->type = eWNI_SME_SEND_ACTION_FRAME_IND; - pMsg->msgLen = msgLen; - pMsg->sessionId = sessionId; - pMsg->noack = noack; - pMsg->channel_freq = channel_freq; - pMsg->wait = (uint16_t) wait; - qdf_mem_copy(pMsg->data, pBuf, len); - status = umac_send_mb_message_to_mac(pMsg); - } - return status; -} - -QDF_STATUS p2p_cancel_remain_on_channel(tHalHandle hHal, - uint8_t sessionId, uint32_t scan_id) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tSirMbMsgP2p *pMsg; - uint16_t msgLen; - - /* Need to check session ID to support concurrency */ - - msgLen = (uint16_t) (sizeof(tSirMbMsgP2p)); - pMsg = qdf_mem_malloc(msgLen); - if (NULL == pMsg) - status = QDF_STATUS_E_NOMEM; - else { - qdf_mem_set((void *)pMsg, msgLen, 0); - pMsg->type = eWNI_SME_ABORT_REMAIN_ON_CHAN_IND; - pMsg->msgLen = msgLen; - pMsg->sessionId = sessionId; - pMsg->scan_id = scan_id; - status = umac_send_mb_message_to_mac(pMsg); - } - - return status; -} - -QDF_STATUS p2p_set_ps(tHalHandle hHal, tP2pPsConfig *pNoA) -{ - tpP2pPsConfig pNoAParam; - struct scheduler_msg msg = {0}; - QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - - pNoAParam = qdf_mem_malloc(sizeof(tP2pPsConfig)); - if (NULL == pNoAParam) - status = QDF_STATUS_E_NOMEM; - else { - qdf_mem_copy(pNoAParam, pNoA, sizeof(tP2pPsConfig)); - msg.type = eWNI_SME_UPDATE_NOA; - msg.bodyval = 0; - msg.bodyptr = pNoAParam; - lim_post_msg_api(pMac, &msg); - } - return status; -} diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 5eb615f85ce8..5f49ebe3771e 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -179,7 +179,6 @@ #define WMA_HIDDEN_SSID_RESTART_RSP SIR_HAL_HIDDEN_SSID_RESTART_RSP #define WMA_SWITCH_CHANNEL_RSP SIR_HAL_SWITCH_CHANNEL_RSP #define WMA_P2P_NOA_ATTR_IND SIR_HAL_P2P_NOA_ATTR_IND -#define WMA_P2P_NOA_START_IND SIR_HAL_P2P_NOA_START_IND #define WMA_PWR_SAVE_CFG SIR_HAL_PWR_SAVE_CFG #define WMA_REGISTER_PE_CALLBACK SIR_HAL_REGISTER_PE_CALLBACK