blob: 977cdbc396252a9e3ba7d228abc53fa9794d2ab7 [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
1362 // Unpack the received frame
1363 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1364 if( DOT11F_FAILED( nStatus ))
1365 {
1366 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001367 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 nStatus,
1369 frameLen );
1370
1371 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1372
1373 // Without an unpacked request we cannot respond, so silently ignore the request
1374 return;
1375 }
1376 else if ( DOT11F_WARNED( nStatus ) )
1377 {
1378 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001379 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001380 nStatus,
1381 frameLen );
1382
1383 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1384 }
1385
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001386 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1387
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1389 if( pSta == NULL )
1390 {
1391 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001392 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001393 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001394
1395 // FIXME - Should we do this?
1396 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1397 goto returnAfterError;
1398 }
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301399 limLog( pMac, LOG1, FL( "ADDBA Req from STA "MAC_ADDRESS_STR " with AID %d"
1400 " tid = %d policy = %d buffsize = %d"
1401 " amsduSupported = %d"), MAC_ADDR_ARRAY(pHdr->sa),
1402 aid, frmAddBAReq.AddBAParameterSet.tid,
1403 frmAddBAReq.AddBAParameterSet.policy,
1404 frmAddBAReq.AddBAParameterSet.bufferSize,
1405 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07001406
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301407 limLog( pMac, LOG1, FL( "ssn = %d fragNumber = %d" ),
1408 frmAddBAReq.BAStartingSequenceControl.ssn,
1409 frmAddBAReq.BAStartingSequenceControl.fragNumber);
1410
Jeff Johnson295189b2012-06-20 16:38:30 -07001411#ifdef WLAN_SOFTAP_VSTA_FEATURE
1412 // we can only do BA on "hard" STAs
1413 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1414 {
1415 status = eSIR_MAC_REQ_DECLINED_STATUS;
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +05301416 limLog( pMac, LOG1,
1417 FL( "ta Id is not HW Sta Id, Status code is %d " ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 goto returnAfterError;
1419 }
1420#endif //WLAN_SOFTAP_VSTA_FEATURE
1421
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +05301422 if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_TX_RX_AGGREGATION, &val1) !=
1423 eSIR_SUCCESS)
1424 {
1425 limLog(pMac, LOGE,
1426 FL("Unable to get WNI_CFG_ENABLE_TX_RX_AGGREGATION"));
1427 val1 = 1;
1428 }
1429 if (!val1)
1430 {
1431 limLog(pMac, LOGE,
1432 FL("aggregation disabled - ignoring ADDBA"));
1433 goto returnAfterError;
1434 }
1435
c_hpothu3ba2a512014-08-06 14:02:54 +05301436 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 -07001437 eSIR_SUCCESS)
1438 {
1439 limLog(pMac, LOGE,
c_hpothu3ba2a512014-08-06 14:02:54 +05301440 FL("Unable to get WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC"));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001441 val = 0;
1442 }
1443 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1444 val)
1445 {
1446 limLog( pMac, LOGW,
1447 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1448 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1449
1450 status = eSIR_MAC_REQ_DECLINED_STATUS;
1451 goto returnAfterError;
1452 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001453
1454 // Now, validate the ADDBA Req
1455 if( eSIR_MAC_SUCCESS_STATUS !=
1456 (status = __limValidateAddBAParameterSet( pMac, pSta,
1457 frmAddBAReq.AddBAParameterSet,
1458 0, //dialogue token is don't care in request validation.
1459 LIM_ADDBA_REQ, &delBAFlag)))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301460 {
1461 limLog( pMac, LOGE,
1462 FL( "ADDBA parameters validation failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 goto returnAfterError;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301464 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001465
1466 //BA already set, so we need to delete it before adding new one.
1467 if(delBAFlag)
1468 {
1469 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1470 pSta,
1471 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1472 eBA_RECIPIENT,psessionEntry))
1473 {
1474 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301475 limLog( pMac, LOGE,
1476 FL( "Deletion of Existing BA session failed with status %d" ),
1477 status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 goto returnAfterError;
1479 }
1480 }
1481
1482 // Check if the ADD BA Declined configuration is Disabled
1483 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001484 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 frmAddBAReq.AddBAParameterSet.tid);
1486 status = eSIR_MAC_REQ_DECLINED_STATUS;
1487 goto returnAfterError;
1488 }
1489
1490 //
1491 // Post WDA_ADDBA_REQ to HAL.
1492 // If HAL/HDD decide to allow this ADDBA Req session,
1493 // then this BA session is termed active
1494 //
1495
1496 // Change the Block Ack state of this STA to wait for
1497 // ADDBA Rsp from HAL
1498 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001499
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001500 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001501 {
1502 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001503 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001504 }
1505
1506
1507 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1508 {
1509 frmAddBAReq.AddBAParameterSet.bufferSize =
1510 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1511 }
1512 else
1513 {
1514 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1515 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001516 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001517 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001518
1519 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1520 pSta,
1521 (tANI_U8) frmAddBAReq.DialogToken.token,
1522 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1523 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1524 frmAddBAReq.AddBAParameterSet.bufferSize,
1525 frmAddBAReq.BATimeout.timeout,
1526 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1527 eBA_RECIPIENT,psessionEntry))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301528 {
1529 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1530 limLog( pMac, LOGE,
1531 FL( "Request to setup new BA session with peer "
1532 " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
1533 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 else
1535 return;
1536
1537returnAfterError:
1538
1539 //
1540 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1541 // status code. MLME will then send an ADDBA RSP
1542 // over the air to the peer MAC entity
1543 //
1544 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1545 pHdr->sa,
1546 status,
1547 frmAddBAReq.DialogToken.token,
1548 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1549 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1550 frmAddBAReq.AddBAParameterSet.bufferSize,
1551 frmAddBAReq.BATimeout.timeout,psessionEntry))
1552 {
1553 limLog( pMac, LOGW,
1554 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1555 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1556 }
1557
1558}
1559
1560/**
1561 * \brief Process an ADDBA RSP
1562 *
1563 * \sa limProcessAddBARsp
1564 *
1565 * \param pMac The global tpAniSirGlobal object
1566 *
1567 * \param pRxPacketInfo Handle to the packet info structure from HDD
1568 *
1569 * \return none
1570 *
1571 */
1572static void
1573__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1574{
1575tDot11fAddBARsp frmAddBARsp;
1576tpSirMacMgmtHdr pHdr;
1577tpDphHashNode pSta;
1578tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1579tANI_U16 aid;
1580tANI_U32 frameLen, nStatus;
1581tANI_U8 *pBody;
1582
1583 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1584 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1585 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1586
1587 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1588 if( pSta == NULL )
1589 {
1590 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001591 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1593 return;
1594 }
1595
1596#ifdef WLAN_SOFTAP_VSTA_FEATURE
1597 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1598 // Request, so we should never be processing a ADDBA Response
1599 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1600 {
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301601 limLog( pMac, LOGE, FL( "Sta Id is not HW Sta Id " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 return;
1603 }
1604#endif //WLAN_SOFTAP_VSTA_FEATURE
1605
1606 // Unpack the received frame
1607 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1608 if( DOT11F_FAILED( nStatus ))
1609 {
1610 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001611 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 nStatus,
1613 frameLen );
1614
1615 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1616 goto returnAfterError;
1617 }
1618 else if ( DOT11F_WARNED( nStatus ) )
1619 {
1620 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001621 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001622 nStatus,
1623 frameLen );
1624
1625 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1626 }
1627
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301628 limLog( pMac, LOG1, FL( "ADDBA Rsp from STA "MAC_ADDRESS_STR " with AID %d "
1629 "tid = %d policy = %d buffsize = %d "
1630 "amsduSupported = %d status = %d"),
1631 MAC_ADDR_ARRAY(pHdr->sa), aid,
1632 frmAddBARsp.AddBAParameterSet.tid,
1633 frmAddBARsp.AddBAParameterSet.policy,
1634 frmAddBARsp.AddBAParameterSet.bufferSize,
1635 frmAddBARsp.AddBAParameterSet.amsduSupported,
1636 frmAddBARsp.Status.status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 //if there is no matchin dialougue token then ignore the response.
1638
1639 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1640 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1641 {
Abhishek Singh6f09e702016-01-28 15:15:04 +05301642 limLog(pMac, LOGE,
1643 FL("dialogueToken in received addBARsp did not match with outstanding requests"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 return;
1645 }
1646
1647 // Check first if the peer accepted the ADDBA Req
1648 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1649 {
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301650 tANI_U32 val;
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301651 pMac->lim.staBaInfo[pSta->staIndex].
1652 failed_count[frmAddBARsp.AddBAParameterSet.tid] = 0;
1653 pMac->lim.staBaInfo[pSta->staIndex].
1654 failed_timestamp[frmAddBARsp.AddBAParameterSet.tid] = 0;
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301655 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
1656 {
1657 limLog(pMac, LOG1, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
1658 goto returnAfterError;
1659 }
1660 if (0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1661 frmAddBARsp.AddBAParameterSet.bufferSize = val;
1662 else
1663 frmAddBARsp.AddBAParameterSet.bufferSize =
1664 VOS_MIN(val, frmAddBARsp.AddBAParameterSet.bufferSize);
1665 limLog( pMac, LOG1,
1666 FL( "ADDBA RSP Buffsize = %d" ),
1667 frmAddBARsp.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 // Now, validate the ADDBA Rsp
1669 if( eSIR_MAC_SUCCESS_STATUS !=
1670 __limValidateAddBAParameterSet( pMac, pSta,
1671 frmAddBARsp.AddBAParameterSet,
1672 (tANI_U8)frmAddBARsp.DialogToken.token,
1673 LIM_ADDBA_RSP, NULL))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301674 {
1675 limLog( pMac, LOGE,
1676 FL( "ADDBA parameters validation failed" ));
1677 goto returnAfterError;
1678 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 }
1680 else
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301681 {
1682 pMac->lim.staBaInfo[pSta->staIndex].
1683 failed_count[frmAddBARsp.AddBAParameterSet.tid]++;
1684 pMac->lim.staBaInfo[pSta->staIndex].failed_timestamp[
1685 frmAddBARsp.AddBAParameterSet.tid] = jiffies_to_msecs(jiffies);
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 goto returnAfterError;
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +05301687 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001688 // Change STA state to wait for ADDBA Rsp from HAL
1689 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1690
1691 //
1692 // Post WDA_ADDBA_REQ to HAL.
1693 // If HAL/HDD decide to allow this ADDBA Rsp session,
1694 // then this BA session is termed active
1695 //
1696
1697 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1698 pSta,
1699 (tANI_U8) frmAddBARsp.DialogToken.token,
1700 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1701 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1702 frmAddBARsp.AddBAParameterSet.bufferSize,
1703 frmAddBARsp.BATimeout.timeout,
1704 0,
1705 eBA_INITIATOR,psessionEntry))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301706 {
1707 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1708 limLog( pMac, LOGE,
1709 FL( "Request to setup new BA session with peer "
1710 " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
1711 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 else
1713 return;
1714
1715returnAfterError:
1716
1717 // TODO: Do we need to signal an error status to SME,
1718 // if status != eSIR_MAC_SUCCESS_STATUS
1719
1720 // Restore STA "BA" State
1721 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1722 //
1723 // Need to send a DELBA IND to peer, who
1724 // would have setup a BA session with this STA
1725 //
1726 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1727 {
1728 //
1729 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1730 // status code. MLME will then send a DELBA IND
1731 // over the air to the peer MAC entity
1732 //
1733 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1734 pSta,
1735 eBA_INITIATOR,
1736 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1737 reasonCode, psessionEntry))
1738 {
1739 limLog( pMac, LOGW,
1740 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1741 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1742 }
1743 }
1744}
1745
1746/**
1747 * \brief Process a DELBA Indication
1748 *
1749 * \sa limProcessDelBAInd
1750 *
1751 * \param pMac The global tpAniSirGlobal object
1752 *
1753 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1754 *
1755 * \return none
1756 *
1757 */
1758static void
1759__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1760{
1761tDot11fDelBAInd frmDelBAInd;
1762tpSirMacMgmtHdr pHdr;
1763tpDphHashNode pSta;
1764tANI_U16 aid;
1765tANI_U32 frameLen, nStatus;
1766tANI_U8 *pBody;
1767
1768 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1769 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1770 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1771
1772 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1773 if( pSta == NULL )
1774 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001775 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1777 return;
1778 }
1779
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001780 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001781
1782 // Unpack the received frame
1783 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1784 if( DOT11F_FAILED( nStatus ))
1785 {
1786 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001787 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001788 nStatus,
1789 frameLen );
1790
1791 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1792 return;
1793 }
1794 else if ( DOT11F_WARNED( nStatus ) )
1795 {
1796 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001797 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 nStatus,
1799 frameLen );
1800
1801 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1802 }
1803
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301804 limLog( pMac, LOG1,
1805 FL( "Received DELBA from: "MAC_ADDRESS_STR" for TID %d, Reason code %d" ),
1806 MAC_ADDR_ARRAY(pHdr->sa),
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 frmDelBAInd.DelBAParameterSet.tid,
1808 frmDelBAInd.Reason.code );
1809
1810 // Now, validate the DELBA Ind
1811 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1812 frmDelBAInd.DelBAParameterSet,
1813 pSta ))
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301814 {
1815 limLog( pMac, LOGE,
1816 FL( "ADDBA parameters validation failed " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 return;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05301818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 //
1820 // Post WDA_DELBA_IND to HAL and delete the
1821 // existing BA session
1822 //
1823 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1824 // is kind of confusing...
1825 //
1826 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1827 pSta,
1828 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1829 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1830 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001831 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001832
1833 return;
1834
1835}
1836
1837static void
1838__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1839{
1840
1841#if 0
1842 tpSirMacMgmtHdr pHdr;
1843 tDot11fSMPowerSave frmSMPower;
1844 tSirMacHTMIMOPowerSaveState state;
1845 tpDphHashNode pSta;
1846 tANI_U16 aid;
1847 tANI_U32 frameLen, nStatus;
1848 tANI_U8 *pBody;
1849
1850 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1851 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1852 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1853
1854 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1855 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001856 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1858 return;
1859 }
1860
1861 /**Unpack the received frame */
1862 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1863
1864 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001865 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 nStatus, frameLen );
1867 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1868 return;
1869 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001870 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 nStatus, frameLen );
1872 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1873 }
1874
1875 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1876 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1877 frmSMPower.SMPowerModeSet.Mode);
1878
1879 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1880 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1881 state = eSIR_HT_MIMO_PS_DYNAMIC;
1882 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1883 state = eSIR_HT_MIMO_PS_STATIC;
1884 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1885 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1886 else {
1887 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1888 return;
1889 }
1890
1891 if (state == pSta->htMIMOPSState) {
1892 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1893 return;
1894 }
1895
1896 /** Update in the HAL Station Table for the Update of the Protection Mode */
1897 pSta->htMIMOPSState = state;
1898 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1899
1900#endif
1901
1902}
1903
1904#if defined WLAN_FEATURE_VOWIFI
1905
1906static void
1907__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1908{
1909 tpSirMacMgmtHdr pHdr;
1910 tDot11fRadioMeasurementRequest frm;
1911 tANI_U32 frameLen, nStatus;
1912 tANI_U8 *pBody;
1913
1914 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1915 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1916 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1917
1918 if( psessionEntry == NULL )
1919 {
1920 return;
1921 }
1922
1923 /**Unpack the received frame */
1924 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1925
1926 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001927 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 nStatus, frameLen );
1929 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1930 return;
1931 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001932 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 nStatus, frameLen );
1934 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1935 }
1936
1937 // Call rrm function to handle the request.
1938
1939 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1940}
1941
1942static void
1943__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1944{
1945 tpSirMacMgmtHdr pHdr;
1946 tDot11fLinkMeasurementRequest frm;
1947 tANI_U32 frameLen, nStatus;
1948 tANI_U8 *pBody;
1949
1950 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1951 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1952 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1953
1954 if( psessionEntry == NULL )
1955 {
1956 return;
1957 }
1958
1959 /**Unpack the received frame */
1960 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1961
1962 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001963 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 nStatus, frameLen );
1965 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1966 return;
1967 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001968 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 nStatus, frameLen );
1970 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1971 }
1972
1973 // Call rrm function to handle the request.
1974
1975 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1976
1977}
1978
1979static void
1980__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1981{
1982 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001983 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 tANI_U32 frameLen, nStatus;
1985 tANI_U8 *pBody;
1986
1987 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1988 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1989 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1990
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301991 pFrm = vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
1992 if (NULL == pFrm)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001993 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301994 limLog(pMac, LOGE, FL("Unable to allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001995 return;
1996 }
1997
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301998 if(psessionEntry == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302000 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 return;
2002 }
2003
2004 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002005 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07002006
2007 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002008 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 nStatus, frameLen );
2010 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302011 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002012 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002014 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 nStatus, frameLen );
2016 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2017 }
2018
2019 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002020 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
2021
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302022 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002023}
2024
2025#endif
2026
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002027#ifdef WLAN_FEATURE_AP_HT40_24G
2028static void
2029__limProcess2040bssCoexistenceActionFrame(tpAniSirGlobal pMac,
2030 tANI_U16 sessionId, tANI_U8 *pRxPacketInfo,
2031 tpPESession psessionEntry)
2032{
2033 tpSirMacMgmtHdr pHdr;
2034 tANI_U8 *pBody , i;
2035 tANI_U32 frameLen, nStatus;
2036 tDot11fHT2040BSSCoexistenceManagementActionFrame *pFrm;
2037 tpSirHT2040CoexInfoInd pSirSmeHT2040CoexInfoInd = NULL;
2038 tANI_U16 length;
2039 tSirMsgQ mmhMsg;
2040 tANI_U8 num_channelList;
2041
2042 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
2043 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
2044 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
2045
2046 pFrm =
2047 vos_mem_malloc(sizeof(tDot11fHT2040BSSCoexistenceManagementActionFrame));
2048
2049 if (NULL == pFrm)
2050 {
2051 limLog(pMac, LOGE, FL("Unable to allocate memory"));
2052 return;
2053 }
2054
2055 if(psessionEntry == NULL)
2056 {
2057 vos_mem_free(pFrm);
2058 return;
2059 }
2060
2061 /**Unpack the received frame */
2062 nStatus = dot11fUnpackHT2040BSSCoexistenceManagementActionFrame( pMac,
2063 pBody, frameLen, pFrm );
2064
2065 if( DOT11F_FAILED( nStatus ))
2066 {
2067 limLog( pMac, LOGE, FL( "Failed to unpack and parse a 20/40"
2068 "Coex Action Frame (0x%08x, %d bytes):"),
2069 nStatus, frameLen );
2070 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2071 vos_mem_free(pFrm);
2072 return;
2073 }
2074 else if ( DOT11F_WARNED( nStatus ))
2075 {
2076 limLog(pMac, LOGW, FL( "There were warnings while unpacking a"
2077 " 20/40 Coex Action Frame (0x%08x, %d bytes):"),
2078 nStatus, frameLen );
2079 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
2080 }
2081
2082 num_channelList = pFrm->HT2040BSSIntolerantReport.num_channelList;
2083
2084 if (num_channelList > 0)
2085 {
2086 length = (sizeof(tSirHT2040CoexInfoInd) - sizeof(tANI_U8) +
2087 (num_channelList * sizeof(tANI_U8)));
2088 }
2089 else
2090 length = sizeof(tSirHT2040CoexInfoInd);
2091
2092 limLog(pMac, LOGW,FL("tSirHT2040CoexInfoInd: Length: %d"),length);
2093
2094 pSirSmeHT2040CoexInfoInd = vos_mem_malloc(length);
2095
2096 if (NULL == pSirSmeHT2040CoexInfoInd)
2097 {
2098 limLog(pMac, LOGP,
2099 FL("AllocateMemory failed for eWNI_SME_2040_COEX_IND"));
2100 vos_mem_free(pFrm);
2101 return;
2102 }
2103
2104 vos_mem_set((void*)pSirSmeHT2040CoexInfoInd, length, 0);
2105
2106 pSirSmeHT2040CoexInfoInd->messageType = eWNI_SME_2040_COEX_IND;
2107 pSirSmeHT2040CoexInfoInd->sessionId = sessionId;
2108 pSirSmeHT2040CoexInfoInd->length = length;
2109
2110 if (pFrm->HT2040BSSCoexistence.present)
2111 {
2112
2113 limLog(pMac, LOGW, FL("infoRequest: %d fortyMHzIntolerant: %d"
2114 " twentyMHzBssWidthReq: %d obssScanExemptionReq: %d"
2115 " obssScanExemptionGrant: %d "),
2116 pFrm->HT2040BSSCoexistence.infoRequest,
2117 pFrm->HT2040BSSCoexistence.fortyMHzIntolerant,
2118 pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq,
2119 pFrm->HT2040BSSCoexistence.obssScanExemptionReq,
2120 pFrm->HT2040BSSCoexistence.obssScanExemptionGrant);
2121
2122 pSirSmeHT2040CoexInfoInd->HT40MHzIntolerant =
2123 pFrm->HT2040BSSCoexistence.fortyMHzIntolerant;
2124 pSirSmeHT2040CoexInfoInd->HT20MHzBssWidthReq =
2125 pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq;
2126 }
2127
2128 if (pFrm->HT2040BSSIntolerantReport.present)
2129 {
2130 limLog(pMac, LOGW, FL("operatingClass: %d num_channelList: %d "),
2131 pFrm->HT2040BSSIntolerantReport.operatingClass,
2132 num_channelList);
2133
2134 if (num_channelList > 0)
2135 {
2136 vos_mem_zero(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
2137 num_channelList);
2138 vos_mem_copy(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
2139 pFrm->HT2040BSSIntolerantReport.channelList,
2140 num_channelList);
2141
2142 pSirSmeHT2040CoexInfoInd->channel_num = num_channelList;
2143 }
2144
2145 for(i=0; i < num_channelList; i++)
2146 {
2147 limLog(pMac, LOGW, FL("Channel : %d "),
2148 pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i]);
2149 }
2150 }
2151
2152 mmhMsg.type = eWNI_SME_2040_COEX_IND;
2153 mmhMsg.bodyptr = pSirSmeHT2040CoexInfoInd;
2154 mmhMsg.bodyval = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302155 limLog(pMac, LOGW, FL("Posting eWNI_SME_2040_COEX_IND Message to SME "));
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002156 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2157
2158 vos_mem_free(pFrm);
2159}
2160#endif
2161
Jeff Johnson295189b2012-06-20 16:38:30 -07002162#ifdef WLAN_FEATURE_11W
2163/**
Chet Lanctot186b5732013-03-18 10:26:30 -07002164 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 *
2166 *FUNCTION:
2167 * This function is called by limProcessActionFrame() upon
2168 * SA query request Action frame reception.
2169 *
2170 *LOGIC:
2171 *
2172 *ASSUMPTIONS:
2173 *
2174 *NOTE:
2175 *
2176 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07002177 * @param *pRxPacketInfo - Handle to the Rx packet info
2178 * @param psessionEntry - PE session entry
2179 *
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 * @return None
2181 */
Chet Lanctot186b5732013-03-18 10:26:30 -07002182static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002183{
2184 tpSirMacMgmtHdr pHdr;
2185 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002186 tANI_U8 transId[2];
Jeff Johnson295189b2012-06-20 16:38:30 -07002187
2188 /* Prima --- Below Macro not available in prima
2189 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
2190 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
2191
2192 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2193 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2194
Chet Lanctot186b5732013-03-18 10:26:30 -07002195 /* If this is an unprotected SA Query Request, then ignore it. */
2196 if (pHdr->fc.wep == 0)
2197 return;
2198
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 /*Extract 11w trsansId from SA query request action frame
2200 In SA query response action frame we will send same transId
2201 In SA query request action frame:
2202 Category : 1 byte
2203 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07002204 Transaction ID : 2 bytes */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302205 vos_mem_copy(&transId[0], &pBody[2], 2);
Jeff Johnson295189b2012-06-20 16:38:30 -07002206
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 //Send 11w SA query response action frame
2208 if (limSendSaQueryResponseFrame(pMac,
2209 transId,
2210 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
2211 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002212 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 return;
2214 }
2215}
2216
Chet Lanctot186b5732013-03-18 10:26:30 -07002217/**
2218 * __limProcessSAQueryResponseActionFrame
2219 *
2220 *FUNCTION:
2221 * This function is called by limProcessActionFrame() upon
2222 * SA query response Action frame reception.
2223 *
2224 *LOGIC:
2225 *
2226 *ASSUMPTIONS:
2227 *
2228 *NOTE:
2229 *
2230 * @param pMac - Pointer to Global MAC structure
2231 * @param *pRxPacketInfo - Handle to the Rx packet info
2232 * @param psessionEntry - PE session entry
2233 * @return None
2234 */
2235static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
2236{
2237 tpSirMacMgmtHdr pHdr;
Chet Lanctot8cecea22014-02-11 19:09:36 -08002238 tANI_U8 *pBody;
2239 tpDphHashNode pSta;
2240 tANI_U16 aid;
2241 tANI_U16 transId;
2242 tANI_U8 retryNum;
Chet Lanctot186b5732013-03-18 10:26:30 -07002243
2244 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Chet Lanctot8cecea22014-02-11 19:09:36 -08002245 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Chet Lanctot186b5732013-03-18 10:26:30 -07002246 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2247 ("SA Query Response received...")) ;
Chet Lanctot186b5732013-03-18 10:26:30 -07002248
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07002249 /* When a station, supplicant handles SA Query Response.
2250 Forward to SME to HDD to wpa_supplicant. */
2251 if (eLIM_STA_ROLE == psessionEntry->limSystemRole)
2252 {
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302253 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302254 pRxPacketInfo, psessionEntry,
2255 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07002256 return;
2257 }
2258
Chet Lanctot8cecea22014-02-11 19:09:36 -08002259 /* If this is an unprotected SA Query Response, then ignore it. */
2260 if (pHdr->fc.wep == 0)
2261 return;
2262
2263 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2264 if (NULL == pSta)
2265 return;
2266
2267 limLog(pMac, LOG1,
2268 FL("SA Query Response source addr - %0x:%0x:%0x:%0x:%0x:%0x"),
2269 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
2270 pHdr->sa[4], pHdr->sa[5]);
2271 limLog(pMac, LOG1,
2272 FL("SA Query state for station - %d"), pSta->pmfSaQueryState);
2273
2274 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
2275 return;
2276
2277 /* Extract 11w trsansId from SA query reponse action frame
2278 In SA query response action frame:
2279 Category : 1 byte
2280 Action : 1 byte
2281 Transaction ID : 2 bytes */
2282 vos_mem_copy(&transId, &pBody[2], 2);
2283
2284 /* If SA Query is in progress with the station and the station
2285 responds then the association request that triggered the SA
2286 query is from a rogue station, just go back to initial state. */
2287 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
2288 if (transId == pSta->pmfSaQueryStartTransId + retryNum)
2289 {
2290 limLog(pMac, LOG1,
2291 FL("Found matching SA Query Request - transaction ID %d"), transId);
2292 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
2293 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
2294 break;
2295 }
2296}
Jeff Johnson295189b2012-06-20 16:38:30 -07002297#endif
2298
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002299#ifdef WLAN_FEATURE_11W
2300/**
2301 * limDropUnprotectedActionFrame
2302 *
2303 *FUNCTION:
2304 * This function checks if an Action frame should be dropped since it is
2305 * a Robust Managment Frame, it is unprotected, and it is received on a
2306 * connection where PMF is enabled.
2307 *
2308 *LOGIC:
2309 *
2310 *ASSUMPTIONS:
2311 *
2312 *NOTE:
2313 *
2314 * @param pMac - Global MAC structure
2315 * @param psessionEntry - PE session entry
2316 * @param pHdr - Frame header
2317 * @param category - Action frame category
2318 * @return TRUE if frame should be dropped
2319 */
2320
2321static tANI_BOOLEAN
2322limDropUnprotectedActionFrame (tpAniSirGlobal pMac, tpPESession psessionEntry,
2323 tpSirMacMgmtHdr pHdr, tANI_U8 category)
2324{
2325 tANI_U16 aid;
2326 tpDphHashNode pStaDs;
2327 tANI_BOOLEAN rmfConnection = eANI_BOOLEAN_FALSE;
2328
2329 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
2330 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
2331 {
2332 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2333 if (pStaDs != NULL)
2334 if (pStaDs->rmfEnabled)
2335 rmfConnection = eANI_BOOLEAN_TRUE;
2336 }
2337 else if (psessionEntry->limRmfEnabled)
2338 rmfConnection = eANI_BOOLEAN_TRUE;
2339
2340 if (rmfConnection && (pHdr->fc.wep == 0))
2341 {
2342 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2343 "since RMF is enabled."), category);)
2344 return eANI_BOOLEAN_TRUE;
2345 }
2346 else
2347 return eANI_BOOLEAN_FALSE;
2348}
2349#endif
2350
Jeff Johnson295189b2012-06-20 16:38:30 -07002351/**
2352 * limProcessActionFrame
2353 *
2354 *FUNCTION:
2355 * This function is called by limProcessMessageQueue() upon
2356 * Action frame reception.
2357 *
2358 *LOGIC:
2359 *
2360 *ASSUMPTIONS:
2361 *
2362 *NOTE:
2363 *
2364 * @param pMac - Pointer to Global MAC structure
2365 * @param *pRxPacketInfo - A pointer to packet info structure
2366 * @return None
2367 */
2368
2369void
2370limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2371{
2372 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2373 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002374#ifdef WLAN_FEATURE_11W
2375 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05302376
2377 if (lim_is_robust_mgmt_action_frame(pActionHdr->category) &&
2378 limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr,
2379 pActionHdr->category)) {
2380 limLog(pMac, LOGE,
2381 FL("Don't send unprotect action frame to upper layer categ %d "),
2382 pActionHdr->category);
2383 return;
2384 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002385#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002386
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 switch (pActionHdr->category)
2388 {
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05302389
2390 /*
2391 * WARNING: If you add Action frame category case here, set the
2392 * corresponding bit to 1 in sme_set_allowed_action_frames() for
2393 * the FW to hand over that frame to host without dropping itself
2394 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 case SIR_MAC_ACTION_QOS_MGMT:
Leela Venkata Kiran Kumar Reddy Chiralac7c4e7e2014-04-29 10:50:16 -07002396 if ( (psessionEntry->limQosEnabled) ||
2397 (pActionHdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 {
2399 switch (pActionHdr->actionID)
2400 {
2401 case SIR_MAC_QOS_ADD_TS_REQ:
2402 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2403 break;
2404
2405 case SIR_MAC_QOS_ADD_TS_RSP:
2406 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2407 break;
2408
2409 case SIR_MAC_QOS_DEL_TS_REQ:
2410 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2411 break;
2412
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002413 case SIR_MAC_QOS_MAP_CONFIGURE:
2414 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2415 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302417 limLog(pMac, LOG1,
2418 FL("Qos action %d not handled"),
2419 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002420 break;
2421 }
2422 break ;
2423 }
2424
2425 break;
2426
2427 case SIR_MAC_ACTION_SPECTRUM_MGMT:
2428 switch (pActionHdr->actionID)
2429 {
2430#ifdef ANI_SUPPORT_11H
2431 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2432 if(psessionEntry->lim11hEnable)
2433 {
2434 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2435 }
2436 break;
2437
2438 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2439 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2440 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2441 {
2442 if(psessionEntry->lim11hEnable)
2443 {
2444 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2445 }
2446 }
2447 break;
2448
2449#endif
2450 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2451 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2452 {
2453 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2454 }
2455 break;
2456 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302457 limLog(pMac, LOG1,
2458 FL("Spectrum mgmt action id %d not handled"),
2459 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 break;
2461 }
2462 break;
2463
2464 case SIR_MAC_ACTION_WME:
2465 if (! psessionEntry->limWmeEnabled)
2466 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002467 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 pActionHdr->actionID);
2469 break;
2470 }
2471 switch(pActionHdr->actionID)
2472 {
2473 case SIR_MAC_QOS_ADD_TS_REQ:
2474 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2475 break;
2476
2477 case SIR_MAC_QOS_ADD_TS_RSP:
2478 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2479 break;
2480
2481 case SIR_MAC_QOS_DEL_TS_REQ:
2482 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2483 break;
2484
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002485 case SIR_MAC_QOS_MAP_CONFIGURE:
2486 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2487 break;
2488
Jeff Johnson295189b2012-06-20 16:38:30 -07002489 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302490 limLog(pMac, LOG1, FL("WME action %d not handled"),
2491 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 break;
2493 }
2494 break;
2495
2496 case SIR_MAC_ACTION_BLKACK:
2497 // Determine the "type" of BA Action Frame
2498 switch(pActionHdr->actionID)
2499 {
2500 case SIR_MAC_BLKACK_ADD_REQ:
2501 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2502 break;
2503
2504 case SIR_MAC_BLKACK_ADD_RSP:
2505 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2506 break;
2507
2508 case SIR_MAC_BLKACK_DEL:
2509 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2510 break;
2511
2512 default:
2513 break;
2514 }
2515
2516 break;
2517 case SIR_MAC_ACTION_HT:
2518 /** Type of HT Action to be performed*/
2519 switch(pActionHdr->actionID) {
2520 case SIR_MAC_SM_POWER_SAVE:
2521 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2522 break;
2523 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302524 limLog(pMac, LOG1,
2525 FL("Action ID %d not handled in HT Action category"),
2526 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 break;
2528 }
2529 break;
2530
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002531 case SIR_MAC_ACTION_WNM:
2532 {
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002533 PELOGE(limLog(pMac, LOG1, FL("WNM Action category %d action %d."),
2534 pActionHdr->category, pActionHdr->actionID);)
2535 switch (pActionHdr->actionID)
2536 {
2537 case SIR_MAC_WNM_BSS_TM_QUERY:
2538 case SIR_MAC_WNM_BSS_TM_REQUEST:
2539 case SIR_MAC_WNM_BSS_TM_RESPONSE:
2540 case SIR_MAC_WNM_NOTIF_REQUEST:
2541 case SIR_MAC_WNM_NOTIF_RESPONSE:
2542 {
2543 tpSirMacMgmtHdr pHdr;
2544 tANI_S8 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
2545 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2546 /* Forward to the SME to HDD to wpa_supplicant */
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302547 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2548 pRxPacketInfo,
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002549 psessionEntry, rssi);
2550 break;
2551 }
2552 }
2553 break;
2554 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002555#if defined WLAN_FEATURE_VOWIFI
2556 case SIR_MAC_ACTION_RRM:
Abhishek Singhe0bc0992016-05-20 17:58:18 +05302557 /* Ignore RRM measurement request until DHCP is set */
2558 if(pMac->rrm.rrmPEContext.rrmEnable &&
2559 pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done)
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 {
2561 switch(pActionHdr->actionID) {
2562 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2563 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2564 break;
2565 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2566 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2567 break;
2568 case SIR_MAC_RRM_NEIGHBOR_RPT:
2569 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2570 break;
2571 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302572 limLog( pMac, LOG1, FL("Action ID %d not handled in RRM"),
2573 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 break;
2575
2576 }
2577 }
2578 else
2579 {
2580 // Else we will just ignore the RRM messages.
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302581 limLog( pMac, LOG1,
Abhishek Singhe0bc0992016-05-20 17:58:18 +05302582 FL("RRM Action frame ignored as rrmEnable is %d or DHCP not completed %d"),
2583 pMac->rrm.rrmPEContext.rrmEnable,
2584 pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done);
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 }
2586 break;
2587#endif
Abhishek Singh00b71972016-01-07 10:51:04 +05302588#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) \
2589 || defined (WLAN_FEATURE_RMC)
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002590 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2591 {
2592 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
2593 tpSirMacMgmtHdr pHdr;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002594 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2595
2596 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002597
2598 //Check if it is a vendor specific action frame.
2599 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302600 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002601 &pHdr->da[0], sizeof(tSirMacAddr))) &&
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002602 IS_WES_MODE_ENABLED(pMac) &&
2603 vos_mem_compare(pVendorSpecific->Oui, Oui, 3))
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002604 {
2605 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2606 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2607 /* Forward to the SME to HDD to wpa_supplicant */
2608 // type is ACTION
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302609 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2610 pRxPacketInfo,
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302611 psessionEntry, 0);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002612 }
Abhishek Singh00b71972016-01-07 10:51:04 +05302613#if defined (WLAN_FEATURE_RMC)
2614 else if ((eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole) &&
2615 ((VOS_TRUE == vos_mem_compare(SIR_MAC_RMC_MCAST_ADDRESS,
2616 &pHdr->da[0], sizeof(tSirMacAddr))) ||
2617 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
2618 &pHdr->da[0], sizeof(tSirMacAddr)))) &&
2619 vos_mem_compare(pVendorSpecific->Oui, SIR_MAC_RMC_OUI, 3))
2620 {
2621 tANI_U8 MagicCode[] =
2622 { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e };
2623 tpSirMacIbssExtNetworkFrameHdr pIbssExtHdr =
2624 (tpSirMacIbssExtNetworkFrameHdr) pActionHdr;
2625
2626 if (vos_mem_compare(pIbssExtHdr->MagicCode,
2627 MagicCode, sizeof(MagicCode)) &&
2628 pIbssExtHdr->version == SIR_MAC_RMC_VER )
2629 {
2630 switch (pIbssExtHdr->actionID)
2631 {
2632 default:
2633 PELOGE(limLog(pMac, LOGE,
2634 FL("Action RMC actionID %d not handled"),
2635 pIbssExtHdr->actionID);)
2636 break;
2637 case SIR_MAC_RMC_RULER_INFORM_SELECTED:
2638 limLog(pMac, LOG1,
2639 FL("Action RMC RULER_INFORM_SELECTED."));
2640 limProcessRMCMessages(pMac,
2641 eLIM_RMC_OTA_RULER_INFORM_SELECTED,
2642 (tANI_U32 *)pRxPacketInfo);
2643 break;
2644 case SIR_MAC_RMC_RULER_INFORM_CANCELLED:
2645 limLog(pMac, LOG1,
2646 FL("Action RMC RULER_INFORM_CANCELLED."));
2647 limProcessRMCMessages(pMac,
2648 eLIM_RMC_OTA_RULER_INFORM_CANCELLED,
2649 (tANI_U32 *)pRxPacketInfo);
2650 break;
2651 }
2652 }
2653 else
2654 {
2655 limLog( pMac, LOG1,
2656 FL("Dropping the vendor specific action frame in IBSS "
2657 "mode because of Ibss Ext Magic mismatch "
2658 MAC_ADDRESS_STR " or Version mismatch = %d"),
2659 MAC_ADDR_ARRAY(pIbssExtHdr->MagicCode),
2660 pIbssExtHdr->version );
2661 }
2662 }
2663#endif /* WLAN_FEATURE_RMC */
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002664 else
2665 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302666 limLog( pMac, LOG1,
2667 FL("Dropping the vendor specific action frame because of( "
2668 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
2669 "not received with SelfSta Mac address) system role = %d"),
2670 IS_WES_MODE_ENABLED(pMac),
2671 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2672 pVendorSpecific->Oui[2],
2673 psessionEntry->limSystemRole );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002674 }
2675 }
2676 break;
Abhishek Singh00b71972016-01-07 10:51:04 +05302677#endif /* WLAN_FEATURE_VOWIFI_11R || FEATURE_WLAN_ESE ||
2678 FEATURE_WLAN_LFR || WLAN_FEATURE_RMC */
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 case SIR_MAC_ACTION_PUBLIC_USAGE:
2680 switch(pActionHdr->actionID) {
2681 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2682 {
2683 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302685 tANI_U32 frameLen;
2686
2687 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2688
2689 if (frameLen < sizeof(pActionHdr)) {
2690 limLog(pMac, LOG1,
2691 FL("Received action frame of invalid len %d"),
2692 frameLen);
2693 break;
2694 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002695
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302697 if (vos_mem_compare(pPubAction->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 {
2699 /* Forward to the SME to HDD to wpa_supplicant */
2700 // type is ACTION
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302701 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2702 pRxPacketInfo,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302703 psessionEntry,
2704 WDA_GET_RX_RSSI_DB(pRxPacketInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 }
2706 else
2707 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302708 limLog( pMac, LOG1,
2709 FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
2710 pPubAction->Oui[0], pPubAction->Oui[1],
2711 pPubAction->Oui[2], pPubAction->Oui[3] );
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 }
2713 }
2714 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002715#ifdef WLAN_FEATURE_AP_HT40_24G
2716 case SIR_MAC_ACTION_2040_BSS_COEXISTENCE:
2717 {
2718 if (pMac->roam.configParam.apHT40_24GEnabled)
2719 {
2720 limLog( pMac, LOGW, FL("Public Action 20/40 BSS"
2721 "Coexistence Management frame"));
2722
2723 __limProcess2040bssCoexistenceActionFrame(pMac,
2724 psessionEntry->smeSessionId, (tANI_U8 *) pRxPacketInfo,
2725 psessionEntry);
2726 }
2727 break;
2728 }
2729#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002730#ifdef FEATURE_WLAN_TDLS
2731 case SIR_MAC_TDLS_DIS_RSP:
2732 {
Chilam NG571c65a2013-01-19 12:27:36 +05302733 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002734
Chilam NG571c65a2013-01-19 12:27:36 +05302735 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002736 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002737 ("Public Action TDLS Discovery RSP ..")) ;
Naveen Rawat71e1a2e2015-07-28 16:11:21 +05302738 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
2739 pRxPacketInfo,
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302740 psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002741 }
2742 break;
2743#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302744 case SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID:
2745 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2746 {
2747 lim_process_ecsa_action_frame(pMac,
2748 pRxPacketInfo, psessionEntry);
2749 }
2750 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302752 limLog(pMac, LOG1, FL("Unhandled public action frame -- %x "),
2753 pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 break;
2755 }
2756 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002757
2758#ifdef WLAN_FEATURE_11W
2759 case SIR_MAC_ACTION_SA_QUERY:
2760 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002761 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
2762 switch (pActionHdr->actionID)
2763 {
2764 case SIR_MAC_SA_QUERY_REQ:
2765 /**11w SA query request action frame received**/
2766 /* Respond directly to the incoming request in LIM */
2767 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2768 break;
2769 case SIR_MAC_SA_QUERY_RSP:
2770 /**11w SA query response action frame received**/
Chet Lanctot8cecea22014-02-11 19:09:36 -08002771 /* Handle based on the current SA Query state */
Chet Lanctot186b5732013-03-18 10:26:30 -07002772 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2773 break;
2774 default:
2775 break;
2776 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 break;
2778 }
2779#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002780#ifdef WLAN_FEATURE_11AC
2781 case SIR_MAC_ACTION_VHT:
2782 {
2783 if (psessionEntry->vhtCapability)
2784 {
2785 switch (pActionHdr->actionID)
2786 {
2787 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2788 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2789 break;
2790 default:
2791 break;
2792 }
2793 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002794 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002795 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002796#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302798 limLog(pMac, LOG1,
2799 FL("Action category %d not handled"), pActionHdr->category);
Jeff Johnson295189b2012-06-20 16:38:30 -07002800 break;
2801 }
2802}
2803
Jeff Johnson295189b2012-06-20 16:38:30 -07002804/**
2805 * limProcessActionFrameNoSession
2806 *
2807 *FUNCTION:
2808 * This function is called by limProcessMessageQueue() upon
2809 * Action frame reception and no session.
2810 * Currently only public action frames can be received from
2811 * a non-associated station.
2812 *
2813 *LOGIC:
2814 *
2815 *ASSUMPTIONS:
2816 *
2817 *NOTE:
2818 *
2819 * @param pMac - Pointer to Global MAC structure
2820 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2821 * @return None
2822 */
2823
2824void
2825limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2826{
2827 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2828 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2829
Mohit Khanna23863762012-09-11 17:40:09 -07002830 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002831
2832 switch ( pActionHdr->category )
2833 {
2834 case SIR_MAC_ACTION_PUBLIC_USAGE:
2835 switch(pActionHdr->actionID) {
2836 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2837 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
Vignesh Viswanathan3d7f6622017-09-15 17:45:58 +05302839 tANI_U32 frameLen;
2840
2841 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
2842
2843 if (frameLen < sizeof(pActionHdr)) {
2844 limLog(pMac, LOG1,
2845 FL("Received action frame of invalid len %d"),
2846 frameLen);
2847 break;
2848 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002849
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302851 if (vos_mem_compare(pActionHdr->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 {
2853 /* Forward to the SME to HDD to wpa_supplicant */
2854 // type is ACTION
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +05302855 limSendSmeMgmtFrameInd(pMac, 0, pBd, NULL,
2856 WDA_GET_RX_RSSI_DB(pBd));
Jeff Johnson295189b2012-06-20 16:38:30 -07002857 }
2858 else
2859 {
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302860 limLog( pMac, LOG1,
2861 FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
2862 pActionHdr->Oui[0], pActionHdr->Oui[1],
2863 pActionHdr->Oui[2], pActionHdr->Oui[3]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 }
2865 }
2866 break;
2867 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302868 limLog(pMac, LOG1,
2869 FL("Unhandled public action frame -- %x "), pActionHdr->actionID);
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 break;
2871 }
2872 break;
2873 default:
Abhishek Singh9ccfc772015-10-16 13:57:22 +05302874 limLog(pMac, LOG1,
2875 FL("Unhandled action frame without session -- %x "),
2876 pActionHdr->category);
2877 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002878
2879 }
2880}