blob: c2db0a5942f452f64a213898ddfe7153a140c383 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumar071de2d2017-02-02 20:38:03 +05302 * Copyright (c) 2012-2017 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
74
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
Yeshwanth Sriram Guntuka32935562018-08-24 15:41:18 +05301362 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid,
1363 &psessionEntry->dph.dphHashTable);
1364 if (((psessionEntry->limSystemRole == eLIM_AP_ROLE ||
1365 psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) &&
1366 pSta != NULL && !pSta->isKeyInstalled) ||
1367 !psessionEntry->isKeyInstalled) {
1368 limLog(pMac, LOGE, FL("Reject ADDBA as set_key is not done"));
1369 return;
1370 }
1371
Jeff Johnson295189b2012-06-20 16:38:30 -07001372 // Unpack the received frame
1373 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1374 if( DOT11F_FAILED( nStatus ))
1375 {
1376 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001377 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 nStatus,
1379 frameLen );
1380
1381 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1382
1383 // Without an unpacked request we cannot respond, so silently ignore the request
1384 return;
1385 }
1386 else if ( DOT11F_WARNED( nStatus ) )
1387 {
1388 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001389 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 nStatus,
1391 frameLen );
1392
1393 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1394 }
1395
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001396 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1397
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 if( pSta == NULL )
1399 {
1400 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001401 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001402 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001403
1404 // FIXME - Should we do this?
1405 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1406 goto returnAfterError;
1407 }
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301408 limLog( pMac, LOG1, FL( "ADDBA Req from STA "MAC_ADDRESS_STR " with AID %d"
1409 " tid = %d policy = %d buffsize = %d"
1410 " amsduSupported = %d"), MAC_ADDR_ARRAY(pHdr->sa),
1411 aid, frmAddBAReq.AddBAParameterSet.tid,
1412 frmAddBAReq.AddBAParameterSet.policy,
1413 frmAddBAReq.AddBAParameterSet.bufferSize,
1414 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07001415
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301416 limLog( pMac, LOG1, FL( "ssn = %d fragNumber = %d" ),
1417 frmAddBAReq.BAStartingSequenceControl.ssn,
1418 frmAddBAReq.BAStartingSequenceControl.fragNumber);
1419
Jeff Johnson295189b2012-06-20 16:38:30 -07001420#ifdef WLAN_SOFTAP_VSTA_FEATURE
1421 // we can only do BA on "hard" STAs
1422 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1423 {
1424 status = eSIR_MAC_REQ_DECLINED_STATUS;
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +05301425 limLog( pMac, LOG1,
1426 FL( "ta Id is not HW Sta Id, Status code is %d " ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 goto returnAfterError;
1428 }
1429#endif //WLAN_SOFTAP_VSTA_FEATURE
1430
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +05301431 if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_TX_RX_AGGREGATION, &val1) !=
1432 eSIR_SUCCESS)
1433 {
1434 limLog(pMac, LOGE,
1435 FL("Unable to get WNI_CFG_ENABLE_TX_RX_AGGREGATION"));
1436 val1 = 1;
1437 }
1438 if (!val1)
1439 {
1440 limLog(pMac, LOGE,
1441 FL("aggregation disabled - ignoring ADDBA"));
1442 goto returnAfterError;
1443 }
1444
c_hpothu3ba2a512014-08-06 14:02:54 +05301445 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 -07001446 eSIR_SUCCESS)
1447 {
1448 limLog(pMac, LOGE,
c_hpothu3ba2a512014-08-06 14:02:54 +05301449 FL("Unable to get WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC"));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001450 val = 0;
1451 }
1452 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1453 val)
1454 {
1455 limLog( pMac, LOGW,
1456 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1457 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1458
1459 status = eSIR_MAC_REQ_DECLINED_STATUS;
1460 goto returnAfterError;
1461 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001462
1463 // Now, validate the ADDBA Req
1464 if( eSIR_MAC_SUCCESS_STATUS !=
1465 (status = __limValidateAddBAParameterSet( pMac, pSta,
1466 frmAddBAReq.AddBAParameterSet,
1467 0, //dialogue token is don't care in request validation.
1468 LIM_ADDBA_REQ, &delBAFlag)))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301469 {
1470 limLog( pMac, LOGE,
1471 FL( "ADDBA parameters validation failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 goto returnAfterError;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301473 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001474
1475 //BA already set, so we need to delete it before adding new one.
1476 if(delBAFlag)
1477 {
1478 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1479 pSta,
1480 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1481 eBA_RECIPIENT,psessionEntry))
1482 {
1483 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301484 limLog( pMac, LOGE,
1485 FL( "Deletion of Existing BA session failed with status %d" ),
1486 status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 goto returnAfterError;
1488 }
1489 }
1490
1491 // Check if the ADD BA Declined configuration is Disabled
1492 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001493 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001494 frmAddBAReq.AddBAParameterSet.tid);
1495 status = eSIR_MAC_REQ_DECLINED_STATUS;
1496 goto returnAfterError;
1497 }
1498
1499 //
1500 // Post WDA_ADDBA_REQ to HAL.
1501 // If HAL/HDD decide to allow this ADDBA Req session,
1502 // then this BA session is termed active
1503 //
1504
1505 // Change the Block Ack state of this STA to wait for
1506 // ADDBA Rsp from HAL
1507 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001508
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001509 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001510 {
1511 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001512 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001513 }
1514
1515
1516 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1517 {
1518 frmAddBAReq.AddBAParameterSet.bufferSize =
1519 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1520 }
1521 else
1522 {
1523 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1524 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001525 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001526 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001527
1528 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1529 pSta,
1530 (tANI_U8) frmAddBAReq.DialogToken.token,
1531 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1532 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1533 frmAddBAReq.AddBAParameterSet.bufferSize,
1534 frmAddBAReq.BATimeout.timeout,
1535 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1536 eBA_RECIPIENT,psessionEntry))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301537 {
1538 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1539 limLog( pMac, LOGE,
1540 FL( "Request to setup new BA session with peer "
1541 " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
1542 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 else
1544 return;
1545
1546returnAfterError:
1547
1548 //
1549 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1550 // status code. MLME will then send an ADDBA RSP
1551 // over the air to the peer MAC entity
1552 //
1553 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1554 pHdr->sa,
1555 status,
1556 frmAddBAReq.DialogToken.token,
1557 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1558 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1559 frmAddBAReq.AddBAParameterSet.bufferSize,
1560 frmAddBAReq.BATimeout.timeout,psessionEntry))
1561 {
1562 limLog( pMac, LOGW,
1563 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1564 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1565 }
1566
1567}
1568
1569/**
1570 * \brief Process an ADDBA RSP
1571 *
1572 * \sa limProcessAddBARsp
1573 *
1574 * \param pMac The global tpAniSirGlobal object
1575 *
1576 * \param pRxPacketInfo Handle to the packet info structure from HDD
1577 *
1578 * \return none
1579 *
1580 */
1581static void
1582__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1583{
1584tDot11fAddBARsp frmAddBARsp;
1585tpSirMacMgmtHdr pHdr;
1586tpDphHashNode pSta;
1587tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1588tANI_U16 aid;
1589tANI_U32 frameLen, nStatus;
1590tANI_U8 *pBody;
1591
1592 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1593 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1594 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1595
1596 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1597 if( pSta == NULL )
1598 {
1599 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001600 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1602 return;
1603 }
1604
1605#ifdef WLAN_SOFTAP_VSTA_FEATURE
1606 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1607 // Request, so we should never be processing a ADDBA Response
1608 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1609 {
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301610 limLog( pMac, LOGE, FL( "Sta Id is not HW Sta Id " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 return;
1612 }
1613#endif //WLAN_SOFTAP_VSTA_FEATURE
1614
1615 // Unpack the received frame
1616 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1617 if( DOT11F_FAILED( nStatus ))
1618 {
1619 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001620 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 nStatus,
1622 frameLen );
1623
1624 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1625 goto returnAfterError;
1626 }
1627 else if ( DOT11F_WARNED( nStatus ) )
1628 {
1629 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001630 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 nStatus,
1632 frameLen );
1633
1634 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1635 }
1636
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301637 limLog( pMac, LOG1, FL( "ADDBA Rsp from STA "MAC_ADDRESS_STR " with AID %d "
1638 "tid = %d policy = %d buffsize = %d "
1639 "amsduSupported = %d status = %d"),
1640 MAC_ADDR_ARRAY(pHdr->sa), aid,
1641 frmAddBARsp.AddBAParameterSet.tid,
1642 frmAddBARsp.AddBAParameterSet.policy,
1643 frmAddBARsp.AddBAParameterSet.bufferSize,
1644 frmAddBARsp.AddBAParameterSet.amsduSupported,
1645 frmAddBARsp.Status.status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 //if there is no matchin dialougue token then ignore the response.
1647
1648 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1649 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1650 {
Abhishek Singh6f09e702016-01-28 15:15:04 +05301651 limLog(pMac, LOGE,
1652 FL("dialogueToken in received addBARsp did not match with outstanding requests"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 return;
1654 }
1655
1656 // Check first if the peer accepted the ADDBA Req
1657 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1658 {
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301659 tANI_U32 val;
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301660 pMac->lim.staBaInfo[pSta->staIndex].
1661 failed_count[frmAddBARsp.AddBAParameterSet.tid] = 0;
1662 pMac->lim.staBaInfo[pSta->staIndex].
1663 failed_timestamp[frmAddBARsp.AddBAParameterSet.tid] = 0;
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301664 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
1665 {
1666 limLog(pMac, LOG1, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
1667 goto returnAfterError;
1668 }
1669 if (0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1670 frmAddBARsp.AddBAParameterSet.bufferSize = val;
1671 else
1672 frmAddBARsp.AddBAParameterSet.bufferSize =
1673 VOS_MIN(val, frmAddBARsp.AddBAParameterSet.bufferSize);
1674 limLog( pMac, LOG1,
1675 FL( "ADDBA RSP Buffsize = %d" ),
1676 frmAddBARsp.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 // Now, validate the ADDBA Rsp
1678 if( eSIR_MAC_SUCCESS_STATUS !=
1679 __limValidateAddBAParameterSet( pMac, pSta,
1680 frmAddBARsp.AddBAParameterSet,
1681 (tANI_U8)frmAddBARsp.DialogToken.token,
1682 LIM_ADDBA_RSP, NULL))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301683 {
1684 limLog( pMac, LOGE,
1685 FL( "ADDBA parameters validation failed" ));
1686 goto returnAfterError;
1687 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001688 }
1689 else
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301690 {
1691 pMac->lim.staBaInfo[pSta->staIndex].
1692 failed_count[frmAddBARsp.AddBAParameterSet.tid]++;
1693 pMac->lim.staBaInfo[pSta->staIndex].failed_timestamp[
1694 frmAddBARsp.AddBAParameterSet.tid] = jiffies_to_msecs(jiffies);
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 goto returnAfterError;
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301696 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 // Change STA state to wait for ADDBA Rsp from HAL
1698 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1699
1700 //
1701 // Post WDA_ADDBA_REQ to HAL.
1702 // If HAL/HDD decide to allow this ADDBA Rsp session,
1703 // then this BA session is termed active
1704 //
1705
1706 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1707 pSta,
1708 (tANI_U8) frmAddBARsp.DialogToken.token,
1709 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1710 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1711 frmAddBARsp.AddBAParameterSet.bufferSize,
1712 frmAddBARsp.BATimeout.timeout,
1713 0,
1714 eBA_INITIATOR,psessionEntry))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301715 {
1716 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1717 limLog( pMac, LOGE,
1718 FL( "Request to setup new BA session with peer "
1719 " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
1720 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 else
1722 return;
1723
1724returnAfterError:
1725
1726 // TODO: Do we need to signal an error status to SME,
1727 // if status != eSIR_MAC_SUCCESS_STATUS
1728
1729 // Restore STA "BA" State
1730 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1731 //
1732 // Need to send a DELBA IND to peer, who
1733 // would have setup a BA session with this STA
1734 //
1735 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1736 {
1737 //
1738 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1739 // status code. MLME will then send a DELBA IND
1740 // over the air to the peer MAC entity
1741 //
1742 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1743 pSta,
1744 eBA_INITIATOR,
1745 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1746 reasonCode, psessionEntry))
1747 {
1748 limLog( pMac, LOGW,
1749 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1750 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1751 }
1752 }
1753}
1754
1755/**
1756 * \brief Process a DELBA Indication
1757 *
1758 * \sa limProcessDelBAInd
1759 *
1760 * \param pMac The global tpAniSirGlobal object
1761 *
1762 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1763 *
1764 * \return none
1765 *
1766 */
1767static void
1768__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1769{
1770tDot11fDelBAInd frmDelBAInd;
1771tpSirMacMgmtHdr pHdr;
1772tpDphHashNode pSta;
1773tANI_U16 aid;
1774tANI_U32 frameLen, nStatus;
1775tANI_U8 *pBody;
1776
1777 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1778 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1779 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1780
1781 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1782 if( pSta == NULL )
1783 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001784 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1786 return;
1787 }
1788
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001789 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001790
1791 // Unpack the received frame
1792 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1793 if( DOT11F_FAILED( nStatus ))
1794 {
1795 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001796 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 nStatus,
1798 frameLen );
1799
1800 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1801 return;
1802 }
1803 else if ( DOT11F_WARNED( nStatus ) )
1804 {
1805 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001806 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 nStatus,
1808 frameLen );
1809
1810 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1811 }
1812
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301813 limLog( pMac, LOG1,
1814 FL( "Received DELBA from: "MAC_ADDRESS_STR" for TID %d, Reason code %d" ),
1815 MAC_ADDR_ARRAY(pHdr->sa),
Jeff Johnson295189b2012-06-20 16:38:30 -07001816 frmDelBAInd.DelBAParameterSet.tid,
1817 frmDelBAInd.Reason.code );
1818
1819 // Now, validate the DELBA Ind
1820 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1821 frmDelBAInd.DelBAParameterSet,
1822 pSta ))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301823 {
1824 limLog( pMac, LOGE,
1825 FL( "ADDBA parameters validation failed " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 return;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301827 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 //
1829 // Post WDA_DELBA_IND to HAL and delete the
1830 // existing BA session
1831 //
1832 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1833 // is kind of confusing...
1834 //
1835 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1836 pSta,
1837 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1838 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1839 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001840 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001841
1842 return;
1843
1844}
1845
1846static void
1847__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1848{
1849
1850#if 0
1851 tpSirMacMgmtHdr pHdr;
1852 tDot11fSMPowerSave frmSMPower;
1853 tSirMacHTMIMOPowerSaveState state;
1854 tpDphHashNode pSta;
1855 tANI_U16 aid;
1856 tANI_U32 frameLen, nStatus;
1857 tANI_U8 *pBody;
1858
1859 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1860 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1861 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1862
1863 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1864 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001865 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1867 return;
1868 }
1869
1870 /**Unpack the received frame */
1871 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1872
1873 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001874 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 nStatus, frameLen );
1876 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1877 return;
1878 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001879 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 nStatus, frameLen );
1881 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1882 }
1883
1884 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1885 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1886 frmSMPower.SMPowerModeSet.Mode);
1887
1888 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1889 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1890 state = eSIR_HT_MIMO_PS_DYNAMIC;
1891 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1892 state = eSIR_HT_MIMO_PS_STATIC;
1893 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1894 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1895 else {
1896 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1897 return;
1898 }
1899
1900 if (state == pSta->htMIMOPSState) {
1901 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1902 return;
1903 }
1904
1905 /** Update in the HAL Station Table for the Update of the Protection Mode */
1906 pSta->htMIMOPSState = state;
1907 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1908
1909#endif
1910
1911}
1912
1913#if defined WLAN_FEATURE_VOWIFI
1914
1915static void
1916__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1917{
1918 tpSirMacMgmtHdr pHdr;
1919 tDot11fRadioMeasurementRequest frm;
1920 tANI_U32 frameLen, nStatus;
1921 tANI_U8 *pBody;
1922
1923 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1924 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1925 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1926
1927 if( psessionEntry == NULL )
1928 {
1929 return;
1930 }
1931
1932 /**Unpack the received frame */
1933 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1934
1935 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001936 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 nStatus, frameLen );
1938 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1939 return;
1940 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001941 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 nStatus, frameLen );
1943 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1944 }
1945
1946 // Call rrm function to handle the request.
1947
1948 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1949}
1950
1951static void
1952__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1953{
1954 tpSirMacMgmtHdr pHdr;
1955 tDot11fLinkMeasurementRequest frm;
1956 tANI_U32 frameLen, nStatus;
1957 tANI_U8 *pBody;
1958
1959 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1960 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1961 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1962
1963 if( psessionEntry == NULL )
1964 {
1965 return;
1966 }
1967
1968 /**Unpack the received frame */
1969 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1970
1971 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001972 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 nStatus, frameLen );
1974 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1975 return;
1976 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001977 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 nStatus, frameLen );
1979 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1980 }
1981
1982 // Call rrm function to handle the request.
1983
1984 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1985
1986}
1987
1988static void
1989__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1990{
1991 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001992 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 tANI_U32 frameLen, nStatus;
1994 tANI_U8 *pBody;
1995
1996 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1997 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1998 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1999
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302000 pFrm = vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
2001 if (NULL == pFrm)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002002 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302003 limLog(pMac, LOGE, FL("Unable to allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002004 return;
2005 }
2006
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302007 if(psessionEntry == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302009 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 return;
2011 }
2012
2013 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002014 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07002015
2016 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002017 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 nStatus, frameLen );
2019 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302020 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002021 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002023 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 nStatus, frameLen );
2025 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2026 }
2027
2028 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002029 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
2030
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302031 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002032}
2033
2034#endif
2035
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002036#ifdef WLAN_FEATURE_AP_HT40_24G
2037static void
2038__limProcess2040bssCoexistenceActionFrame(tpAniSirGlobal pMac,
2039 tANI_U16 sessionId, tANI_U8 *pRxPacketInfo,
2040 tpPESession psessionEntry)
2041{
2042 tpSirMacMgmtHdr pHdr;
2043 tANI_U8 *pBody , i;
2044 tANI_U32 frameLen, nStatus;
2045 tDot11fHT2040BSSCoexistenceManagementActionFrame *pFrm;
2046 tpSirHT2040CoexInfoInd pSirSmeHT2040CoexInfoInd = NULL;
2047 tANI_U16 length;
2048 tSirMsgQ mmhMsg;
2049 tANI_U8 num_channelList;
2050
2051 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
2052 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
2053 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
2054
2055 pFrm =
2056 vos_mem_malloc(sizeof(tDot11fHT2040BSSCoexistenceManagementActionFrame));
2057
2058 if (NULL == pFrm)
2059 {
2060 limLog(pMac, LOGE, FL("Unable to allocate memory"));
2061 return;
2062 }
2063
2064 if(psessionEntry == NULL)
2065 {
2066 vos_mem_free(pFrm);
2067 return;
2068 }
2069
2070 /**Unpack the received frame */
2071 nStatus = dot11fUnpackHT2040BSSCoexistenceManagementActionFrame( pMac,
2072 pBody, frameLen, pFrm );
2073
2074 if( DOT11F_FAILED( nStatus ))
2075 {
2076 limLog( pMac, LOGE, FL( "Failed to unpack and parse a 20/40"
2077 "Coex Action Frame (0x%08x, %d bytes):"),
2078 nStatus, frameLen );
2079 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2080 vos_mem_free(pFrm);
2081 return;
2082 }
2083 else if ( DOT11F_WARNED( nStatus ))
2084 {
2085 limLog(pMac, LOGW, FL( "There were warnings while unpacking a"
2086 " 20/40 Coex Action Frame (0x%08x, %d bytes):"),
2087 nStatus, frameLen );
2088 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2089 }
2090
2091 num_channelList = pFrm->HT2040BSSIntolerantReport.num_channelList;
2092
2093 if (num_channelList > 0)
2094 {
2095 length = (sizeof(tSirHT2040CoexInfoInd) - sizeof(tANI_U8) +
2096 (num_channelList * sizeof(tANI_U8)));
2097 }
2098 else
2099 length = sizeof(tSirHT2040CoexInfoInd);
2100
2101 limLog(pMac, LOGW,FL("tSirHT2040CoexInfoInd: Length: %d"),length);
2102
2103 pSirSmeHT2040CoexInfoInd = vos_mem_malloc(length);
2104
2105 if (NULL == pSirSmeHT2040CoexInfoInd)
2106 {
2107 limLog(pMac, LOGP,
2108 FL("AllocateMemory failed for eWNI_SME_2040_COEX_IND"));
2109 vos_mem_free(pFrm);
2110 return;
2111 }
2112
2113 vos_mem_set((void*)pSirSmeHT2040CoexInfoInd, length, 0);
2114
2115 pSirSmeHT2040CoexInfoInd->messageType = eWNI_SME_2040_COEX_IND;
2116 pSirSmeHT2040CoexInfoInd->sessionId = sessionId;
2117 pSirSmeHT2040CoexInfoInd->length = length;
2118
2119 if (pFrm->HT2040BSSCoexistence.present)
2120 {
2121
2122 limLog(pMac, LOGW, FL("infoRequest: %d fortyMHzIntolerant: %d"
2123 " twentyMHzBssWidthReq: %d obssScanExemptionReq: %d"
2124 " obssScanExemptionGrant: %d "),
2125 pFrm->HT2040BSSCoexistence.infoRequest,
2126 pFrm->HT2040BSSCoexistence.fortyMHzIntolerant,
2127 pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq,
2128 pFrm->HT2040BSSCoexistence.obssScanExemptionReq,
2129 pFrm->HT2040BSSCoexistence.obssScanExemptionGrant);
2130
2131 pSirSmeHT2040CoexInfoInd->HT40MHzIntolerant =
2132 pFrm->HT2040BSSCoexistence.fortyMHzIntolerant;
2133 pSirSmeHT2040CoexInfoInd->HT20MHzBssWidthReq =
2134 pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq;
2135 }
2136
2137 if (pFrm->HT2040BSSIntolerantReport.present)
2138 {
2139 limLog(pMac, LOGW, FL("operatingClass: %d num_channelList: %d "),
2140 pFrm->HT2040BSSIntolerantReport.operatingClass,
2141 num_channelList);
2142
2143 if (num_channelList > 0)
2144 {
2145 vos_mem_zero(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
2146 num_channelList);
2147 vos_mem_copy(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
2148 pFrm->HT2040BSSIntolerantReport.channelList,
2149 num_channelList);
2150
2151 pSirSmeHT2040CoexInfoInd->channel_num = num_channelList;
2152 }
2153
2154 for(i=0; i < num_channelList; i++)
2155 {
2156 limLog(pMac, LOGW, FL("Channel : %d "),
2157 pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i]);
2158 }
2159 }
2160
2161 mmhMsg.type = eWNI_SME_2040_COEX_IND;
2162 mmhMsg.bodyptr = pSirSmeHT2040CoexInfoInd;
2163 mmhMsg.bodyval = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302164 limLog(pMac, LOGW, FL("Posting eWNI_SME_2040_COEX_IND Message to SME "));
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002165 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2166
2167 vos_mem_free(pFrm);
2168}
2169#endif
2170
Jeff Johnson295189b2012-06-20 16:38:30 -07002171#ifdef WLAN_FEATURE_11W
2172/**
Chet Lanctot186b5732013-03-18 10:26:30 -07002173 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 *
2175 *FUNCTION:
2176 * This function is called by limProcessActionFrame() upon
2177 * SA query request Action frame reception.
2178 *
2179 *LOGIC:
2180 *
2181 *ASSUMPTIONS:
2182 *
2183 *NOTE:
2184 *
2185 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07002186 * @param *pRxPacketInfo - Handle to the Rx packet info
2187 * @param psessionEntry - PE session entry
2188 *
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 * @return None
2190 */
Chet Lanctot186b5732013-03-18 10:26:30 -07002191static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002192{
2193 tpSirMacMgmtHdr pHdr;
2194 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002195 tANI_U8 transId[2];
Jeff Johnson295189b2012-06-20 16:38:30 -07002196
2197 /* Prima --- Below Macro not available in prima
2198 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
2199 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
2200
2201 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2202 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2203
Chet Lanctot186b5732013-03-18 10:26:30 -07002204 /* If this is an unprotected SA Query Request, then ignore it. */
2205 if (pHdr->fc.wep == 0)
2206 return;
2207
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 /*Extract 11w trsansId from SA query request action frame
2209 In SA query response action frame we will send same transId
2210 In SA query request action frame:
2211 Category : 1 byte
2212 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07002213 Transaction ID : 2 bytes */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302214 vos_mem_copy(&transId[0], &pBody[2], 2);
Jeff Johnson295189b2012-06-20 16:38:30 -07002215
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 //Send 11w SA query response action frame
2217 if (limSendSaQueryResponseFrame(pMac,
2218 transId,
2219 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
2220 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002221 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 return;
2223 }
2224}
2225
Chet Lanctot186b5732013-03-18 10:26:30 -07002226/**
2227 * __limProcessSAQueryResponseActionFrame
2228 *
2229 *FUNCTION:
2230 * This function is called by limProcessActionFrame() upon
2231 * SA query response Action frame reception.
2232 *
2233 *LOGIC:
2234 *
2235 *ASSUMPTIONS:
2236 *
2237 *NOTE:
2238 *
2239 * @param pMac - Pointer to Global MAC structure
2240 * @param *pRxPacketInfo - Handle to the Rx packet info
2241 * @param psessionEntry - PE session entry
2242 * @return None
2243 */
2244static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
2245{
2246 tpSirMacMgmtHdr pHdr;
Chet Lanctot8cecea22014-02-11 19:09:36 -08002247 tANI_U8 *pBody;
2248 tpDphHashNode pSta;
2249 tANI_U16 aid;
2250 tANI_U16 transId;
2251 tANI_U8 retryNum;
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);
Chet Lanctot186b5732013-03-18 10:26:30 -07002255 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2256 ("SA Query Response received...")) ;
Chet Lanctot186b5732013-03-18 10:26:30 -07002257
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07002258 /* When a station, supplicant handles SA Query Response.
2259 Forward to SME to HDD to wpa_supplicant. */
2260 if (eLIM_STA_ROLE == psessionEntry->limSystemRole)
2261 {
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302262 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302263 pRxPacketInfo, psessionEntry,
2264 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07002265 return;
2266 }
2267
Chet Lanctot8cecea22014-02-11 19:09:36 -08002268 /* If this is an unprotected SA Query Response, then ignore it. */
2269 if (pHdr->fc.wep == 0)
2270 return;
2271
2272 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2273 if (NULL == pSta)
2274 return;
2275
2276 limLog(pMac, LOG1,
2277 FL("SA Query Response source addr - %0x:%0x:%0x:%0x:%0x:%0x"),
2278 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
2279 pHdr->sa[4], pHdr->sa[5]);
2280 limLog(pMac, LOG1,
2281 FL("SA Query state for station - %d"), pSta->pmfSaQueryState);
2282
2283 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
2284 return;
2285
2286 /* Extract 11w trsansId from SA query reponse action frame
2287 In SA query response action frame:
2288 Category : 1 byte
2289 Action : 1 byte
2290 Transaction ID : 2 bytes */
2291 vos_mem_copy(&transId, &pBody[2], 2);
2292
2293 /* If SA Query is in progress with the station and the station
2294 responds then the association request that triggered the SA
2295 query is from a rogue station, just go back to initial state. */
2296 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
2297 if (transId == pSta->pmfSaQueryStartTransId + retryNum)
2298 {
2299 limLog(pMac, LOG1,
2300 FL("Found matching SA Query Request - transaction ID %d"), transId);
2301 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
2302 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
2303 break;
2304 }
2305}
Jeff Johnson295189b2012-06-20 16:38:30 -07002306#endif
2307
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002308#ifdef WLAN_FEATURE_11W
2309/**
2310 * limDropUnprotectedActionFrame
2311 *
2312 *FUNCTION:
2313 * This function checks if an Action frame should be dropped since it is
2314 * a Robust Managment Frame, it is unprotected, and it is received on a
2315 * connection where PMF is enabled.
2316 *
2317 *LOGIC:
2318 *
2319 *ASSUMPTIONS:
2320 *
2321 *NOTE:
2322 *
2323 * @param pMac - Global MAC structure
2324 * @param psessionEntry - PE session entry
2325 * @param pHdr - Frame header
2326 * @param category - Action frame category
2327 * @return TRUE if frame should be dropped
2328 */
2329
2330static tANI_BOOLEAN
2331limDropUnprotectedActionFrame (tpAniSirGlobal pMac, tpPESession psessionEntry,
2332 tpSirMacMgmtHdr pHdr, tANI_U8 category)
2333{
2334 tANI_U16 aid;
2335 tpDphHashNode pStaDs;
2336 tANI_BOOLEAN rmfConnection = eANI_BOOLEAN_FALSE;
2337
2338 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
2339 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
2340 {
2341 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2342 if (pStaDs != NULL)
2343 if (pStaDs->rmfEnabled)
2344 rmfConnection = eANI_BOOLEAN_TRUE;
2345 }
2346 else if (psessionEntry->limRmfEnabled)
2347 rmfConnection = eANI_BOOLEAN_TRUE;
2348
2349 if (rmfConnection && (pHdr->fc.wep == 0))
2350 {
2351 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2352 "since RMF is enabled."), category);)
2353 return eANI_BOOLEAN_TRUE;
2354 }
2355 else
2356 return eANI_BOOLEAN_FALSE;
2357}
2358#endif
2359
Jeff Johnson295189b2012-06-20 16:38:30 -07002360/**
2361 * limProcessActionFrame
2362 *
2363 *FUNCTION:
2364 * This function is called by limProcessMessageQueue() upon
2365 * Action frame reception.
2366 *
2367 *LOGIC:
2368 *
2369 *ASSUMPTIONS:
2370 *
2371 *NOTE:
2372 *
2373 * @param pMac - Pointer to Global MAC structure
2374 * @param *pRxPacketInfo - A pointer to packet info structure
2375 * @return None
2376 */
2377
2378void
2379limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2380{
2381 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2382 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002383#ifdef WLAN_FEATURE_11W
2384 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05302385
2386 if (lim_is_robust_mgmt_action_frame(pActionHdr->category) &&
2387 limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr,
2388 pActionHdr->category)) {
2389 limLog(pMac, LOGE,
2390 FL("Don't send unprotect action frame to upper layer categ %d "),
2391 pActionHdr->category);
2392 return;
2393 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002394#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002395
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 switch (pActionHdr->category)
2397 {
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05302398
2399 /*
2400 * WARNING: If you add Action frame category case here, set the
2401 * corresponding bit to 1 in sme_set_allowed_action_frames() for
2402 * the FW to hand over that frame to host without dropping itself
2403 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002404 case SIR_MAC_ACTION_QOS_MGMT:
Leela Venkata Kiran Kumar Reddy Chiralac7c4e7e2014-04-29 10:50:16 -07002405 if ( (psessionEntry->limQosEnabled) ||
2406 (pActionHdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 {
2408 switch (pActionHdr->actionID)
2409 {
2410 case SIR_MAC_QOS_ADD_TS_REQ:
2411 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2412 break;
2413
2414 case SIR_MAC_QOS_ADD_TS_RSP:
2415 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2416 break;
2417
2418 case SIR_MAC_QOS_DEL_TS_REQ:
2419 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2420 break;
2421
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002422 case SIR_MAC_QOS_MAP_CONFIGURE:
2423 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2424 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002425 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302426 limLog(pMac, LOG1,
2427 FL("Qos action %d not handled"),
2428 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 break;
2430 }
2431 break ;
2432 }
2433
2434 break;
2435
2436 case SIR_MAC_ACTION_SPECTRUM_MGMT:
2437 switch (pActionHdr->actionID)
2438 {
2439#ifdef ANI_SUPPORT_11H
2440 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2441 if(psessionEntry->lim11hEnable)
2442 {
2443 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2444 }
2445 break;
2446
2447 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2448 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2449 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2450 {
2451 if(psessionEntry->lim11hEnable)
2452 {
2453 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2454 }
2455 }
2456 break;
2457
2458#endif
2459 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2460 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2461 {
2462 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2463 }
2464 break;
2465 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302466 limLog(pMac, LOG1,
2467 FL("Spectrum mgmt action id %d not handled"),
2468 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 break;
2470 }
2471 break;
2472
2473 case SIR_MAC_ACTION_WME:
2474 if (! psessionEntry->limWmeEnabled)
2475 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002476 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 pActionHdr->actionID);
2478 break;
2479 }
2480 switch(pActionHdr->actionID)
2481 {
2482 case SIR_MAC_QOS_ADD_TS_REQ:
2483 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2484 break;
2485
2486 case SIR_MAC_QOS_ADD_TS_RSP:
2487 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2488 break;
2489
2490 case SIR_MAC_QOS_DEL_TS_REQ:
2491 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2492 break;
2493
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002494 case SIR_MAC_QOS_MAP_CONFIGURE:
2495 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2496 break;
2497
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302499 limLog(pMac, LOG1, FL("WME action %d not handled"),
2500 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 break;
2502 }
2503 break;
2504
2505 case SIR_MAC_ACTION_BLKACK:
2506 // Determine the "type" of BA Action Frame
2507 switch(pActionHdr->actionID)
2508 {
2509 case SIR_MAC_BLKACK_ADD_REQ:
2510 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2511 break;
2512
2513 case SIR_MAC_BLKACK_ADD_RSP:
2514 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2515 break;
2516
2517 case SIR_MAC_BLKACK_DEL:
2518 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2519 break;
2520
2521 default:
2522 break;
2523 }
2524
2525 break;
2526 case SIR_MAC_ACTION_HT:
2527 /** Type of HT Action to be performed*/
2528 switch(pActionHdr->actionID) {
2529 case SIR_MAC_SM_POWER_SAVE:
2530 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2531 break;
2532 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302533 limLog(pMac, LOG1,
2534 FL("Action ID %d not handled in HT Action category"),
2535 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 break;
2537 }
2538 break;
2539
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002540 case SIR_MAC_ACTION_WNM:
2541 {
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002542 PELOGE(limLog(pMac, LOG1, FL("WNM Action category %d action %d."),
2543 pActionHdr->category, pActionHdr->actionID);)
2544 switch (pActionHdr->actionID)
2545 {
2546 case SIR_MAC_WNM_BSS_TM_QUERY:
2547 case SIR_MAC_WNM_BSS_TM_REQUEST:
2548 case SIR_MAC_WNM_BSS_TM_RESPONSE:
2549 case SIR_MAC_WNM_NOTIF_REQUEST:
2550 case SIR_MAC_WNM_NOTIF_RESPONSE:
2551 {
2552 tpSirMacMgmtHdr pHdr;
2553 tANI_S8 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
2554 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2555 /* Forward to the SME to HDD to wpa_supplicant */
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302556 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2557 pRxPacketInfo,
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002558 psessionEntry, rssi);
2559 break;
2560 }
2561 }
2562 break;
2563 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002564#if defined WLAN_FEATURE_VOWIFI
2565 case SIR_MAC_ACTION_RRM:
Abhishek Singhe0bc0992016-05-20 17:58:18 +05302566 /* Ignore RRM measurement request until DHCP is set */
2567 if(pMac->rrm.rrmPEContext.rrmEnable &&
2568 pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done)
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 {
2570 switch(pActionHdr->actionID) {
2571 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2572 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2573 break;
2574 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2575 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2576 break;
2577 case SIR_MAC_RRM_NEIGHBOR_RPT:
2578 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2579 break;
2580 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302581 limLog( pMac, LOG1, FL("Action ID %d not handled in RRM"),
2582 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 break;
2584
2585 }
2586 }
2587 else
2588 {
2589 // Else we will just ignore the RRM messages.
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302590 limLog( pMac, LOG1,
Abhishek Singhe0bc0992016-05-20 17:58:18 +05302591 FL("RRM Action frame ignored as rrmEnable is %d or DHCP not completed %d"),
2592 pMac->rrm.rrmPEContext.rrmEnable,
2593 pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done);
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 }
2595 break;
2596#endif
Abhishek Singh00b71972016-01-07 10:51:04 +05302597#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) \
2598 || defined (WLAN_FEATURE_RMC)
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002599 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2600 {
2601 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
2602 tpSirMacMgmtHdr pHdr;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002603 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2604
2605 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002606
2607 //Check if it is a vendor specific action frame.
2608 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302609 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002610 &pHdr->da[0], sizeof(tSirMacAddr))) &&
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002611 IS_WES_MODE_ENABLED(pMac) &&
2612 vos_mem_compare(pVendorSpecific->Oui, Oui, 3))
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002613 {
2614 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2615 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2616 /* Forward to the SME to HDD to wpa_supplicant */
2617 // type is ACTION
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302618 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2619 pRxPacketInfo,
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302620 psessionEntry, 0);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002621 }
Abhishek Singh00b71972016-01-07 10:51:04 +05302622#if defined (WLAN_FEATURE_RMC)
2623 else if ((eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole) &&
2624 ((VOS_TRUE == vos_mem_compare(SIR_MAC_RMC_MCAST_ADDRESS,
2625 &pHdr->da[0], sizeof(tSirMacAddr))) ||
2626 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
2627 &pHdr->da[0], sizeof(tSirMacAddr)))) &&
2628 vos_mem_compare(pVendorSpecific->Oui, SIR_MAC_RMC_OUI, 3))
2629 {
2630 tANI_U8 MagicCode[] =
2631 { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e };
2632 tpSirMacIbssExtNetworkFrameHdr pIbssExtHdr =
2633 (tpSirMacIbssExtNetworkFrameHdr) pActionHdr;
2634
2635 if (vos_mem_compare(pIbssExtHdr->MagicCode,
2636 MagicCode, sizeof(MagicCode)) &&
2637 pIbssExtHdr->version == SIR_MAC_RMC_VER )
2638 {
2639 switch (pIbssExtHdr->actionID)
2640 {
2641 default:
2642 PELOGE(limLog(pMac, LOGE,
2643 FL("Action RMC actionID %d not handled"),
2644 pIbssExtHdr->actionID);)
2645 break;
2646 case SIR_MAC_RMC_RULER_INFORM_SELECTED:
2647 limLog(pMac, LOG1,
2648 FL("Action RMC RULER_INFORM_SELECTED."));
2649 limProcessRMCMessages(pMac,
2650 eLIM_RMC_OTA_RULER_INFORM_SELECTED,
2651 (tANI_U32 *)pRxPacketInfo);
2652 break;
2653 case SIR_MAC_RMC_RULER_INFORM_CANCELLED:
2654 limLog(pMac, LOG1,
2655 FL("Action RMC RULER_INFORM_CANCELLED."));
2656 limProcessRMCMessages(pMac,
2657 eLIM_RMC_OTA_RULER_INFORM_CANCELLED,
2658 (tANI_U32 *)pRxPacketInfo);
2659 break;
2660 }
2661 }
2662 else
2663 {
2664 limLog( pMac, LOG1,
2665 FL("Dropping the vendor specific action frame in IBSS "
2666 "mode because of Ibss Ext Magic mismatch "
2667 MAC_ADDRESS_STR " or Version mismatch = %d"),
2668 MAC_ADDR_ARRAY(pIbssExtHdr->MagicCode),
2669 pIbssExtHdr->version );
2670 }
2671 }
2672#endif /* WLAN_FEATURE_RMC */
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002673 else
2674 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302675 limLog( pMac, LOG1,
2676 FL("Dropping the vendor specific action frame because of( "
2677 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
2678 "not received with SelfSta Mac address) system role = %d"),
2679 IS_WES_MODE_ENABLED(pMac),
2680 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2681 pVendorSpecific->Oui[2],
2682 psessionEntry->limSystemRole );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002683 }
2684 }
2685 break;
Abhishek Singh00b71972016-01-07 10:51:04 +05302686#endif /* WLAN_FEATURE_VOWIFI_11R || FEATURE_WLAN_ESE ||
2687 FEATURE_WLAN_LFR || WLAN_FEATURE_RMC */
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 case SIR_MAC_ACTION_PUBLIC_USAGE:
2689 switch(pActionHdr->actionID) {
2690 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2691 {
2692 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302694 tANI_U32 frameLen;
2695
2696 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2697
2698 if (frameLen < sizeof(pActionHdr)) {
2699 limLog(pMac, LOG1,
2700 FL("Received action frame of invalid len %d"),
2701 frameLen);
2702 break;
2703 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002704
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302706 if (vos_mem_compare(pPubAction->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002707 {
2708 /* Forward to the SME to HDD to wpa_supplicant */
2709 // type is ACTION
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302710 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2711 pRxPacketInfo,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302712 psessionEntry,
2713 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 }
2715 else
2716 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302717 limLog( pMac, LOG1,
2718 FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
2719 pPubAction->Oui[0], pPubAction->Oui[1],
2720 pPubAction->Oui[2], pPubAction->Oui[3] );
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 }
2722 }
2723 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002724#ifdef WLAN_FEATURE_AP_HT40_24G
2725 case SIR_MAC_ACTION_2040_BSS_COEXISTENCE:
2726 {
2727 if (pMac->roam.configParam.apHT40_24GEnabled)
2728 {
2729 limLog( pMac, LOGW, FL("Public Action 20/40 BSS"
2730 "Coexistence Management frame"));
2731
2732 __limProcess2040bssCoexistenceActionFrame(pMac,
2733 psessionEntry->smeSessionId, (tANI_U8 *) pRxPacketInfo,
2734 psessionEntry);
2735 }
2736 break;
2737 }
2738#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002739#ifdef FEATURE_WLAN_TDLS
2740 case SIR_MAC_TDLS_DIS_RSP:
2741 {
Chilam NG571c65a2013-01-19 12:27:36 +05302742 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002743
Chilam NG571c65a2013-01-19 12:27:36 +05302744 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002745 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002746 ("Public Action TDLS Discovery RSP ..")) ;
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302747 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2748 pRxPacketInfo,
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302749 psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002750 }
2751 break;
2752#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302753 case SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID:
2754 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2755 {
2756 lim_process_ecsa_action_frame(pMac,
2757 pRxPacketInfo, psessionEntry);
2758 }
2759 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002760 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302761 limLog(pMac, LOG1, FL("Unhandled public action frame -- %x "),
2762 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 break;
2764 }
2765 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002766
2767#ifdef WLAN_FEATURE_11W
2768 case SIR_MAC_ACTION_SA_QUERY:
2769 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002770 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
2771 switch (pActionHdr->actionID)
2772 {
2773 case SIR_MAC_SA_QUERY_REQ:
2774 /**11w SA query request action frame received**/
2775 /* Respond directly to the incoming request in LIM */
2776 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2777 break;
2778 case SIR_MAC_SA_QUERY_RSP:
2779 /**11w SA query response action frame received**/
Chet Lanctot8cecea22014-02-11 19:09:36 -08002780 /* Handle based on the current SA Query state */
Chet Lanctot186b5732013-03-18 10:26:30 -07002781 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2782 break;
2783 default:
2784 break;
2785 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 break;
2787 }
2788#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002789#ifdef WLAN_FEATURE_11AC
2790 case SIR_MAC_ACTION_VHT:
2791 {
2792 if (psessionEntry->vhtCapability)
2793 {
2794 switch (pActionHdr->actionID)
2795 {
2796 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2797 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2798 break;
2799 default:
2800 break;
2801 }
2802 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002803 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002804 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002805#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302807 limLog(pMac, LOG1,
2808 FL("Action category %d not handled"), pActionHdr->category);
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 break;
2810 }
2811}
2812
Jeff Johnson295189b2012-06-20 16:38:30 -07002813/**
2814 * limProcessActionFrameNoSession
2815 *
2816 *FUNCTION:
2817 * This function is called by limProcessMessageQueue() upon
2818 * Action frame reception and no session.
2819 * Currently only public action frames can be received from
2820 * a non-associated station.
2821 *
2822 *LOGIC:
2823 *
2824 *ASSUMPTIONS:
2825 *
2826 *NOTE:
2827 *
2828 * @param pMac - Pointer to Global MAC structure
2829 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2830 * @return None
2831 */
2832
2833void
2834limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2835{
2836 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2837 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2838
Mohit Khanna23863762012-09-11 17:40:09 -07002839 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002840
2841 switch ( pActionHdr->category )
2842 {
2843 case SIR_MAC_ACTION_PUBLIC_USAGE:
2844 switch(pActionHdr->actionID) {
2845 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2846 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302848 tANI_U32 frameLen;
2849
2850 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
2851
2852 if (frameLen < sizeof(pActionHdr)) {
2853 limLog(pMac, LOG1,
2854 FL("Received action frame of invalid len %d"),
2855 frameLen);
2856 break;
2857 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002858
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302860 if (vos_mem_compare(pActionHdr->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 {
2862 /* Forward to the SME to HDD to wpa_supplicant */
2863 // type is ACTION
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302864 limSendSmeMgmtFrameInd(pMac, 0, pBd, NULL,
2865 WDA_GET_RX_RSSI_DB(pBd));
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 }
2867 else
2868 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302869 limLog( pMac, LOG1,
2870 FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
2871 pActionHdr->Oui[0], pActionHdr->Oui[1],
2872 pActionHdr->Oui[2], pActionHdr->Oui[3]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 }
2874 }
2875 break;
2876 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302877 limLog(pMac, LOG1,
2878 FL("Unhandled public action frame -- %x "), pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 break;
2880 }
2881 break;
2882 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302883 limLog(pMac, LOG1,
2884 FL("Unhandled action frame without session -- %x "),
2885 pActionHdr->category);
2886 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002887
2888 }
2889}