blob: 0329b1a2c2cc9c0564799b7e02e4c295a5b8f44b [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
sheenam monga5307dd92020-01-10 15:19:11 +05302 * Copyright (c) 2012-2017, 2019-2020 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Jeff Johnson295189b2012-06-20 16:38:30 -070026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file limProcessActionFrame.cc contains the code
33 * for processing Action Frame.
34 * Author: Michael Lui
35 * Date: 05/23/03
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41#include "palTypes.h"
42#include "wniApi.h"
43#include "sirApi.h"
44#include "aniGlobal.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053045#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046#include "schApi.h"
47#include "utilsApi.h"
48#include "limTypes.h"
49#include "limUtils.h"
50#include "limAssocUtils.h"
51#include "limSecurityUtils.h"
52#include "limSerDesUtils.h"
53#include "limSendSmeRspMessages.h"
54#include "parserApi.h"
55#include "limAdmitControl.h"
56#include "wmmApsd.h"
57#include "limSendMessages.h"
58#if defined WLAN_FEATURE_VOWIFI
59#include "rrmApi.h"
60#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070061#include "limSessionUtils.h"
Abhishek Singh00b71972016-01-07 10:51:04 +053062#ifdef WLAN_FEATURE_RMC
63#include "limRMC.h"
64#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070065
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080066#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
67#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070068#endif
69#include "wlan_qct_wda.h"
70
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +053071#ifdef WLAN_FEATURE_LFR_MBB
72#include "lim_mbb.h"
73#endif
Sourav Mohapatraf4105f72019-02-28 14:58:17 +053074#include "dot11f.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76#define BA_DEFAULT_TX_BUFFER_SIZE 64
77
78typedef enum
79{
80 LIM_ADDBA_RSP = 0,
81 LIM_ADDBA_REQ = 1
82}tLimAddBaValidationReqType;
83
84/* Note: The test passes if the STAUT stops sending any frames, and no further
85 frames are transmitted on this channel by the station when the AP has sent
86 the last 6 beacons, with the channel switch information elements as seen
87 with the sniffer.*/
88#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
89/**-----------------------------------------------------------------
90\fn limStopTxAndSwitchChannel
91\brief Stops the transmission if channel switch mode is silent and
92 starts the channel switch timer.
93
94\param pMac
95\return NONE
96-----------------------------------------------------------------*/
97void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
98{
99 tANI_U8 isFullPowerRequested = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700100 tpPESession psessionEntry;
101
102 psessionEntry = peFindSessionBySessionId( pMac , sessionId );
103
104 if( NULL == psessionEntry )
105 {
106 limLog(pMac, LOGE, FL("Session %d not active\n "), sessionId);
107 return;
108 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700109
Padma, Santhosh Kumara60416c2017-03-09 19:23:54 +0530110 if(pMac->ft.ftPEContext.pFTPreAuthReq)
111 {
112 limLog(pMac, LOGE,
113 FL("Avoid Switch Channel req during pre auth"));
114 return;
115 }
116
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530117 limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
118 psessionEntry->gLimChannelSwitch.switchMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700119
Jeff Johnsone7245742012-09-05 17:12:55 -0700120 if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
121 psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 {
123 /* Freeze the transmission */
124 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
125
126 /*Request for Full power only if the device is in powersave*/
127 if(!limIsSystemInActiveState(pMac))
128 {
129 /* Request Full Power */
130 limSendSmePreChannelSwitchInd(pMac);
131 isFullPowerRequested = 1;
132 }
133 }
134 else
135 {
136 /* Resume the transmission */
137 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
138 }
139
Jeff Johnsone7245742012-09-05 17:12:55 -0700140 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700141 /* change the channel immediatly only if the channel switch count is 0 and the
142 * device is not in powersave
143 * If the device is in powersave channel switch should happen only after the
144 * device comes out of the powersave */
Jeff Johnsone7245742012-09-05 17:12:55 -0700145 if (psessionEntry->gLimChannelSwitch.switchCount == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700146 {
147 if(limIsSystemInActiveState(pMac))
148 {
149 limProcessChannelSwitchTimeout(pMac);
150 }
151 else if(!isFullPowerRequested)
152 {
153 /* If the Full power is already not requested
154 * Request Full Power so the channel switch happens
155 * after device comes to full power */
156 limSendSmePreChannelSwitchInd(pMac);
157 }
158 return;
159 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -0800160 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700161
Jeff Johnson295189b2012-06-20 16:38:30 -0700162
163 if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
164 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700165 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 }
167 return;
168}
169
170/**------------------------------------------------------------
171\fn limStartChannelSwitch
172\brief Switches the channel if switch count == 0, otherwise
173 starts the timer for channel switch and stops BG scan
174 and heartbeat timer tempororily.
175
176\param pMac
177\param psessionEntry
178\return NONE
179------------------------------------------------------------*/
180tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
181{
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530182 limLog(pMac, LOG1, FL(" ENTER"));
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +0530183
184#ifdef WLAN_FEATURE_LFR_MBB
185 if (lim_is_mbb_reassoc_in_progress(pMac, psessionEntry))
186 {
187 limLog(pMac, LOGE,
188 FL("Ignore channel switch as LFR MBB in progress"));
189 return eSIR_SUCCESS;
190 }
191#endif
192
Jeff Johnsone7245742012-09-05 17:12:55 -0700193 /*If channel switch is already running and it is on a different session, just return*/
194 /*This need to be removed for MCC */
195 if( limIsChanSwitchRunning (pMac) &&
196 psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
197 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700198 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d"), psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700199 return eSIR_SUCCESS;
200 }
Sushant Kaushikb97a0082015-08-31 12:36:45 +0530201#ifdef FEATURE_WLAN_DIAG_SUPPORT
202 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
203 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_CSA);
204#endif
205
Kalikinkar dhara085c02f2014-02-28 15:32:12 -0800206 psessionEntry->channelChangeCSA = LIM_SWITCH_CHANNEL_CSA;
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 /* Deactivate and change reconfigure the timeout value */
Jeff Johnsone7245742012-09-05 17:12:55 -0700208 //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800209 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnsone7245742012-09-05 17:12:55 -0700210 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
211 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700212 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700213 return eSIR_FAILURE;
214 }
215
216 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
217 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
218 0) != TX_SUCCESS)
219 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700220 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnsone7245742012-09-05 17:12:55 -0700221 return eSIR_FAILURE;
222 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700223
224 /* Follow the channel switch, forget about the previous quiet. */
225 //If quiet is running, chance is there to resume tx on its timeout.
226 //so stop timer for a safer side.
Jeff Johnsone7245742012-09-05 17:12:55 -0700227 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700229 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
231 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700232 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 return eSIR_FAILURE;
234 }
235 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700236 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700238 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
240 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700241 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 return eSIR_FAILURE;
243 }
244 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700245 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700246
247 /* Prepare for 11h channel switch */
248 limPrepareFor11hChannelSwitch(pMac, psessionEntry);
249
250 /** Dont add any more statements here as we posted finish scan request
251 * to HAL, wait till we get the response
252 */
253 return eSIR_SUCCESS;
254}
255
256
257/**
258 * __limProcessChannelSwitchActionFrame
259 *
260 *FUNCTION:
261 *
262 *LOGIC:
263 *
264 *ASSUMPTIONS:
265 *
266 *NOTE:
267 *
268 * @param pMac - Pointer to Global MAC structure
269 * @param *pRxPacketInfo - A pointer to packet info structure
270 * @return None
271 */
272
273static void
274
275__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
276{
277
278 tpSirMacMgmtHdr pHdr;
279 tANI_U8 *pBody;
280 tDot11fChannelSwitch *pChannelSwitchFrame;
281 tANI_U16 beaconPeriod;
282 tANI_U32 val;
283 tANI_U32 frameLen;
284 tANI_U32 nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700285
286 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
287 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
288 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
289
Abhishek Singh127a8442014-12-15 17:31:27 +0530290 limLog(pMac, LOG1, FL("Received Channel switch action frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 if (!psessionEntry->lim11hEnable)
292 return;
293
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530294 pChannelSwitchFrame = vos_mem_malloc(sizeof(*pChannelSwitchFrame));
295 if (NULL == pChannelSwitchFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 {
297 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530298 FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 return;
300 }
301
302 /* Unpack channel switch frame */
303 nStatus = dot11fUnpackChannelSwitch(pMac, pBody, frameLen, pChannelSwitchFrame);
304
305 if( DOT11F_FAILED( nStatus ))
306 {
307 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700308 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 nStatus,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700310 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530311 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 return;
313 }
314 else if(DOT11F_WARNED( nStatus ))
315 {
316 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700317 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 nStatus,
319 frameLen);
320 }
321
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530322 if (vos_mem_compare((tANI_U8 *) &psessionEntry->bssId,
323 (tANI_U8 *) &pHdr->sa,
324 sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 {
326 #if 0
327 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
328 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530329 vos_mem_free(pChannelSwitchFrame);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700330 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 return;
332 }
333 #endif// TO SUPPORT BT-AMP
334
335 /* copy the beacon interval from psessionEntry*/
336 val = psessionEntry->beaconParams.beaconInterval;
337
338 beaconPeriod = (tANI_U16) val;
339
Jeff Johnsone7245742012-09-05 17:12:55 -0700340 psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
341 psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
342 psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
343 psessionEntry->gLimChannelSwitch.switchCount;
344 psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700345#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700346 if ( pChannelSwitchFrame->WiderBWChanSwitchAnn.present && psessionEntry->vhtCapability)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700347 {
348 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth;
349 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0;
350 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq1;
351 }
352#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700353
Abhishek Singh127a8442014-12-15 17:31:27 +0530354 limLog(pMac, LOG1, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
355 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
357 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -0700358 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
359 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700360
Jeff Johnsone7245742012-09-05 17:12:55 -0700361 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 {
Abhishek Singh15431c42017-10-25 15:43:02 +0530363 if ((pChannelSwitchFrame->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
364 (pChannelSwitchFrame->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700366 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Abhishek Singh15431c42017-10-25 15:43:02 +0530367 psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->sec_chan_offset.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700369#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700370 if(psessionEntry->vhtCapability && pChannelSwitchFrame->WiderBWChanSwitchAnn.present)
371 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700372 if (pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
373 {
Abhishek Singh15431c42017-10-25 15:43:02 +0530374 if (pChannelSwitchFrame->sec_chan_offset.present && ((pChannelSwitchFrame->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
375 (pChannelSwitchFrame->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700376 {
377 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700378 psessionEntry->gLimChannelSwitch.secondarySubBand =
379 limGet11ACPhyCBState(pMac,
380 psessionEntry->gLimChannelSwitch.primaryChannel,
Abhishek Singh15431c42017-10-25 15:43:02 +0530381 pChannelSwitchFrame->sec_chan_offset.secondaryChannelOffset,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700382 pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0,
383 psessionEntry);
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700384 }
385 }
386 }
387#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 }
389
390 }
391 else
392 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530393 limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));
Jeff Johnson295189b2012-06-20 16:38:30 -0700394 }
395
396 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
397 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530398 limLog(pMac, LOG1, FL("Could not start channel switch"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 }
400
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530401 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 return;
403} /*** end limProcessChannelSwitchActionFrame() ***/
404
Abhishek Singh39ae47e2017-10-30 17:39:50 +0530405/**
406 * lim_process_ecsa_action_frame()- Process ECSA Action
407 * Frames.
408 * @mac_ctx: pointer to global mac structure
409 * @rx_packet_info: rx packet meta information
410 * @session_entry: Session entry.
411 *
412 * This function is called when ECSA action frame is received on STA interface.
413 *
414 * Return: void
415 */
416static void
417lim_process_ecsa_action_frame(tpAniSirGlobal mac_ctx,
418 uint8_t *rx_packet_info, tpPESession session_entry)
419{
420 tpSirMacMgmtHdr hdr;
421 uint8_t *body;
422 tDot11fext_channel_switch_action_frame *ecsa_frame;
423 struct ecsa_frame_params ecsa_req;
424 uint32_t frame_len;
425 uint32_t status;
426
427 hdr = WDA_GET_RX_MAC_HEADER(rx_packet_info);
428 body = WDA_GET_RX_MPDU_DATA(rx_packet_info);
429 frame_len = WDA_GET_RX_PAYLOAD_LEN(rx_packet_info);
430
431 limLog(mac_ctx, LOG1, FL("Received ECSA action frame"));
432
433
434 ecsa_frame = vos_mem_malloc(sizeof(*ecsa_frame));
435 if (!ecsa_frame) {
436 limLog(mac_ctx, LOGE, FL("AllocateMemory failed"));
437 return;
438 }
439
440 /* Unpack channel switch frame */
441 status = dot11fUnpackext_channel_switch_action_frame(mac_ctx,
442 body, frame_len, ecsa_frame);
443
444 if (DOT11F_FAILED(status)) {
445 limLog(mac_ctx, LOGE, FL("Failed to parse CHANSW action frame (0x%08x, len %d):"),
446 status, frame_len);
447 goto free_ecsa;
448 } else if (DOT11F_WARNED(status)) {
449 limLog(mac_ctx, LOGW, FL("There were warnings while unpacking CHANSW Request (0x%08x, %d bytes):"),
450 status, frame_len);
451 }
452
453 if (session_entry->currentOperChannel ==
454 ecsa_frame->ext_chan_switch_ann_action.new_channel) {
455 limLog(mac_ctx, LOGE, FL("New channel %d is same as old channel ignore req"),
456 ecsa_frame->ext_chan_switch_ann_action.new_channel);
457 goto free_ecsa;
458 }
459
460 ecsa_req.new_channel = ecsa_frame->ext_chan_switch_ann_action.new_channel;
461 ecsa_req.op_class = ecsa_frame->ext_chan_switch_ann_action.op_class;
462 ecsa_req.switch_mode = ecsa_frame->ext_chan_switch_ann_action.switch_mode;
463 ecsa_req.switch_count = ecsa_frame->ext_chan_switch_ann_action.switch_count;
464 limLog(mac_ctx, LOG1, FL("New channel %d op class %d switch mode %d switch count %d"),
465 ecsa_req.new_channel, ecsa_req.op_class,
466 ecsa_req.switch_mode, ecsa_req.switch_count);
467
468 lim_handle_ecsa_req(mac_ctx, &ecsa_req, session_entry);
469free_ecsa:
470 vos_mem_free(ecsa_frame);
471}
472
Jeff Johnson295189b2012-06-20 16:38:30 -0700473
Mohit Khanna4a70d262012-09-11 16:30:12 -0700474#ifdef WLAN_FEATURE_11AC
475static void
476__limProcessOperatingModeActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
477{
478
479 tpSirMacMgmtHdr pHdr;
480 tANI_U8 *pBody;
481 tDot11fOperatingMode *pOperatingModeframe;
482 tANI_U32 frameLen;
483 tANI_U32 nStatus;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700484 tpDphHashNode pSta;
485 tANI_U16 aid;
Abhishek Singhdf8eb312014-11-15 00:49:28 +0530486 tANI_U8 operMode;
487 tANI_U32 channelBondingMode;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700488
489 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
490 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
491 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
492
Abhishek Singhdf8eb312014-11-15 00:49:28 +0530493 limLog(pMac, LOG1, FL("Received Operating Mode action frame"));
494
495 if( RF_CHAN_14 >= psessionEntry->currentOperChannel )
496 {
497 channelBondingMode = pMac->roam.configParam.channelBondingMode24GHz;
498 }
499 else
500 {
501 channelBondingMode = pMac->roam.configParam.channelBondingMode5GHz;
502 }
503
504 /* Do not update the channel bonding mode if channel bonding
505 * mode is disabled in INI.
506 */
507 if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == channelBondingMode)
508 {
509 limLog(pMac, LOGW,
510 FL("channel bonding disabled"));
511 return;
512 }
513
Sushant Kaushikc1123872015-01-07 13:59:20 +0530514 if (( RF_CHAN_14 >= psessionEntry->currentOperChannel )&&
515 !IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
516 {
517 limLog(pMac, LOGW,
518 FL("channel bonding disabled as FW doesn't supoort CB in 2.4gz"));
519 return;
520 }
521
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530522 pOperatingModeframe = vos_mem_malloc(sizeof(*pOperatingModeframe));
523 if (NULL == pOperatingModeframe)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700524 {
525 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530526 FL("AllocateMemory failed"));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700527 return;
528 }
529
530 /* Unpack channel switch frame */
531 nStatus = dot11fUnpackOperatingMode(pMac, pBody, frameLen, pOperatingModeframe);
532
533 if( DOT11F_FAILED( nStatus ))
534 {
535 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700536 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700537 nStatus,
538 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530539 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700540 return;
541 }
542 else if(DOT11F_WARNED( nStatus ))
543 {
544 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700545 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700546 nStatus,
547 frameLen);
548 }
549 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
Padma, Santhosh Kumar6a3fdc62015-08-28 17:59:51 +0530550 if (pSta == NULL)
551 {
552 PELOGE(limLog(pMac, LOGE, FL("Station context not found"));)
553 return;
554 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700555
556 operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
557 if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
558 {
559 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700560 FL(" received Chanwidth %d, staIdx = %d"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700561 (pOperatingModeframe->OperatingMode.chanWidth ),
562 pSta->staIndex);
563
564 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700565 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700566 pHdr->sa[0],
567 pHdr->sa[1],
568 pHdr->sa[2],
569 pHdr->sa[3],
570 pHdr->sa[4],
571 pHdr->sa[5]);
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700572
Mohit Khanna4a70d262012-09-11 16:30:12 -0700573 if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
574 {
575 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
576 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
577 }
578 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
579 {
580 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
581 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
582 }
583 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
584 {
585 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
586 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
587 }
588 limCheckVHTOpModeChange( pMac, psessionEntry,
589 (pOperatingModeframe->OperatingMode.chanWidth), pSta->staIndex);\
590 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530591 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700592 return;
593}
594#endif
595
Jeff Johnson295189b2012-06-20 16:38:30 -0700596static void
597__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
598{
Jeff Johnson295189b2012-06-20 16:38:30 -0700599}
600
601
602static void
603__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
604{
605 tSirAddtsRspInfo addts;
606 tSirRetStatus retval;
607 tpSirMacMgmtHdr pHdr;
608 tpDphHashNode pSta;
609 tANI_U16 aid;
610 tANI_U32 frameLen;
611 tANI_U8 *pBody;
612 tpLimTspecInfo tspecInfo;
613 tANI_U8 ac;
614 tpDphHashNode pStaDs = NULL;
615 tANI_U8 rspReqd = 1;
616 tANI_U32 cfgLen;
617 tSirMacAddr peerMacAddr;
618
619
620 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
621 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
622 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
623
624
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700625 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
627 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700628 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 return;
630 }
631
632 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
633 if (pSta == NULL)
634 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700635 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 return;
637 }
638
639 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
640 if (retval != eSIR_SUCCESS)
641 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700642 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 return;
644 }
645
646 // don't have to check for qos/wme capabilities since we wouldn't have this
647 // flag set otherwise
648 if (! pMac->lim.gLimAddtsSent)
649 {
650 // we never sent an addts request!
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700651 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 return;
653 }
654
655 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
656 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700657 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring",
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
659 return;
660 }
661
662 /*
663 * for successful addts reponse, try to add the classifier.
664 * if this fails for any reason, we should send a delts request to the ap
665 * for now, its ok not to send a delts since we are going to add support for
666 * multiple tclas soon and until then we won't send any addts requests with
667 * multiple tclas elements anyway.
668 * In case of addClassifier failure, we just let the addts timer run out
669 */
670 if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
671 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
672 (addts.status == eSIR_MAC_SUCCESS_STATUS))
673 {
674 // add the classifier - this should always succeed
675 if (addts.numTclas > 1) // currently no support for multiple tclas elements
676 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700677 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 aid, addts.numTclas);
679 return;
680 }
681 else if (addts.numTclas == 1)
682 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700683 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!", aid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
685 }
686 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700687 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
689 addts.status);
690
691 // deactivate the response timer
692 limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
693
694 if (addts.status != eSIR_MAC_SUCCESS_STATUS)
695 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700696 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
698 addts.status);
699 limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
700 psessionEntry->smeSessionId, psessionEntry->transactionId);
701
702 // clear the addts flag
703 pMac->lim.gLimAddtsSent = false;
704
705 return;
706 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800707#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 if (addts.tsmPresent)
709 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700710 limLog(pMac, LOGW, "TSM IE Present");
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800711 psessionEntry->eseContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
712 vos_mem_copy(&psessionEntry->eseContext.tsm.tsmInfo,
713 &addts.tsmIE,sizeof(tSirMacESETSMIE));
714#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700715 limSendSmeTsmIEInd(pMac, psessionEntry, addts.tsmIE.tsid,
716 addts.tsmIE.state, addts.tsmIE.msmt_interval);
717#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 limActivateTSMStatsTimer(pMac, psessionEntry);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800719#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 }
721#endif
722 /* Since AddTS response was successful, check for the PSB flag
723 * and directional flag inside the TS Info field.
724 * An AC is trigger enabled AC if the PSB subfield is set to 1
725 * in the uplink direction.
726 * An AC is delivery enabled AC if the PSB subfield is set to 1
727 * in the downlink direction.
728 * An AC is trigger and delivery enabled AC if the PSB subfield
729 * is set to 1 in the bi-direction field.
730 */
731 if (addts.tspec.tsinfo.traffic.psb == 1)
732 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
733 else
734 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
735
736
737 /* ADDTS success, so AC is now admitted. We shall now use the default
738 * EDCA parameters as advertised by AP and send the updated EDCA params
739 * to HAL.
740 */
741 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
742 if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
743 {
744 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
745 }
746 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
747 {
748 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
749 }
750 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
751 {
752 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
753 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
754 }
755
756 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
757
758 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
759 if (pStaDs != NULL)
760 {
761 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
762 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
763 else
764 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
765 }
766 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700767 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700768
769
770 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
771
772 //if schedule is not present then add TSPEC with svcInterval as 0.
773 if(!addts.schedulePresent)
774 addts.schedule.svcInterval = 0;
775 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
776 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700777 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
779 psessionEntry);
780 pMac->lim.gLimAddtsSent = false;
781 return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
782 }
783 if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +0530784 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 {
786 retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
787 if(eSIR_SUCCESS != retval)
788 {
789 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
790
791 // Send DELTS action frame to AP
792 cfgLen = sizeof(tSirMacAddr);
793 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
794 psessionEntry);
795 limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
796 psessionEntry->smeSessionId, psessionEntry->transactionId);
797 pMac->lim.gLimAddtsSent = false;
798 return;
799 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700800 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
802 }
803 else
804 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700805 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700807 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 // Use the smesessionId and smetransactionId from the PE session context
809 limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
810 psessionEntry->smeSessionId, psessionEntry->transactionId);
811 }
812
813 // clear the addts flag
814 pMac->lim.gLimAddtsSent = false;
815 return;
816}
817
818
819static void
820__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
821{
822 tSirRetStatus retval;
823 tSirDeltsReqInfo delts;
824 tpSirMacMgmtHdr pHdr;
825 tpDphHashNode pSta;
826 tANI_U32 frameLen;
827 tANI_U16 aid;
828 tANI_U8 *pBody;
829 tANI_U8 tsStatus;
830 tSirMacTSInfo *tsinfo;
831 tANI_U8 tspecIdx;
832 tANI_U8 ac;
833 tpDphHashNode pStaDs = NULL;
834
835
836 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
837 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
838 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
839
840 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
841 if (pSta == NULL)
842 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700843 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 return;
845 }
846
847 // parse the delts request
848 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
849 if (retval != eSIR_SUCCESS)
850 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700851 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 return;
853 }
854
855 if (delts.wmeTspecPresent)
856 {
857 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
858 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700859 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 return;
861 }
Abhishek Singh525045c2014-12-15 17:18:45 +0530862 limLog(pMac, LOG1, FL("WME Delts received"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 }
864 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
865 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530866 limLog(pMac, LOG1, FL("11e QoS Delts received"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 }
868 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
869 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530870 limLog(pMac, LOG1, FL("WSM Delts received"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 }
872 else
873 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700874 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 return;
876 }
877
878 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
879
880 // if no Admit Control, ignore the request
881 if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
882 {
883
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530884 if (upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC)
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700886 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 tsinfo->traffic.userPrio);
888 return;
889 }
890 }
891
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530892 if ((psessionEntry->limSystemRole != eLIM_AP_ROLE) &&
893 (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
894 limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
895
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 // try to delete the TS
897 if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
898 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700899 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 return;
901 }
902
903 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
904 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
905 {
906 //Edca only for now.
907 }
908 else
909 {
910 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530911 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
912 pSta->staIndex,
913 tspecIdx,
914 delts,
915 psessionEntry->peSessionId,
916 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700918 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 tsinfo->traffic.userPrio);
920 return;
921 }
922 }
923
924 /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
925 * The AC for this TSPEC is no longer trigger enabled if this Tspec
926 * was set-up in uplink direction only.
927 * The AC for this TSPEC is no longer delivery enabled if this Tspec
928 * was set-up in downlink direction only.
929 * The AC for this TSPEC is no longer triiger enabled and delivery
930 * enabled if this Tspec was a bidirectional TSPEC.
931 */
932 limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
933
934
935 /* We're deleting the TSPEC.
936 * The AC for this TSPEC is no longer admitted in uplink/downlink direction
937 * if this TSPEC was set-up in uplink/downlink direction only.
938 * The AC for this TSPEC is no longer admitted in both uplink and downlink
939 * directions if this TSPEC was a bi-directional TSPEC.
940 * If ACM is set for this AC and this AC is admitted only in downlink
941 * direction, PE needs to downgrade the EDCA parameter
942 * (for the AC for which TS is being deleted) to the
943 * next best AC for which ACM is not enabled, and send the
944 * updated values to HAL.
945 */
946 ac = upToAc(tsinfo->traffic.userPrio);
947
948 if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
949 {
950 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
951 }
952 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
953 {
954 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
955 }
956 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
957 {
958 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
959 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
960 }
961
962 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
963
964 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
965 if (pStaDs != NULL)
966 {
967 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
968 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
969 else
970 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
971 }
972 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700973 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700974
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530975 limLog(pMac, LOG1, FL("DeleteTS succeeded"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700976
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800977#ifdef FEATURE_WLAN_ESE
978#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700979 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
980#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800982#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700983#endif
984
985}
986
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700987static void
988__limProcessQosMapConfigureFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
989 tpPESession psessionEntry)
990{
991 tpSirMacMgmtHdr pHdr;
992 tANI_U32 frameLen;
993 tANI_U8 *pBody;
994 tSirRetStatus retval;
995 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
996 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
997 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
998 retval = sirConvertQosMapConfigureFrame2Struct(pMac, pBody, frameLen,
Kumar Anand82c009f2014-05-29 00:29:42 -0700999 &psessionEntry->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07001000 if (retval != eSIR_SUCCESS)
1001 {
1002 PELOGW(limLog(pMac, LOGE,
1003 FL("QosMapConfigure frame parsing failed (error %d)"), retval);)
1004 return;
1005 }
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05301006 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05301007 pRxPacketInfo, psessionEntry,
1008 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07001009}
Jeff Johnson295189b2012-06-20 16:38:30 -07001010
1011#ifdef ANI_SUPPORT_11H
1012/**
1013 * limProcessBasicMeasReq
1014 *
1015 *FUNCTION:
1016 * This function is called by limProcessMeasurementRequestFrame()
1017 * when it received a Basic measurement Request action frame.
1018 * Station/BP receiving this should perform basic measurements
1019 * and then send Basic Measurement Report. AP should not perform
1020 * any measurements, and send report indicating refusal.
1021 *
1022 *LOGIC:
1023 *
1024 *ASSUMPTIONS:
1025 *
1026 *NOTE:
1027 *
1028 * @param pMac - Pointer to Global MAC structure
1029 * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
1030 * @return None
1031 */
1032static void
1033__limProcessBasicMeasReq(tpAniSirGlobal pMac,
1034 tpSirMacMeasReqActionFrame pMeasReqFrame,
1035 tSirMacAddr peerMacAddr)
1036{
1037 // TBD - Station shall perform basic measurements
1038
1039 if (limSendMeasReportFrame(pMac,
1040 pMeasReqFrame,
1041 peerMacAddr) != eSIR_SUCCESS)
1042 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001043 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 return;
1045 }
1046}
1047
1048
1049/**
1050 * limProcessCcaMeasReq
1051 *
1052 *FUNCTION:
1053 * This function is called by limProcessMeasurementRequestFrame()
1054 * when it received a CCA measurement Request action frame.
1055 * Station/BP receiving this should perform CCA measurements
1056 * and then send CCA Measurement Report. AP should not perform
1057 * any measurements, and send report indicating refusal.
1058 *
1059 *LOGIC:
1060 *
1061 *ASSUMPTIONS:
1062 *
1063 *NOTE:
1064 *
1065 * @param pMac - Pointer to Global MAC structure
1066 * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
1067 * @return None
1068 */
1069static void
1070__limProcessCcaMeasReq(tpAniSirGlobal pMac,
1071 tpSirMacMeasReqActionFrame pMeasReqFrame,
1072 tSirMacAddr peerMacAddr)
1073{
1074 // TBD - Station shall perform cca measurements
1075
1076 if (limSendMeasReportFrame(pMac,
1077 pMeasReqFrame,
1078 peerMacAddr) != eSIR_SUCCESS)
1079 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001080 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 return;
1082 }
1083}
1084
1085
1086/**
1087 * __limProcessRpiMeasReq
1088 *
1089 *FUNCTION:
1090 * This function is called by limProcessMeasurementRequestFrame()
1091 * when it received a RPI measurement Request action frame.
1092 * Station/BP/AP receiving this shall not perform any measurements,
1093 * and send report indicating refusal.
1094 *
1095 *LOGIC:
1096 *
1097 *ASSUMPTIONS:
1098 *
1099 *NOTE:
1100 *
1101 * @param pMac - Pointer to Global MAC structure
1102 * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
1103 * @return None
1104 */
1105static void
1106__limProcessRpiMeasReq(tpAniSirGlobal pMac,
1107 tpSirMacMeasReqActionFrame pMeasReqFrame,
1108 tSirMacAddr peerMacAddr)
1109{
1110 if (limSendMeasReportFrame(pMac,
1111 pMeasReqFrame,
1112 peerMacAddr) != eSIR_SUCCESS)
1113 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001114 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 return;
1116 }
1117}
1118
1119
1120/**
1121 * __limProcessMeasurementRequestFrame
1122 *
1123 *FUNCTION:
1124 *
1125 *LOGIC:
1126 *
1127 *ASSUMPTIONS:
1128 *
1129 *NOTE:
1130 *
1131 * @param pMac - Pointer to Global MAC structure
1132 * @param *pRxPacketInfo - A pointer to packet info structure
1133 * @return None
1134 */
1135
1136static void
1137__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1138{
1139 tpSirMacMgmtHdr pHdr;
1140 tANI_U8 *pBody;
1141 tpSirMacMeasReqActionFrame pMeasReqFrame;
1142 tANI_U32 frameLen;
1143
1144 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1145 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1146 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1147
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301148 pMeasReqFrame = vos_mem_malloc(sizeof( tSirMacMeasReqActionFrame ));
1149 if (NULL == pMeasReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001150 {
1151 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301152 FL("limProcessMeasurementRequestFrame: AllocateMemory failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 return;
1154 }
1155
1156 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1157 eSIR_SUCCESS)
1158 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001159 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 return;
1161 }
1162
1163
1164 switch(pMeasReqFrame->measReqIE.measType)
1165 {
1166 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
1167 __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1168 break;
1169
1170 case SIR_MAC_CCA_MEASUREMENT_TYPE:
1171 __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1172 break;
1173
1174 case SIR_MAC_RPI_MEASUREMENT_TYPE:
1175 __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1176 break;
1177
1178 default:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301179 limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
1180 pMeasReqFrame->measReqIE.measType);
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 break;
1182 }
1183
1184} /*** end limProcessMeasurementRequestFrame ***/
1185
1186
1187/**
1188 * limProcessTpcRequestFrame
1189 *
1190 *FUNCTION:
1191 * This function is called upon receiving Tpc Request frame.
1192 *
1193 *NOTE:
1194 *
1195 * @param pMac - Pointer to Global MAC structure
1196 * @param *pRxPacketInfo - A pointer to packet info structure
1197 * @return None
1198 */
1199
1200static void
1201__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1202{
1203 tpSirMacMgmtHdr pHdr;
1204 tANI_U8 *pBody;
1205 tpSirMacTpcReqActionFrame pTpcReqFrame;
1206 tANI_U32 frameLen;
1207
1208 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1209 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1210 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1211
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301212 limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001213
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301214 pTpcReqFrame = vos_mem_malloc(sizeof( tSirMacTpcReqActionFrame ));
1215 if (NULL == pTpcReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001216 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301217 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 return;
1219 }
1220
1221 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1222 eSIR_SUCCESS)
1223 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001224 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 return;
1226 }
1227
1228 if (limSendTpcReportFrame(pMac,
1229 pTpcReqFrame,
1230 pHdr->sa) != eSIR_SUCCESS)
1231 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001232 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 return;
1234 }
1235}
1236#endif
1237
1238
1239/**
1240 * \brief Validate an ADDBA Req from peer with respect
1241 * to our own BA configuration
1242 *
1243 * \sa __limValidateAddBAParameterSet
1244 *
1245 * \param pMac The global tpAniSirGlobal object
1246 *
1247 * \param baParameterSet The ADDBA Parameter Set.
1248 *
1249 * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
1250 * delBAFlag is set when entry already exists.
1251 *
1252 * \param reqType ADDBA Req v/s ADDBA Rsp
1253 * 1 - ADDBA Req
1254 * 0 - ADDBA Rsp
1255 *
1256 * \return eSIR_SUCCESS if setup completes successfully
1257 * eSIR_FAILURE is some problem is encountered
1258 */
1259
1260static tSirMacStatusCodes
1261__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
1262 tpDphHashNode pSta,
1263 tDot11fFfAddBAParameterSet baParameterSet,
1264 tANI_U8 dialogueToken,
1265 tLimAddBaValidationReqType reqType ,
1266 tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
1267{
1268 if(baParameterSet.tid >= STACFG_MAX_TC)
1269 {
1270 return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
1271 }
1272
1273 //check if there is already a BA session setup with this STA/TID while processing AddBaReq
1274 if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
1275 (LIM_ADDBA_REQ == reqType))
1276 {
1277 //There is already BA session setup for STA/TID.
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001278 limLog( pMac, LOGE,
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
1280 pSta->staIndex, baParameterSet.tid);
1281 limPrintMacAddr( pMac, pSta->staAddr, LOGW );
1282
1283 if(pDelBAFlag)
1284 *pDelBAFlag = true;
1285 }
1286 return eSIR_MAC_SUCCESS_STATUS;
1287}
1288
1289/**
1290 * \brief Validate a DELBA Ind from peer with respect
1291 * to our own BA configuration
1292 *
1293 * \sa __limValidateDelBAParameterSet
1294 *
1295 * \param pMac The global tpAniSirGlobal object
1296 *
1297 * \param baParameterSet The DELBA Parameter Set.
1298 *
1299 * \param pSta Runtime, STA-related configuration cached
1300 * in the HashNode object
1301 *
1302 * \return eSIR_SUCCESS if setup completes successfully
1303 * eSIR_FAILURE is some problem is encountered
1304 */
1305static tSirMacStatusCodes
1306__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
1307 tDot11fFfDelBAParameterSet baParameterSet,
1308 tpDphHashNode pSta )
1309{
1310tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
1311
Sen, Devendra5c3834a2017-06-01 17:17:10 +05301312 if (!(baParameterSet.tid < STACFG_MAX_TC))
1313 return statusCode;
1314
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 // Validate if a BA is active for the requested TID
1316 if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
1317 pSta->tcCfg[baParameterSet.tid].fUseBARx )
1318 {
1319 statusCode = eSIR_MAC_SUCCESS_STATUS;
1320
1321 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001322 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 }
1324 else
1325 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001326 FL("Received an INVALID DELBA Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 baParameterSet.tid );
1328
1329 return statusCode;
1330}
1331
1332/**
1333 * \brief Process an ADDBA REQ
1334 *
1335 * \sa limProcessAddBAReq
1336 *
1337 * \param pMac The global tpAniSirGlobal object
1338 *
1339 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1340 *
1341 * \return none
1342 *
1343 */
1344static void
1345__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1346{
1347 tDot11fAddBAReq frmAddBAReq;
1348 tpSirMacMgmtHdr pHdr;
1349 tpDphHashNode pSta;
1350 tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
1351 tANI_U16 aid;
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +05301352 tANI_U32 frameLen, nStatus,val, val1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 tANI_U8 *pBody;
1354 tANI_U8 delBAFlag =0;
1355
1356 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1357 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1358 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001359 val = 0;
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +05301360 val1 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001361
1362 // Unpack the received frame
1363 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1364 if( DOT11F_FAILED( nStatus ))
1365 {
1366 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001367 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 nStatus,
1369 frameLen );
1370
1371 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1372
1373 // Without an unpacked request we cannot respond, so silently ignore the request
1374 return;
1375 }
1376 else if ( DOT11F_WARNED( nStatus ) )
1377 {
1378 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001379 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001380 nStatus,
1381 frameLen );
1382
1383 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1384 }
1385
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001386 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1387
Yeshwanth Sriram Guntuka5d3cad32018-09-27 13:44:37 +05301388 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid,
1389 &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 if( pSta == NULL )
1391 {
1392 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001393 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001394 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001395
1396 // FIXME - Should we do this?
1397 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1398 goto returnAfterError;
1399 }
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301400 limLog( pMac, LOG1, FL( "ADDBA Req from STA "MAC_ADDRESS_STR " with AID %d"
1401 " tid = %d policy = %d buffsize = %d"
1402 " amsduSupported = %d"), MAC_ADDR_ARRAY(pHdr->sa),
1403 aid, frmAddBAReq.AddBAParameterSet.tid,
1404 frmAddBAReq.AddBAParameterSet.policy,
1405 frmAddBAReq.AddBAParameterSet.bufferSize,
1406 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07001407
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301408 limLog( pMac, LOG1, FL( "ssn = %d fragNumber = %d" ),
1409 frmAddBAReq.BAStartingSequenceControl.ssn,
1410 frmAddBAReq.BAStartingSequenceControl.fragNumber);
1411
Jeff Johnson295189b2012-06-20 16:38:30 -07001412#ifdef WLAN_SOFTAP_VSTA_FEATURE
1413 // we can only do BA on "hard" STAs
1414 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1415 {
1416 status = eSIR_MAC_REQ_DECLINED_STATUS;
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +05301417 limLog( pMac, LOG1,
1418 FL( "ta Id is not HW Sta Id, Status code is %d " ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 goto returnAfterError;
1420 }
1421#endif //WLAN_SOFTAP_VSTA_FEATURE
1422
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +05301423 if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_TX_RX_AGGREGATION, &val1) !=
1424 eSIR_SUCCESS)
1425 {
1426 limLog(pMac, LOGE,
1427 FL("Unable to get WNI_CFG_ENABLE_TX_RX_AGGREGATION"));
1428 val1 = 1;
1429 }
1430 if (!val1)
1431 {
1432 limLog(pMac, LOGE,
1433 FL("aggregation disabled - ignoring ADDBA"));
1434 goto returnAfterError;
1435 }
1436
c_hpothu3ba2a512014-08-06 14:02:54 +05301437 if (wlan_cfgGetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, &val) !=
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001438 eSIR_SUCCESS)
1439 {
1440 limLog(pMac, LOGE,
c_hpothu3ba2a512014-08-06 14:02:54 +05301441 FL("Unable to get WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC"));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001442 val = 0;
1443 }
1444 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1445 val)
1446 {
1447 limLog( pMac, LOGW,
1448 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1449 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1450
1451 status = eSIR_MAC_REQ_DECLINED_STATUS;
1452 goto returnAfterError;
1453 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001454
1455 // Now, validate the ADDBA Req
1456 if( eSIR_MAC_SUCCESS_STATUS !=
1457 (status = __limValidateAddBAParameterSet( pMac, pSta,
1458 frmAddBAReq.AddBAParameterSet,
1459 0, //dialogue token is don't care in request validation.
1460 LIM_ADDBA_REQ, &delBAFlag)))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301461 {
1462 limLog( pMac, LOGE,
1463 FL( "ADDBA parameters validation failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 goto returnAfterError;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301465 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001466
1467 //BA already set, so we need to delete it before adding new one.
1468 if(delBAFlag)
1469 {
1470 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1471 pSta,
1472 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1473 eBA_RECIPIENT,psessionEntry))
1474 {
1475 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301476 limLog( pMac, LOGE,
1477 FL( "Deletion of Existing BA session failed with status %d" ),
1478 status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 goto returnAfterError;
1480 }
1481 }
1482
1483 // Check if the ADD BA Declined configuration is Disabled
1484 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001485 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 frmAddBAReq.AddBAParameterSet.tid);
1487 status = eSIR_MAC_REQ_DECLINED_STATUS;
1488 goto returnAfterError;
1489 }
1490
1491 //
1492 // Post WDA_ADDBA_REQ to HAL.
1493 // If HAL/HDD decide to allow this ADDBA Req session,
1494 // then this BA session is termed active
1495 //
1496
1497 // Change the Block Ack state of this STA to wait for
1498 // ADDBA Rsp from HAL
1499 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001500
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001501 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001502 {
1503 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001504 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001505 }
1506
1507
1508 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1509 {
1510 frmAddBAReq.AddBAParameterSet.bufferSize =
1511 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1512 }
1513 else
1514 {
1515 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1516 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001517 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001518 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001519
1520 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1521 pSta,
1522 (tANI_U8) frmAddBAReq.DialogToken.token,
1523 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1524 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1525 frmAddBAReq.AddBAParameterSet.bufferSize,
1526 frmAddBAReq.BATimeout.timeout,
1527 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1528 eBA_RECIPIENT,psessionEntry))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301529 {
1530 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1531 limLog( pMac, LOGE,
1532 FL( "Request to setup new BA session with peer "
1533 " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
1534 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 else
1536 return;
1537
1538returnAfterError:
1539
1540 //
1541 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1542 // status code. MLME will then send an ADDBA RSP
1543 // over the air to the peer MAC entity
1544 //
1545 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1546 pHdr->sa,
1547 status,
1548 frmAddBAReq.DialogToken.token,
1549 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1550 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1551 frmAddBAReq.AddBAParameterSet.bufferSize,
1552 frmAddBAReq.BATimeout.timeout,psessionEntry))
1553 {
1554 limLog( pMac, LOGW,
1555 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1556 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1557 }
1558
1559}
1560
1561/**
1562 * \brief Process an ADDBA RSP
1563 *
1564 * \sa limProcessAddBARsp
1565 *
1566 * \param pMac The global tpAniSirGlobal object
1567 *
1568 * \param pRxPacketInfo Handle to the packet info structure from HDD
1569 *
1570 * \return none
1571 *
1572 */
1573static void
1574__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1575{
1576tDot11fAddBARsp frmAddBARsp;
1577tpSirMacMgmtHdr pHdr;
1578tpDphHashNode pSta;
1579tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1580tANI_U16 aid;
1581tANI_U32 frameLen, nStatus;
1582tANI_U8 *pBody;
1583
1584 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1585 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1586 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1587
1588 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1589 if( pSta == NULL )
1590 {
1591 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001592 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1594 return;
1595 }
1596
1597#ifdef WLAN_SOFTAP_VSTA_FEATURE
1598 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1599 // Request, so we should never be processing a ADDBA Response
1600 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1601 {
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301602 limLog( pMac, LOGE, FL( "Sta Id is not HW Sta Id " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 return;
1604 }
1605#endif //WLAN_SOFTAP_VSTA_FEATURE
1606
1607 // Unpack the received frame
1608 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1609 if( DOT11F_FAILED( nStatus ))
1610 {
1611 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001612 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 nStatus,
1614 frameLen );
1615
1616 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1617 goto returnAfterError;
1618 }
1619 else if ( DOT11F_WARNED( nStatus ) )
1620 {
1621 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001622 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 nStatus,
1624 frameLen );
1625
1626 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1627 }
1628
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301629 limLog( pMac, LOG1, FL( "ADDBA Rsp from STA "MAC_ADDRESS_STR " with AID %d "
1630 "tid = %d policy = %d buffsize = %d "
1631 "amsduSupported = %d status = %d"),
1632 MAC_ADDR_ARRAY(pHdr->sa), aid,
1633 frmAddBARsp.AddBAParameterSet.tid,
1634 frmAddBARsp.AddBAParameterSet.policy,
1635 frmAddBARsp.AddBAParameterSet.bufferSize,
1636 frmAddBARsp.AddBAParameterSet.amsduSupported,
1637 frmAddBARsp.Status.status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 //if there is no matchin dialougue token then ignore the response.
1639
1640 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1641 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1642 {
Abhishek Singh6f09e702016-01-28 15:15:04 +05301643 limLog(pMac, LOGE,
1644 FL("dialogueToken in received addBARsp did not match with outstanding requests"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 return;
1646 }
1647
1648 // Check first if the peer accepted the ADDBA Req
1649 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1650 {
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301651 tANI_U32 val;
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301652 pMac->lim.staBaInfo[pSta->staIndex].
1653 failed_count[frmAddBARsp.AddBAParameterSet.tid] = 0;
1654 pMac->lim.staBaInfo[pSta->staIndex].
1655 failed_timestamp[frmAddBARsp.AddBAParameterSet.tid] = 0;
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301656 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
1657 {
1658 limLog(pMac, LOG1, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
1659 goto returnAfterError;
1660 }
1661 if (0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1662 frmAddBARsp.AddBAParameterSet.bufferSize = val;
1663 else
1664 frmAddBARsp.AddBAParameterSet.bufferSize =
1665 VOS_MIN(val, frmAddBARsp.AddBAParameterSet.bufferSize);
1666 limLog( pMac, LOG1,
1667 FL( "ADDBA RSP Buffsize = %d" ),
1668 frmAddBARsp.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 // Now, validate the ADDBA Rsp
1670 if( eSIR_MAC_SUCCESS_STATUS !=
1671 __limValidateAddBAParameterSet( pMac, pSta,
1672 frmAddBARsp.AddBAParameterSet,
1673 (tANI_U8)frmAddBARsp.DialogToken.token,
1674 LIM_ADDBA_RSP, NULL))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301675 {
1676 limLog( pMac, LOGE,
1677 FL( "ADDBA parameters validation failed" ));
1678 goto returnAfterError;
1679 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 }
1681 else
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301682 {
1683 pMac->lim.staBaInfo[pSta->staIndex].
1684 failed_count[frmAddBARsp.AddBAParameterSet.tid]++;
1685 pMac->lim.staBaInfo[pSta->staIndex].failed_timestamp[
1686 frmAddBARsp.AddBAParameterSet.tid] = jiffies_to_msecs(jiffies);
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 goto returnAfterError;
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301688 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 // Change STA state to wait for ADDBA Rsp from HAL
1690 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1691
1692 //
1693 // Post WDA_ADDBA_REQ to HAL.
1694 // If HAL/HDD decide to allow this ADDBA Rsp session,
1695 // then this BA session is termed active
1696 //
1697
1698 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1699 pSta,
1700 (tANI_U8) frmAddBARsp.DialogToken.token,
1701 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1702 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1703 frmAddBARsp.AddBAParameterSet.bufferSize,
1704 frmAddBARsp.BATimeout.timeout,
1705 0,
1706 eBA_INITIATOR,psessionEntry))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301707 {
1708 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1709 limLog( pMac, LOGE,
1710 FL( "Request to setup new BA session with peer "
1711 " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
1712 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 else
1714 return;
1715
1716returnAfterError:
1717
1718 // TODO: Do we need to signal an error status to SME,
1719 // if status != eSIR_MAC_SUCCESS_STATUS
1720
1721 // Restore STA "BA" State
1722 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1723 //
1724 // Need to send a DELBA IND to peer, who
1725 // would have setup a BA session with this STA
1726 //
1727 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1728 {
1729 //
1730 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1731 // status code. MLME will then send a DELBA IND
1732 // over the air to the peer MAC entity
1733 //
1734 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1735 pSta,
1736 eBA_INITIATOR,
1737 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1738 reasonCode, psessionEntry))
1739 {
1740 limLog( pMac, LOGW,
1741 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1742 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1743 }
1744 }
1745}
1746
1747/**
1748 * \brief Process a DELBA Indication
1749 *
1750 * \sa limProcessDelBAInd
1751 *
1752 * \param pMac The global tpAniSirGlobal object
1753 *
1754 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1755 *
1756 * \return none
1757 *
1758 */
1759static void
1760__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1761{
1762tDot11fDelBAInd frmDelBAInd;
1763tpSirMacMgmtHdr pHdr;
1764tpDphHashNode pSta;
1765tANI_U16 aid;
1766tANI_U32 frameLen, nStatus;
1767tANI_U8 *pBody;
1768
1769 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1770 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1771 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1772
1773 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1774 if( pSta == NULL )
1775 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001776 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1778 return;
1779 }
1780
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001781 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001782
1783 // Unpack the received frame
1784 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1785 if( DOT11F_FAILED( nStatus ))
1786 {
1787 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001788 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001789 nStatus,
1790 frameLen );
1791
1792 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1793 return;
1794 }
1795 else if ( DOT11F_WARNED( nStatus ) )
1796 {
1797 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001798 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 nStatus,
1800 frameLen );
1801
1802 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1803 }
1804
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301805 limLog( pMac, LOG1,
1806 FL( "Received DELBA from: "MAC_ADDRESS_STR" for TID %d, Reason code %d" ),
1807 MAC_ADDR_ARRAY(pHdr->sa),
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 frmDelBAInd.DelBAParameterSet.tid,
1809 frmDelBAInd.Reason.code );
1810
1811 // Now, validate the DELBA Ind
1812 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1813 frmDelBAInd.DelBAParameterSet,
1814 pSta ))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301815 {
1816 limLog( pMac, LOGE,
1817 FL( "ADDBA parameters validation failed " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 return;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301819 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 //
1821 // Post WDA_DELBA_IND to HAL and delete the
1822 // existing BA session
1823 //
1824 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1825 // is kind of confusing...
1826 //
1827 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1828 pSta,
1829 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1830 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1831 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001832 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001833
1834 return;
1835
1836}
1837
1838static void
1839__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1840{
1841
1842#if 0
1843 tpSirMacMgmtHdr pHdr;
1844 tDot11fSMPowerSave frmSMPower;
1845 tSirMacHTMIMOPowerSaveState state;
1846 tpDphHashNode pSta;
1847 tANI_U16 aid;
1848 tANI_U32 frameLen, nStatus;
1849 tANI_U8 *pBody;
1850
1851 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1852 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1853 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1854
1855 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1856 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001857 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1859 return;
1860 }
1861
1862 /**Unpack the received frame */
1863 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1864
1865 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001866 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 nStatus, frameLen );
1868 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1869 return;
1870 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001871 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 nStatus, frameLen );
1873 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1874 }
1875
1876 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1877 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1878 frmSMPower.SMPowerModeSet.Mode);
1879
1880 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1881 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1882 state = eSIR_HT_MIMO_PS_DYNAMIC;
1883 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1884 state = eSIR_HT_MIMO_PS_STATIC;
1885 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1886 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1887 else {
1888 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1889 return;
1890 }
1891
1892 if (state == pSta->htMIMOPSState) {
1893 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1894 return;
1895 }
1896
1897 /** Update in the HAL Station Table for the Update of the Protection Mode */
1898 pSta->htMIMOPSState = state;
1899 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1900
1901#endif
1902
1903}
1904
1905#if defined WLAN_FEATURE_VOWIFI
1906
1907static void
1908__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1909{
1910 tpSirMacMgmtHdr pHdr;
1911 tDot11fRadioMeasurementRequest frm;
1912 tANI_U32 frameLen, nStatus;
1913 tANI_U8 *pBody;
1914
1915 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1916 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1917 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1918
1919 if( psessionEntry == NULL )
1920 {
1921 return;
1922 }
1923
1924 /**Unpack the received frame */
1925 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1926
1927 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001928 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 nStatus, frameLen );
1930 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1931 return;
1932 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001933 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 nStatus, frameLen );
1935 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1936 }
1937
1938 // Call rrm function to handle the request.
1939
1940 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1941}
1942
1943static void
1944__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1945{
1946 tpSirMacMgmtHdr pHdr;
1947 tDot11fLinkMeasurementRequest frm;
1948 tANI_U32 frameLen, nStatus;
1949 tANI_U8 *pBody;
1950
1951 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1952 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1953 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1954
1955 if( psessionEntry == NULL )
1956 {
1957 return;
1958 }
1959
1960 /**Unpack the received frame */
1961 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1962
1963 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001964 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001965 nStatus, frameLen );
1966 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1967 return;
1968 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001969 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 nStatus, frameLen );
1971 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1972 }
1973
1974 // Call rrm function to handle the request.
1975
1976 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1977
1978}
1979
1980static void
1981__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1982{
1983 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001984 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 tANI_U32 frameLen, nStatus;
1986 tANI_U8 *pBody;
1987
1988 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1989 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1990 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1991
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301992 pFrm = vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
1993 if (NULL == pFrm)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001994 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301995 limLog(pMac, LOGE, FL("Unable to allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001996 return;
1997 }
1998
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301999 if(psessionEntry == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002000 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302001 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 return;
2003 }
2004
2005 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002006 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07002007
2008 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002009 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 nStatus, frameLen );
2011 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302012 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002013 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002015 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 nStatus, frameLen );
2017 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2018 }
2019
2020 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002021 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
2022
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302023 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002024}
2025
2026#endif
2027
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002028#ifdef WLAN_FEATURE_AP_HT40_24G
2029static void
2030__limProcess2040bssCoexistenceActionFrame(tpAniSirGlobal pMac,
2031 tANI_U16 sessionId, tANI_U8 *pRxPacketInfo,
2032 tpPESession psessionEntry)
2033{
2034 tpSirMacMgmtHdr pHdr;
2035 tANI_U8 *pBody , i;
2036 tANI_U32 frameLen, nStatus;
2037 tDot11fHT2040BSSCoexistenceManagementActionFrame *pFrm;
2038 tpSirHT2040CoexInfoInd pSirSmeHT2040CoexInfoInd = NULL;
2039 tANI_U16 length;
2040 tSirMsgQ mmhMsg;
2041 tANI_U8 num_channelList;
2042
2043 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
2044 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
2045 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
2046
2047 pFrm =
2048 vos_mem_malloc(sizeof(tDot11fHT2040BSSCoexistenceManagementActionFrame));
2049
2050 if (NULL == pFrm)
2051 {
2052 limLog(pMac, LOGE, FL("Unable to allocate memory"));
2053 return;
2054 }
2055
2056 if(psessionEntry == NULL)
2057 {
2058 vos_mem_free(pFrm);
2059 return;
2060 }
2061
2062 /**Unpack the received frame */
2063 nStatus = dot11fUnpackHT2040BSSCoexistenceManagementActionFrame( pMac,
2064 pBody, frameLen, pFrm );
2065
2066 if( DOT11F_FAILED( nStatus ))
2067 {
2068 limLog( pMac, LOGE, FL( "Failed to unpack and parse a 20/40"
2069 "Coex Action Frame (0x%08x, %d bytes):"),
2070 nStatus, frameLen );
2071 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2072 vos_mem_free(pFrm);
2073 return;
2074 }
2075 else if ( DOT11F_WARNED( nStatus ))
2076 {
2077 limLog(pMac, LOGW, FL( "There were warnings while unpacking a"
2078 " 20/40 Coex Action Frame (0x%08x, %d bytes):"),
2079 nStatus, frameLen );
2080 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2081 }
2082
2083 num_channelList = pFrm->HT2040BSSIntolerantReport.num_channelList;
2084
2085 if (num_channelList > 0)
2086 {
2087 length = (sizeof(tSirHT2040CoexInfoInd) - sizeof(tANI_U8) +
2088 (num_channelList * sizeof(tANI_U8)));
2089 }
2090 else
2091 length = sizeof(tSirHT2040CoexInfoInd);
2092
2093 limLog(pMac, LOGW,FL("tSirHT2040CoexInfoInd: Length: %d"),length);
2094
2095 pSirSmeHT2040CoexInfoInd = vos_mem_malloc(length);
2096
2097 if (NULL == pSirSmeHT2040CoexInfoInd)
2098 {
2099 limLog(pMac, LOGP,
2100 FL("AllocateMemory failed for eWNI_SME_2040_COEX_IND"));
2101 vos_mem_free(pFrm);
2102 return;
2103 }
2104
2105 vos_mem_set((void*)pSirSmeHT2040CoexInfoInd, length, 0);
2106
2107 pSirSmeHT2040CoexInfoInd->messageType = eWNI_SME_2040_COEX_IND;
2108 pSirSmeHT2040CoexInfoInd->sessionId = sessionId;
2109 pSirSmeHT2040CoexInfoInd->length = length;
2110
2111 if (pFrm->HT2040BSSCoexistence.present)
2112 {
2113
2114 limLog(pMac, LOGW, FL("infoRequest: %d fortyMHzIntolerant: %d"
2115 " twentyMHzBssWidthReq: %d obssScanExemptionReq: %d"
2116 " obssScanExemptionGrant: %d "),
2117 pFrm->HT2040BSSCoexistence.infoRequest,
2118 pFrm->HT2040BSSCoexistence.fortyMHzIntolerant,
2119 pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq,
2120 pFrm->HT2040BSSCoexistence.obssScanExemptionReq,
2121 pFrm->HT2040BSSCoexistence.obssScanExemptionGrant);
2122
2123 pSirSmeHT2040CoexInfoInd->HT40MHzIntolerant =
2124 pFrm->HT2040BSSCoexistence.fortyMHzIntolerant;
2125 pSirSmeHT2040CoexInfoInd->HT20MHzBssWidthReq =
2126 pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq;
2127 }
2128
2129 if (pFrm->HT2040BSSIntolerantReport.present)
2130 {
2131 limLog(pMac, LOGW, FL("operatingClass: %d num_channelList: %d "),
2132 pFrm->HT2040BSSIntolerantReport.operatingClass,
2133 num_channelList);
2134
2135 if (num_channelList > 0)
2136 {
2137 vos_mem_zero(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
2138 num_channelList);
2139 vos_mem_copy(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
2140 pFrm->HT2040BSSIntolerantReport.channelList,
2141 num_channelList);
2142
2143 pSirSmeHT2040CoexInfoInd->channel_num = num_channelList;
2144 }
2145
2146 for(i=0; i < num_channelList; i++)
2147 {
2148 limLog(pMac, LOGW, FL("Channel : %d "),
2149 pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i]);
2150 }
2151 }
2152
2153 mmhMsg.type = eWNI_SME_2040_COEX_IND;
2154 mmhMsg.bodyptr = pSirSmeHT2040CoexInfoInd;
2155 mmhMsg.bodyval = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302156 limLog(pMac, LOGW, FL("Posting eWNI_SME_2040_COEX_IND Message to SME "));
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002157 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2158
2159 vos_mem_free(pFrm);
2160}
2161#endif
2162
Jeff Johnson295189b2012-06-20 16:38:30 -07002163#ifdef WLAN_FEATURE_11W
2164/**
Chet Lanctot186b5732013-03-18 10:26:30 -07002165 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 *
2167 *FUNCTION:
2168 * This function is called by limProcessActionFrame() upon
2169 * SA query request Action frame reception.
2170 *
2171 *LOGIC:
2172 *
2173 *ASSUMPTIONS:
2174 *
2175 *NOTE:
2176 *
2177 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07002178 * @param *pRxPacketInfo - Handle to the Rx packet info
2179 * @param psessionEntry - PE session entry
2180 *
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 * @return None
2182 */
Chet Lanctot186b5732013-03-18 10:26:30 -07002183static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002184{
2185 tpSirMacMgmtHdr pHdr;
2186 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002187 tANI_U8 transId[2];
Sourav Mohapatraf4105f72019-02-28 14:58:17 +05302188 uint32_t frame_len;
Jeff Johnson295189b2012-06-20 16:38:30 -07002189
2190 /* Prima --- Below Macro not available in prima
2191 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
2192 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
2193
2194 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2195 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Sourav Mohapatraf4105f72019-02-28 14:58:17 +05302196 frame_len = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07002197
Sourav Mohapatraf4105f72019-02-28 14:58:17 +05302198 if (frame_len < sizeof(struct sDot11fSaQueryReq)) {
2199 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
2200 ("Invalid frame length"));
2201 return;
2202 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002203 /* If this is an unprotected SA Query Request, then ignore it. */
2204 if (pHdr->fc.wep == 0)
2205 return;
2206
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 /*Extract 11w trsansId from SA query request action frame
2208 In SA query response action frame we will send same transId
2209 In SA query request action frame:
2210 Category : 1 byte
2211 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07002212 Transaction ID : 2 bytes */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302213 vos_mem_copy(&transId[0], &pBody[2], 2);
Jeff Johnson295189b2012-06-20 16:38:30 -07002214
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 //Send 11w SA query response action frame
2216 if (limSendSaQueryResponseFrame(pMac,
2217 transId,
2218 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
2219 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002220 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 return;
2222 }
2223}
2224
Chet Lanctot186b5732013-03-18 10:26:30 -07002225/**
2226 * __limProcessSAQueryResponseActionFrame
2227 *
2228 *FUNCTION:
2229 * This function is called by limProcessActionFrame() upon
2230 * SA query response Action frame reception.
2231 *
2232 *LOGIC:
2233 *
2234 *ASSUMPTIONS:
2235 *
2236 *NOTE:
2237 *
2238 * @param pMac - Pointer to Global MAC structure
2239 * @param *pRxPacketInfo - Handle to the Rx packet info
2240 * @param psessionEntry - PE session entry
2241 * @return None
2242 */
2243static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
2244{
2245 tpSirMacMgmtHdr pHdr;
Chet Lanctot8cecea22014-02-11 19:09:36 -08002246 tANI_U8 *pBody;
2247 tpDphHashNode pSta;
2248 tANI_U16 aid;
2249 tANI_U16 transId;
2250 tANI_U8 retryNum;
Sourav Mohapatraf4105f72019-02-28 14:58:17 +05302251 uint32_t frame_len;
Chet Lanctot186b5732013-03-18 10:26:30 -07002252
2253 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Chet Lanctot8cecea22014-02-11 19:09:36 -08002254 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Sourav Mohapatraf4105f72019-02-28 14:58:17 +05302255 frame_len = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Chet Lanctot186b5732013-03-18 10:26:30 -07002256 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2257 ("SA Query Response received...")) ;
Chet Lanctot186b5732013-03-18 10:26:30 -07002258
Sourav Mohapatraf4105f72019-02-28 14:58:17 +05302259 if (frame_len < sizeof(struct sDot11fSaQueryRsp)) {
2260 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
2261 ("Invalid frame length"));
2262 return;
2263 }
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07002264 /* When a station, supplicant handles SA Query Response.
2265 Forward to SME to HDD to wpa_supplicant. */
2266 if (eLIM_STA_ROLE == psessionEntry->limSystemRole)
2267 {
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302268 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302269 pRxPacketInfo, psessionEntry,
2270 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07002271 return;
2272 }
2273
Chet Lanctot8cecea22014-02-11 19:09:36 -08002274 /* If this is an unprotected SA Query Response, then ignore it. */
2275 if (pHdr->fc.wep == 0)
2276 return;
2277
2278 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2279 if (NULL == pSta)
2280 return;
2281
2282 limLog(pMac, LOG1,
2283 FL("SA Query Response source addr - %0x:%0x:%0x:%0x:%0x:%0x"),
2284 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
2285 pHdr->sa[4], pHdr->sa[5]);
2286 limLog(pMac, LOG1,
2287 FL("SA Query state for station - %d"), pSta->pmfSaQueryState);
2288
2289 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
2290 return;
2291
2292 /* Extract 11w trsansId from SA query reponse action frame
2293 In SA query response action frame:
2294 Category : 1 byte
2295 Action : 1 byte
2296 Transaction ID : 2 bytes */
2297 vos_mem_copy(&transId, &pBody[2], 2);
2298
2299 /* If SA Query is in progress with the station and the station
2300 responds then the association request that triggered the SA
2301 query is from a rogue station, just go back to initial state. */
2302 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
2303 if (transId == pSta->pmfSaQueryStartTransId + retryNum)
2304 {
2305 limLog(pMac, LOG1,
2306 FL("Found matching SA Query Request - transaction ID %d"), transId);
2307 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
2308 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
2309 break;
2310 }
2311}
Jeff Johnson295189b2012-06-20 16:38:30 -07002312#endif
2313
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002314#ifdef WLAN_FEATURE_11W
2315/**
2316 * limDropUnprotectedActionFrame
2317 *
2318 *FUNCTION:
2319 * This function checks if an Action frame should be dropped since it is
2320 * a Robust Managment Frame, it is unprotected, and it is received on a
2321 * connection where PMF is enabled.
2322 *
2323 *LOGIC:
2324 *
2325 *ASSUMPTIONS:
2326 *
2327 *NOTE:
2328 *
2329 * @param pMac - Global MAC structure
2330 * @param psessionEntry - PE session entry
2331 * @param pHdr - Frame header
2332 * @param category - Action frame category
2333 * @return TRUE if frame should be dropped
2334 */
2335
2336static tANI_BOOLEAN
2337limDropUnprotectedActionFrame (tpAniSirGlobal pMac, tpPESession psessionEntry,
2338 tpSirMacMgmtHdr pHdr, tANI_U8 category)
2339{
2340 tANI_U16 aid;
2341 tpDphHashNode pStaDs;
2342 tANI_BOOLEAN rmfConnection = eANI_BOOLEAN_FALSE;
2343
2344 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
2345 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
2346 {
2347 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2348 if (pStaDs != NULL)
2349 if (pStaDs->rmfEnabled)
2350 rmfConnection = eANI_BOOLEAN_TRUE;
2351 }
2352 else if (psessionEntry->limRmfEnabled)
2353 rmfConnection = eANI_BOOLEAN_TRUE;
2354
2355 if (rmfConnection && (pHdr->fc.wep == 0))
2356 {
2357 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2358 "since RMF is enabled."), category);)
2359 return eANI_BOOLEAN_TRUE;
2360 }
2361 else
2362 return eANI_BOOLEAN_FALSE;
2363}
2364#endif
2365
Jeff Johnson295189b2012-06-20 16:38:30 -07002366/**
2367 * limProcessActionFrame
2368 *
2369 *FUNCTION:
2370 * This function is called by limProcessMessageQueue() upon
2371 * Action frame reception.
2372 *
2373 *LOGIC:
2374 *
2375 *ASSUMPTIONS:
2376 *
2377 *NOTE:
2378 *
2379 * @param pMac - Pointer to Global MAC structure
2380 * @param *pRxPacketInfo - A pointer to packet info structure
2381 * @return None
2382 */
2383
2384void
2385limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2386{
2387 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2388 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
sheenam monga5307dd92020-01-10 15:19:11 +05302389 tANI_U8 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Chet Lanctot186b5732013-03-18 10:26:30 -07002390 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05302391
sheenam monga5307dd92020-01-10 15:19:11 +05302392 if (frameLen < sizeof(*pActionHdr)) {
2393 limLog(pMac, LOGE,
2394 FL("frame_len %d less than Action Frame Hdr size"),
2395 frameLen);
2396 return;
2397 }
2398
2399#ifdef WLAN_FEATURE_11W
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05302400 if (lim_is_robust_mgmt_action_frame(pActionHdr->category) &&
2401 limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr,
2402 pActionHdr->category)) {
2403 limLog(pMac, LOGE,
2404 FL("Don't send unprotect action frame to upper layer categ %d "),
2405 pActionHdr->category);
2406 return;
2407 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002408#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002409
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 switch (pActionHdr->category)
2411 {
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05302412
2413 /*
2414 * WARNING: If you add Action frame category case here, set the
2415 * corresponding bit to 1 in sme_set_allowed_action_frames() for
2416 * the FW to hand over that frame to host without dropping itself
2417 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 case SIR_MAC_ACTION_QOS_MGMT:
Leela Venkata Kiran Kumar Reddy Chiralac7c4e7e2014-04-29 10:50:16 -07002419 if ( (psessionEntry->limQosEnabled) ||
2420 (pActionHdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 {
2422 switch (pActionHdr->actionID)
2423 {
2424 case SIR_MAC_QOS_ADD_TS_REQ:
2425 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2426 break;
2427
2428 case SIR_MAC_QOS_ADD_TS_RSP:
2429 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2430 break;
2431
2432 case SIR_MAC_QOS_DEL_TS_REQ:
2433 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2434 break;
2435
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002436 case SIR_MAC_QOS_MAP_CONFIGURE:
2437 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2438 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002439 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302440 limLog(pMac, LOG1,
2441 FL("Qos action %d not handled"),
2442 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 break;
2444 }
2445 break ;
2446 }
2447
2448 break;
2449
2450 case SIR_MAC_ACTION_SPECTRUM_MGMT:
2451 switch (pActionHdr->actionID)
2452 {
2453#ifdef ANI_SUPPORT_11H
2454 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2455 if(psessionEntry->lim11hEnable)
2456 {
2457 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2458 }
2459 break;
2460
2461 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2462 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2463 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2464 {
2465 if(psessionEntry->lim11hEnable)
2466 {
2467 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2468 }
2469 }
2470 break;
2471
2472#endif
2473 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2474 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2475 {
2476 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2477 }
2478 break;
2479 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302480 limLog(pMac, LOG1,
2481 FL("Spectrum mgmt action id %d not handled"),
2482 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 break;
2484 }
2485 break;
2486
2487 case SIR_MAC_ACTION_WME:
2488 if (! psessionEntry->limWmeEnabled)
2489 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002490 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 pActionHdr->actionID);
2492 break;
2493 }
2494 switch(pActionHdr->actionID)
2495 {
2496 case SIR_MAC_QOS_ADD_TS_REQ:
2497 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2498 break;
2499
2500 case SIR_MAC_QOS_ADD_TS_RSP:
2501 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2502 break;
2503
2504 case SIR_MAC_QOS_DEL_TS_REQ:
2505 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2506 break;
2507
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002508 case SIR_MAC_QOS_MAP_CONFIGURE:
2509 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2510 break;
2511
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302513 limLog(pMac, LOG1, FL("WME action %d not handled"),
2514 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 break;
2516 }
2517 break;
2518
2519 case SIR_MAC_ACTION_BLKACK:
2520 // Determine the "type" of BA Action Frame
2521 switch(pActionHdr->actionID)
2522 {
2523 case SIR_MAC_BLKACK_ADD_REQ:
2524 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2525 break;
2526
2527 case SIR_MAC_BLKACK_ADD_RSP:
2528 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2529 break;
2530
2531 case SIR_MAC_BLKACK_DEL:
2532 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2533 break;
2534
2535 default:
2536 break;
2537 }
2538
2539 break;
2540 case SIR_MAC_ACTION_HT:
2541 /** Type of HT Action to be performed*/
2542 switch(pActionHdr->actionID) {
2543 case SIR_MAC_SM_POWER_SAVE:
2544 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2545 break;
2546 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302547 limLog(pMac, LOG1,
2548 FL("Action ID %d not handled in HT Action category"),
2549 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 break;
2551 }
2552 break;
2553
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002554 case SIR_MAC_ACTION_WNM:
2555 {
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002556 PELOGE(limLog(pMac, LOG1, FL("WNM Action category %d action %d."),
2557 pActionHdr->category, pActionHdr->actionID);)
2558 switch (pActionHdr->actionID)
2559 {
2560 case SIR_MAC_WNM_BSS_TM_QUERY:
2561 case SIR_MAC_WNM_BSS_TM_REQUEST:
2562 case SIR_MAC_WNM_BSS_TM_RESPONSE:
2563 case SIR_MAC_WNM_NOTIF_REQUEST:
2564 case SIR_MAC_WNM_NOTIF_RESPONSE:
2565 {
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002566 tANI_S8 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002567 /* Forward to the SME to HDD to wpa_supplicant */
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302568 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2569 pRxPacketInfo,
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002570 psessionEntry, rssi);
2571 break;
2572 }
2573 }
2574 break;
2575 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002576#if defined WLAN_FEATURE_VOWIFI
2577 case SIR_MAC_ACTION_RRM:
Abhishek Singhe0bc0992016-05-20 17:58:18 +05302578 /* Ignore RRM measurement request until DHCP is set */
2579 if(pMac->rrm.rrmPEContext.rrmEnable &&
2580 pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done)
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 {
2582 switch(pActionHdr->actionID) {
2583 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2584 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2585 break;
2586 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2587 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2588 break;
2589 case SIR_MAC_RRM_NEIGHBOR_RPT:
2590 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2591 break;
2592 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302593 limLog( pMac, LOG1, FL("Action ID %d not handled in RRM"),
2594 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 break;
2596
2597 }
2598 }
2599 else
2600 {
2601 // Else we will just ignore the RRM messages.
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302602 limLog( pMac, LOG1,
Abhishek Singhe0bc0992016-05-20 17:58:18 +05302603 FL("RRM Action frame ignored as rrmEnable is %d or DHCP not completed %d"),
2604 pMac->rrm.rrmPEContext.rrmEnable,
2605 pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done);
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 }
2607 break;
2608#endif
Abhishek Singh00b71972016-01-07 10:51:04 +05302609#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) \
2610 || defined (WLAN_FEATURE_RMC)
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002611 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2612 {
2613 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002614 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2615
sheenam monga5307dd92020-01-10 15:19:11 +05302616 if(frameLen < sizeof(*pVendorSpecific)) {
2617 limLog(pMac, LOGE,
2618 FL("frame len %d less than Vendor Specific Hdr len"), frameLen);
2619 break;
2620 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002621
2622 //Check if it is a vendor specific action frame.
2623 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302624 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002625 &pHdr->da[0], sizeof(tSirMacAddr))) &&
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002626 IS_WES_MODE_ENABLED(pMac) &&
2627 vos_mem_compare(pVendorSpecific->Oui, Oui, 3))
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002628 {
2629 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2630 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2631 /* Forward to the SME to HDD to wpa_supplicant */
2632 // type is ACTION
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302633 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2634 pRxPacketInfo,
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302635 psessionEntry, 0);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002636 }
Abhishek Singh00b71972016-01-07 10:51:04 +05302637#if defined (WLAN_FEATURE_RMC)
2638 else if ((eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole) &&
2639 ((VOS_TRUE == vos_mem_compare(SIR_MAC_RMC_MCAST_ADDRESS,
2640 &pHdr->da[0], sizeof(tSirMacAddr))) ||
2641 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
2642 &pHdr->da[0], sizeof(tSirMacAddr)))) &&
2643 vos_mem_compare(pVendorSpecific->Oui, SIR_MAC_RMC_OUI, 3))
2644 {
2645 tANI_U8 MagicCode[] =
2646 { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e };
2647 tpSirMacIbssExtNetworkFrameHdr pIbssExtHdr =
2648 (tpSirMacIbssExtNetworkFrameHdr) pActionHdr;
2649
2650 if (vos_mem_compare(pIbssExtHdr->MagicCode,
2651 MagicCode, sizeof(MagicCode)) &&
2652 pIbssExtHdr->version == SIR_MAC_RMC_VER )
2653 {
2654 switch (pIbssExtHdr->actionID)
2655 {
2656 default:
2657 PELOGE(limLog(pMac, LOGE,
2658 FL("Action RMC actionID %d not handled"),
2659 pIbssExtHdr->actionID);)
2660 break;
2661 case SIR_MAC_RMC_RULER_INFORM_SELECTED:
2662 limLog(pMac, LOG1,
2663 FL("Action RMC RULER_INFORM_SELECTED."));
2664 limProcessRMCMessages(pMac,
2665 eLIM_RMC_OTA_RULER_INFORM_SELECTED,
2666 (tANI_U32 *)pRxPacketInfo);
2667 break;
2668 case SIR_MAC_RMC_RULER_INFORM_CANCELLED:
2669 limLog(pMac, LOG1,
2670 FL("Action RMC RULER_INFORM_CANCELLED."));
2671 limProcessRMCMessages(pMac,
2672 eLIM_RMC_OTA_RULER_INFORM_CANCELLED,
2673 (tANI_U32 *)pRxPacketInfo);
2674 break;
2675 }
2676 }
2677 else
2678 {
2679 limLog( pMac, LOG1,
2680 FL("Dropping the vendor specific action frame in IBSS "
2681 "mode because of Ibss Ext Magic mismatch "
2682 MAC_ADDRESS_STR " or Version mismatch = %d"),
2683 MAC_ADDR_ARRAY(pIbssExtHdr->MagicCode),
2684 pIbssExtHdr->version );
2685 }
2686 }
2687#endif /* WLAN_FEATURE_RMC */
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002688 else
2689 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302690 limLog( pMac, LOG1,
2691 FL("Dropping the vendor specific action frame because of( "
2692 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
2693 "not received with SelfSta Mac address) system role = %d"),
2694 IS_WES_MODE_ENABLED(pMac),
2695 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2696 pVendorSpecific->Oui[2],
2697 psessionEntry->limSystemRole );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002698 }
2699 }
2700 break;
Abhishek Singh00b71972016-01-07 10:51:04 +05302701#endif /* WLAN_FEATURE_VOWIFI_11R || FEATURE_WLAN_ESE ||
2702 FEATURE_WLAN_LFR || WLAN_FEATURE_RMC */
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 case SIR_MAC_ACTION_PUBLIC_USAGE:
2704 switch(pActionHdr->actionID) {
2705 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2706 {
2707 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302709
sheenam monga5307dd92020-01-10 15:19:11 +05302710 if (frameLen < sizeof(*pActionHdr)) {
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302711 limLog(pMac, LOG1,
sheenam monga5307dd92020-01-10 15:19:11 +05302712 FL("Received action frame of invalid len %d"), frameLen);
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302713 break;
2714 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002715
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302717 if (vos_mem_compare(pPubAction->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 {
2719 /* Forward to the SME to HDD to wpa_supplicant */
2720 // type is ACTION
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302721 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2722 pRxPacketInfo,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302723 psessionEntry,
2724 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 }
2726 else
2727 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302728 limLog( pMac, LOG1,
2729 FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
2730 pPubAction->Oui[0], pPubAction->Oui[1],
2731 pPubAction->Oui[2], pPubAction->Oui[3] );
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 }
2733 }
2734 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002735#ifdef WLAN_FEATURE_AP_HT40_24G
2736 case SIR_MAC_ACTION_2040_BSS_COEXISTENCE:
2737 {
2738 if (pMac->roam.configParam.apHT40_24GEnabled)
2739 {
2740 limLog( pMac, LOGW, FL("Public Action 20/40 BSS"
2741 "Coexistence Management frame"));
2742
2743 __limProcess2040bssCoexistenceActionFrame(pMac,
2744 psessionEntry->smeSessionId, (tANI_U8 *) pRxPacketInfo,
2745 psessionEntry);
2746 }
2747 break;
2748 }
2749#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002750#ifdef FEATURE_WLAN_TDLS
2751 case SIR_MAC_TDLS_DIS_RSP:
2752 {
Chilam NG571c65a2013-01-19 12:27:36 +05302753 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002754
Chilam NG571c65a2013-01-19 12:27:36 +05302755 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002756 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002757 ("Public Action TDLS Discovery RSP ..")) ;
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302758 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2759 pRxPacketInfo,
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302760 psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002761 }
2762 break;
2763#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302764 case SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID:
2765 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2766 {
2767 lim_process_ecsa_action_frame(pMac,
2768 pRxPacketInfo, psessionEntry);
2769 }
2770 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302772 limLog(pMac, LOG1, FL("Unhandled public action frame -- %x "),
2773 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 break;
2775 }
2776 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002777
2778#ifdef WLAN_FEATURE_11W
2779 case SIR_MAC_ACTION_SA_QUERY:
2780 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002781 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
2782 switch (pActionHdr->actionID)
2783 {
2784 case SIR_MAC_SA_QUERY_REQ:
2785 /**11w SA query request action frame received**/
2786 /* Respond directly to the incoming request in LIM */
2787 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2788 break;
2789 case SIR_MAC_SA_QUERY_RSP:
2790 /**11w SA query response action frame received**/
Chet Lanctot8cecea22014-02-11 19:09:36 -08002791 /* Handle based on the current SA Query state */
Chet Lanctot186b5732013-03-18 10:26:30 -07002792 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2793 break;
2794 default:
2795 break;
2796 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 break;
2798 }
2799#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002800#ifdef WLAN_FEATURE_11AC
2801 case SIR_MAC_ACTION_VHT:
2802 {
2803 if (psessionEntry->vhtCapability)
2804 {
2805 switch (pActionHdr->actionID)
2806 {
2807 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2808 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2809 break;
2810 default:
2811 break;
2812 }
2813 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002814 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002815 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002816#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302818 limLog(pMac, LOG1,
2819 FL("Action category %d not handled"), pActionHdr->category);
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 break;
2821 }
2822}
2823
Jeff Johnson295189b2012-06-20 16:38:30 -07002824/**
2825 * limProcessActionFrameNoSession
2826 *
2827 *FUNCTION:
2828 * This function is called by limProcessMessageQueue() upon
2829 * Action frame reception and no session.
2830 * Currently only public action frames can be received from
2831 * a non-associated station.
2832 *
2833 *LOGIC:
2834 *
2835 *ASSUMPTIONS:
2836 *
2837 *NOTE:
2838 *
2839 * @param pMac - Pointer to Global MAC structure
2840 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2841 * @return None
2842 */
2843
2844void
2845limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2846{
2847 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2848 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
sheenam monga5307dd92020-01-10 15:19:11 +05302849 tANI_U32 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07002850
Mohit Khanna23863762012-09-11 17:40:09 -07002851 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002852
sheenam monga5307dd92020-01-10 15:19:11 +05302853 if (frameLen < sizeof(*pActionHdr)) {
2854 limLog(pMac, LOGE,
2855 FL("Received action frame of invalid len %d"), frameLen);
2856 return;
2857 }
2858
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 switch ( pActionHdr->category )
2860 {
2861 case SIR_MAC_ACTION_PUBLIC_USAGE:
2862 switch(pActionHdr->actionID) {
2863 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2864 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2866
Jeff Johnson295189b2012-06-20 16:38:30 -07002867 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302868 if (vos_mem_compare(pActionHdr->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 {
2870 /* Forward to the SME to HDD to wpa_supplicant */
2871 // type is ACTION
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302872 limSendSmeMgmtFrameInd(pMac, 0, pBd, NULL,
2873 WDA_GET_RX_RSSI_DB(pBd));
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 }
2875 else
2876 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302877 limLog( pMac, LOG1,
2878 FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
2879 pActionHdr->Oui[0], pActionHdr->Oui[1],
2880 pActionHdr->Oui[2], pActionHdr->Oui[3]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 }
2882 }
2883 break;
2884 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302885 limLog(pMac, LOG1,
2886 FL("Unhandled public action frame -- %x "), pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 break;
2888 }
2889 break;
2890 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302891 limLog(pMac, LOG1,
2892 FL("Unhandled action frame without session -- %x "),
2893 pActionHdr->category);
2894 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002895
2896 }
2897}