blob: 29dbf7b9a000989e9389f09d1b849227064beb83 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file limProcessActionFrame.cc contains the code
44 * for processing Action Frame.
45 * Author: Michael Lui
46 * Date: 05/23/03
47 * History:-
48 * Date Modified by Modification Information
49 * --------------------------------------------------------------------
50 *
51 */
52#include "palTypes.h"
53#include "wniApi.h"
54#include "sirApi.h"
55#include "aniGlobal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070056#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "schApi.h"
58#include "utilsApi.h"
59#include "limTypes.h"
60#include "limUtils.h"
61#include "limAssocUtils.h"
62#include "limSecurityUtils.h"
63#include "limSerDesUtils.h"
64#include "limSendSmeRspMessages.h"
65#include "parserApi.h"
66#include "limAdmitControl.h"
67#include "wmmApsd.h"
68#include "limSendMessages.h"
69#if defined WLAN_FEATURE_VOWIFI
70#include "rrmApi.h"
71#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070072#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073
74#if defined FEATURE_WLAN_CCX
75#include "ccxApi.h"
76#endif
77#include "wlan_qct_wda.h"
78
79
80#define BA_DEFAULT_TX_BUFFER_SIZE 64
81
82typedef enum
83{
84 LIM_ADDBA_RSP = 0,
85 LIM_ADDBA_REQ = 1
86}tLimAddBaValidationReqType;
87
88/* Note: The test passes if the STAUT stops sending any frames, and no further
89 frames are transmitted on this channel by the station when the AP has sent
90 the last 6 beacons, with the channel switch information elements as seen
91 with the sniffer.*/
92#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
93/**-----------------------------------------------------------------
94\fn limStopTxAndSwitchChannel
95\brief Stops the transmission if channel switch mode is silent and
96 starts the channel switch timer.
97
98\param pMac
99\return NONE
100-----------------------------------------------------------------*/
101void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
102{
103 tANI_U8 isFullPowerRequested = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700104 tpPESession psessionEntry;
105
106 psessionEntry = peFindSessionBySessionId( pMac , sessionId );
107
108 if( NULL == psessionEntry )
109 {
110 limLog(pMac, LOGE, FL("Session %d not active\n "), sessionId);
111 return;
112 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700113
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700114 PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700115 psessionEntry->gLimChannelSwitch.switchMode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700116
Jeff Johnsone7245742012-09-05 17:12:55 -0700117 if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
118 psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700119 {
120 /* Freeze the transmission */
121 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
122
123 /*Request for Full power only if the device is in powersave*/
124 if(!limIsSystemInActiveState(pMac))
125 {
126 /* Request Full Power */
127 limSendSmePreChannelSwitchInd(pMac);
128 isFullPowerRequested = 1;
129 }
130 }
131 else
132 {
133 /* Resume the transmission */
134 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
135 }
136
Jeff Johnsone7245742012-09-05 17:12:55 -0700137 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700138 /* change the channel immediatly only if the channel switch count is 0 and the
139 * device is not in powersave
140 * If the device is in powersave channel switch should happen only after the
141 * device comes out of the powersave */
Jeff Johnsone7245742012-09-05 17:12:55 -0700142 if (psessionEntry->gLimChannelSwitch.switchCount == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700143 {
144 if(limIsSystemInActiveState(pMac))
145 {
146 limProcessChannelSwitchTimeout(pMac);
147 }
148 else if(!isFullPowerRequested)
149 {
150 /* If the Full power is already not requested
151 * Request Full Power so the channel switch happens
152 * after device comes to full power */
153 limSendSmePreChannelSwitchInd(pMac);
154 }
155 return;
156 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -0800157 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700158
Jeff Johnson295189b2012-06-20 16:38:30 -0700159
160 if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
161 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700162 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700163 }
164 return;
165}
166
167/**------------------------------------------------------------
168\fn limStartChannelSwitch
169\brief Switches the channel if switch count == 0, otherwise
170 starts the timer for channel switch and stops BG scan
171 and heartbeat timer tempororily.
172
173\param pMac
174\param psessionEntry
175\return NONE
176------------------------------------------------------------*/
177tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
178{
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700179 PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700180
181 /*If channel switch is already running and it is on a different session, just return*/
182 /*This need to be removed for MCC */
183 if( limIsChanSwitchRunning (pMac) &&
184 psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
185 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700186 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d"), psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700187 return eSIR_SUCCESS;
188 }
189
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 /* Deactivate and change reconfigure the timeout value */
Jeff Johnsone7245742012-09-05 17:12:55 -0700191 //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800192 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnsone7245742012-09-05 17:12:55 -0700193 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
194 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700195 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700196 return eSIR_FAILURE;
197 }
198
199 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
200 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
201 0) != TX_SUCCESS)
202 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700203 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnsone7245742012-09-05 17:12:55 -0700204 return eSIR_FAILURE;
205 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700206
207 /* Follow the channel switch, forget about the previous quiet. */
208 //If quiet is running, chance is there to resume tx on its timeout.
209 //so stop timer for a safer side.
Jeff Johnsone7245742012-09-05 17:12:55 -0700210 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700212 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700213 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
214 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700215 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 return eSIR_FAILURE;
217 }
218 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700219 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700220 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700221 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
223 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700224 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 return eSIR_FAILURE;
226 }
227 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700228 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700229
230 /* Prepare for 11h channel switch */
231 limPrepareFor11hChannelSwitch(pMac, psessionEntry);
232
233 /** Dont add any more statements here as we posted finish scan request
234 * to HAL, wait till we get the response
235 */
236 return eSIR_SUCCESS;
237}
238
239
240/**
241 * __limProcessChannelSwitchActionFrame
242 *
243 *FUNCTION:
244 *
245 *LOGIC:
246 *
247 *ASSUMPTIONS:
248 *
249 *NOTE:
250 *
251 * @param pMac - Pointer to Global MAC structure
252 * @param *pRxPacketInfo - A pointer to packet info structure
253 * @return None
254 */
255
256static void
257
258__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
259{
260
261 tpSirMacMgmtHdr pHdr;
262 tANI_U8 *pBody;
263 tDot11fChannelSwitch *pChannelSwitchFrame;
264 tANI_U16 beaconPeriod;
265 tANI_U32 val;
266 tANI_U32 frameLen;
267 tANI_U32 nStatus;
268 eHalStatus status;
269
270 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
271 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
272 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
273
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700274 PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 if (!psessionEntry->lim11hEnable)
276 return;
277
278 status = palAllocateMemory( pMac->hHdd, (void **)&pChannelSwitchFrame, sizeof(*pChannelSwitchFrame));
279 if (eHAL_STATUS_SUCCESS != status)
280 {
281 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700282 FL("palAllocateMemory failed, status = %d "), status);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return;
284 }
285
286 /* Unpack channel switch frame */
287 nStatus = dot11fUnpackChannelSwitch(pMac, pBody, frameLen, pChannelSwitchFrame);
288
289 if( DOT11F_FAILED( nStatus ))
290 {
291 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700292 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 nStatus,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700294 frameLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
296 return;
297 }
298 else if(DOT11F_WARNED( nStatus ))
299 {
300 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700301 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 nStatus,
303 frameLen);
304 }
305
306 if (palEqualMemory( pMac->hHdd,(tANI_U8 *) &psessionEntry->bssId,
307 (tANI_U8 *) &pHdr->sa,
308 sizeof(tSirMacAddr)))
309 {
310 #if 0
311 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
312 {
313 palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700314 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 return;
316 }
317 #endif// TO SUPPORT BT-AMP
318
319 /* copy the beacon interval from psessionEntry*/
320 val = psessionEntry->beaconParams.beaconInterval;
321
322 beaconPeriod = (tANI_U16) val;
323
Jeff Johnsone7245742012-09-05 17:12:55 -0700324 psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
325 psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
326 psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
327 psessionEntry->gLimChannelSwitch.switchCount;
328 psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700329#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700330 if ( pChannelSwitchFrame->WiderBWChanSwitchAnn.present && psessionEntry->vhtCapability)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700331 {
332 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth;
333 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0;
334 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq1;
335 }
336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700337
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700338 PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700339 psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700340
341 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -0700342 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
343 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700344
Jeff Johnsone7245742012-09-05 17:12:55 -0700345 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700347 if ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
348 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700350 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
351 psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700353#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700354 if(psessionEntry->vhtCapability && pChannelSwitchFrame->WiderBWChanSwitchAnn.present)
355 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700356 if (pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
357 {
358 if (pChannelSwitchFrame->ExtChanSwitchAnn.present && ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
359 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)))
360 {
361 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700362 psessionEntry->gLimChannelSwitch.secondarySubBand =
363 limGet11ACPhyCBState(pMac,
364 psessionEntry->gLimChannelSwitch.primaryChannel,
365 pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset,
366 pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0,
367 psessionEntry);
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700368 }
369 }
370 }
371#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 }
373
374 }
375 else
376 {
377 PELOG1(limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));)
378 }
379
380 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
381 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700382 PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 }
384
385 palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
386 return;
387} /*** end limProcessChannelSwitchActionFrame() ***/
388
389
Mohit Khanna4a70d262012-09-11 16:30:12 -0700390#ifdef WLAN_FEATURE_11AC
391static void
392__limProcessOperatingModeActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
393{
394
395 tpSirMacMgmtHdr pHdr;
396 tANI_U8 *pBody;
397 tDot11fOperatingMode *pOperatingModeframe;
398 tANI_U32 frameLen;
399 tANI_U32 nStatus;
400 eHalStatus status;
401 tpDphHashNode pSta;
402 tANI_U16 aid;
403 tANI_U8 operMode;
404
405 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
406 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
407 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
408
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700409 PELOG3(limLog(pMac, LOG3, FL("Received Operating Mode action frame"));)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700410 status = palAllocateMemory( pMac->hHdd, (void **)&pOperatingModeframe, sizeof(*pOperatingModeframe));
411 if (eHAL_STATUS_SUCCESS != status)
412 {
413 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700414 FL("palAllocateMemory failed, status = %d "), status);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700415 return;
416 }
417
418 /* Unpack channel switch frame */
419 nStatus = dot11fUnpackOperatingMode(pMac, pBody, frameLen, pOperatingModeframe);
420
421 if( DOT11F_FAILED( nStatus ))
422 {
423 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700424 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700425 nStatus,
426 frameLen);
427 palFreeMemory(pMac->hHdd, pOperatingModeframe);
428 return;
429 }
430 else if(DOT11F_WARNED( nStatus ))
431 {
432 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700433 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700434 nStatus,
435 frameLen);
436 }
437 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
438
439 operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
440 if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
441 {
442 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700443 FL(" received Chanwidth %d, staIdx = %d"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700444 (pOperatingModeframe->OperatingMode.chanWidth ),
445 pSta->staIndex);
446
447 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700448 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700449 pHdr->sa[0],
450 pHdr->sa[1],
451 pHdr->sa[2],
452 pHdr->sa[3],
453 pHdr->sa[4],
454 pHdr->sa[5]);
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700455
Mohit Khanna4a70d262012-09-11 16:30:12 -0700456 if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
457 {
458 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
459 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
460 }
461 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
462 {
463 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
464 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
465 }
466 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
467 {
468 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
469 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
470 }
471 limCheckVHTOpModeChange( pMac, psessionEntry,
472 (pOperatingModeframe->OperatingMode.chanWidth), pSta->staIndex);\
473 }
474 palFreeMemory(pMac->hHdd, pOperatingModeframe);
475 return;
476}
477#endif
478
Jeff Johnson295189b2012-06-20 16:38:30 -0700479static void
480__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
481{
Jeff Johnson295189b2012-06-20 16:38:30 -0700482}
483
484
485static void
486__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
487{
488 tSirAddtsRspInfo addts;
489 tSirRetStatus retval;
490 tpSirMacMgmtHdr pHdr;
491 tpDphHashNode pSta;
492 tANI_U16 aid;
493 tANI_U32 frameLen;
494 tANI_U8 *pBody;
495 tpLimTspecInfo tspecInfo;
496 tANI_U8 ac;
497 tpDphHashNode pStaDs = NULL;
498 tANI_U8 rspReqd = 1;
499 tANI_U32 cfgLen;
500 tSirMacAddr peerMacAddr;
501
502
503 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
504 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
505 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
506
507
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700508 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
510 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700511 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 return;
513 }
514
515 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
516 if (pSta == NULL)
517 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700518 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 return;
520 }
521
522 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
523 if (retval != eSIR_SUCCESS)
524 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700525 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 return;
527 }
528
529 // don't have to check for qos/wme capabilities since we wouldn't have this
530 // flag set otherwise
531 if (! pMac->lim.gLimAddtsSent)
532 {
533 // we never sent an addts request!
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700534 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 return;
536 }
537
538 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
539 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700540 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring",
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
542 return;
543 }
544
545 /*
546 * for successful addts reponse, try to add the classifier.
547 * if this fails for any reason, we should send a delts request to the ap
548 * for now, its ok not to send a delts since we are going to add support for
549 * multiple tclas soon and until then we won't send any addts requests with
550 * multiple tclas elements anyway.
551 * In case of addClassifier failure, we just let the addts timer run out
552 */
553 if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
554 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
555 (addts.status == eSIR_MAC_SUCCESS_STATUS))
556 {
557 // add the classifier - this should always succeed
558 if (addts.numTclas > 1) // currently no support for multiple tclas elements
559 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700560 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 aid, addts.numTclas);
562 return;
563 }
564 else if (addts.numTclas == 1)
565 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700566 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!", aid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
568 }
569 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700570 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
572 addts.status);
573
574 // deactivate the response timer
575 limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
576
577 if (addts.status != eSIR_MAC_SUCCESS_STATUS)
578 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700579 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
581 addts.status);
582 limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
583 psessionEntry->smeSessionId, psessionEntry->transactionId);
584
585 // clear the addts flag
586 pMac->lim.gLimAddtsSent = false;
587
588 return;
589 }
590#ifdef FEATURE_WLAN_CCX
591 if (addts.tsmPresent)
592 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700593 limLog(pMac, LOGW, "TSM IE Present");
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 psessionEntry->ccxContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
595 vos_mem_copy(&psessionEntry->ccxContext.tsm.tsmInfo,
596 &addts.tsmIE,sizeof(tSirMacCCXTSMIE));
597 limActivateTSMStatsTimer(pMac, psessionEntry);
598 }
599#endif
600 /* Since AddTS response was successful, check for the PSB flag
601 * and directional flag inside the TS Info field.
602 * An AC is trigger enabled AC if the PSB subfield is set to 1
603 * in the uplink direction.
604 * An AC is delivery enabled AC if the PSB subfield is set to 1
605 * in the downlink direction.
606 * An AC is trigger and delivery enabled AC if the PSB subfield
607 * is set to 1 in the bi-direction field.
608 */
609 if (addts.tspec.tsinfo.traffic.psb == 1)
610 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
611 else
612 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
613
614
615 /* ADDTS success, so AC is now admitted. We shall now use the default
616 * EDCA parameters as advertised by AP and send the updated EDCA params
617 * to HAL.
618 */
619 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
620 if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
621 {
622 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
623 }
624 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
625 {
626 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
627 }
628 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
629 {
630 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
631 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
632 }
633
634 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
635
636 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
637 if (pStaDs != NULL)
638 {
639 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
640 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
641 else
642 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
643 }
644 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700645 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700646
647
648 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
649
650 //if schedule is not present then add TSPEC with svcInterval as 0.
651 if(!addts.schedulePresent)
652 addts.schedule.svcInterval = 0;
653 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
654 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700655 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
657 psessionEntry);
658 pMac->lim.gLimAddtsSent = false;
659 return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
660 }
661 if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
662 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC) &&
663 (psessionEntry->gLimEdcaParams[upToAc(addts.tspec.tsinfo.traffic.userPrio)].aci.acm)))
664 {
665 retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
666 if(eSIR_SUCCESS != retval)
667 {
668 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
669
670 // Send DELTS action frame to AP
671 cfgLen = sizeof(tSirMacAddr);
672 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
673 psessionEntry);
674 limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
675 psessionEntry->smeSessionId, psessionEntry->transactionId);
676 pMac->lim.gLimAddtsSent = false;
677 return;
678 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700679 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
681 }
682 else
683 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700684 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700686 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 // Use the smesessionId and smetransactionId from the PE session context
688 limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
689 psessionEntry->smeSessionId, psessionEntry->transactionId);
690 }
691
692 // clear the addts flag
693 pMac->lim.gLimAddtsSent = false;
694 return;
695}
696
697
698static void
699__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
700{
701 tSirRetStatus retval;
702 tSirDeltsReqInfo delts;
703 tpSirMacMgmtHdr pHdr;
704 tpDphHashNode pSta;
705 tANI_U32 frameLen;
706 tANI_U16 aid;
707 tANI_U8 *pBody;
708 tANI_U8 tsStatus;
709 tSirMacTSInfo *tsinfo;
710 tANI_U8 tspecIdx;
711 tANI_U8 ac;
712 tpDphHashNode pStaDs = NULL;
713
714
715 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
716 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
717 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
718
719 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
720 if (pSta == NULL)
721 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700722 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 return;
724 }
725
726 // parse the delts request
727 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
728 if (retval != eSIR_SUCCESS)
729 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700730 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 return;
732 }
733
734 if (delts.wmeTspecPresent)
735 {
736 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
737 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700738 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 return;
740 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700741 PELOG2(limLog(pMac, LOG2, FL("WME Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 }
743 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
744 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700745 PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 }
747 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
748 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700749 PELOG2(limLog(pMac, LOG2, FL("WSM Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 }
751 else
752 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700753 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 return;
755 }
756
757 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
758
759 // if no Admit Control, ignore the request
760 if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
761 {
762
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 if ((upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC) || (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm))
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700765 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 tsinfo->traffic.userPrio);
767 return;
768 }
769 }
770
771 // try to delete the TS
772 if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
773 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700774 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 return;
776 }
777
778 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
779 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
780 {
781 //Edca only for now.
782 }
783 else
784 {
785 //send message to HAL to delete TS
Jeff Johnsone7245742012-09-05 17:12:55 -0700786 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts, psessionEntry->peSessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700788 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 tsinfo->traffic.userPrio);
790 return;
791 }
792 }
793
794 /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
795 * The AC for this TSPEC is no longer trigger enabled if this Tspec
796 * was set-up in uplink direction only.
797 * The AC for this TSPEC is no longer delivery enabled if this Tspec
798 * was set-up in downlink direction only.
799 * The AC for this TSPEC is no longer triiger enabled and delivery
800 * enabled if this Tspec was a bidirectional TSPEC.
801 */
802 limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
803
804
805 /* We're deleting the TSPEC.
806 * The AC for this TSPEC is no longer admitted in uplink/downlink direction
807 * if this TSPEC was set-up in uplink/downlink direction only.
808 * The AC for this TSPEC is no longer admitted in both uplink and downlink
809 * directions if this TSPEC was a bi-directional TSPEC.
810 * If ACM is set for this AC and this AC is admitted only in downlink
811 * direction, PE needs to downgrade the EDCA parameter
812 * (for the AC for which TS is being deleted) to the
813 * next best AC for which ACM is not enabled, and send the
814 * updated values to HAL.
815 */
816 ac = upToAc(tsinfo->traffic.userPrio);
817
818 if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
819 {
820 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
821 }
822 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
823 {
824 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
825 }
826 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
827 {
828 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
829 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
830 }
831
832 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
833
834 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
835 if (pStaDs != NULL)
836 {
837 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
838 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
839 else
840 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
841 }
842 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700843 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700844
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700845 PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 if((psessionEntry->limSystemRole != eLIM_AP_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
847 limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
848
849#ifdef FEATURE_WLAN_CCX
850 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
851#endif
852
853}
854
855
856#ifdef ANI_SUPPORT_11H
857/**
858 * limProcessBasicMeasReq
859 *
860 *FUNCTION:
861 * This function is called by limProcessMeasurementRequestFrame()
862 * when it received a Basic measurement Request action frame.
863 * Station/BP receiving this should perform basic measurements
864 * and then send Basic Measurement Report. AP should not perform
865 * any measurements, and send report indicating refusal.
866 *
867 *LOGIC:
868 *
869 *ASSUMPTIONS:
870 *
871 *NOTE:
872 *
873 * @param pMac - Pointer to Global MAC structure
874 * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
875 * @return None
876 */
877static void
878__limProcessBasicMeasReq(tpAniSirGlobal pMac,
879 tpSirMacMeasReqActionFrame pMeasReqFrame,
880 tSirMacAddr peerMacAddr)
881{
882 // TBD - Station shall perform basic measurements
883
884 if (limSendMeasReportFrame(pMac,
885 pMeasReqFrame,
886 peerMacAddr) != eSIR_SUCCESS)
887 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700888 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 return;
890 }
891}
892
893
894/**
895 * limProcessCcaMeasReq
896 *
897 *FUNCTION:
898 * This function is called by limProcessMeasurementRequestFrame()
899 * when it received a CCA measurement Request action frame.
900 * Station/BP receiving this should perform CCA measurements
901 * and then send CCA Measurement Report. AP should not perform
902 * any measurements, and send report indicating refusal.
903 *
904 *LOGIC:
905 *
906 *ASSUMPTIONS:
907 *
908 *NOTE:
909 *
910 * @param pMac - Pointer to Global MAC structure
911 * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
912 * @return None
913 */
914static void
915__limProcessCcaMeasReq(tpAniSirGlobal pMac,
916 tpSirMacMeasReqActionFrame pMeasReqFrame,
917 tSirMacAddr peerMacAddr)
918{
919 // TBD - Station shall perform cca measurements
920
921 if (limSendMeasReportFrame(pMac,
922 pMeasReqFrame,
923 peerMacAddr) != eSIR_SUCCESS)
924 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700925 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 return;
927 }
928}
929
930
931/**
932 * __limProcessRpiMeasReq
933 *
934 *FUNCTION:
935 * This function is called by limProcessMeasurementRequestFrame()
936 * when it received a RPI measurement Request action frame.
937 * Station/BP/AP receiving this shall not perform any measurements,
938 * and send report indicating refusal.
939 *
940 *LOGIC:
941 *
942 *ASSUMPTIONS:
943 *
944 *NOTE:
945 *
946 * @param pMac - Pointer to Global MAC structure
947 * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
948 * @return None
949 */
950static void
951__limProcessRpiMeasReq(tpAniSirGlobal pMac,
952 tpSirMacMeasReqActionFrame pMeasReqFrame,
953 tSirMacAddr peerMacAddr)
954{
955 if (limSendMeasReportFrame(pMac,
956 pMeasReqFrame,
957 peerMacAddr) != eSIR_SUCCESS)
958 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700959 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 return;
961 }
962}
963
964
965/**
966 * __limProcessMeasurementRequestFrame
967 *
968 *FUNCTION:
969 *
970 *LOGIC:
971 *
972 *ASSUMPTIONS:
973 *
974 *NOTE:
975 *
976 * @param pMac - Pointer to Global MAC structure
977 * @param *pRxPacketInfo - A pointer to packet info structure
978 * @return None
979 */
980
981static void
982__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
983{
984 tpSirMacMgmtHdr pHdr;
985 tANI_U8 *pBody;
986 tpSirMacMeasReqActionFrame pMeasReqFrame;
987 tANI_U32 frameLen;
988
989 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
990 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
991 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
992
993 if ( eHAL_STATUS_SUCCESS !=
994 palAllocateMemory( pMac->hHdd, (void **)&pMeasReqFrame, sizeof( tSirMacMeasReqActionFrame ) ) )
995 {
996 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700997 FL("limProcessMeasurementRequestFrame: palAllocateMemory failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700998 return;
999 }
1000
1001 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1002 eSIR_SUCCESS)
1003 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001004 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 return;
1006 }
1007
1008
1009 switch(pMeasReqFrame->measReqIE.measType)
1010 {
1011 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
1012 __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1013 break;
1014
1015 case SIR_MAC_CCA_MEASUREMENT_TYPE:
1016 __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1017 break;
1018
1019 case SIR_MAC_RPI_MEASUREMENT_TYPE:
1020 __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1021 break;
1022
1023 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001024 PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 pMeasReqFrame->measReqIE.measType);)
1026 break;
1027 }
1028
1029} /*** end limProcessMeasurementRequestFrame ***/
1030
1031
1032/**
1033 * limProcessTpcRequestFrame
1034 *
1035 *FUNCTION:
1036 * This function is called upon receiving Tpc Request frame.
1037 *
1038 *NOTE:
1039 *
1040 * @param pMac - Pointer to Global MAC structure
1041 * @param *pRxPacketInfo - A pointer to packet info structure
1042 * @return None
1043 */
1044
1045static void
1046__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1047{
1048 tpSirMacMgmtHdr pHdr;
1049 tANI_U8 *pBody;
1050 tpSirMacTpcReqActionFrame pTpcReqFrame;
1051 tANI_U32 frameLen;
1052
1053 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1054 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1055 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1056
1057 PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
1058
1059 if ( eHAL_STATUS_SUCCESS !=
1060 palAllocateMemory( pMac->hHdd, (void **)&pTpcReqFrame, sizeof( tSirMacTpcReqActionFrame ) ) )
1061 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001062 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 return;
1064 }
1065
1066 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1067 eSIR_SUCCESS)
1068 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001069 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 return;
1071 }
1072
1073 if (limSendTpcReportFrame(pMac,
1074 pTpcReqFrame,
1075 pHdr->sa) != eSIR_SUCCESS)
1076 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001077 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 return;
1079 }
1080}
1081#endif
1082
1083
1084/**
1085 * \brief Validate an ADDBA Req from peer with respect
1086 * to our own BA configuration
1087 *
1088 * \sa __limValidateAddBAParameterSet
1089 *
1090 * \param pMac The global tpAniSirGlobal object
1091 *
1092 * \param baParameterSet The ADDBA Parameter Set.
1093 *
1094 * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
1095 * delBAFlag is set when entry already exists.
1096 *
1097 * \param reqType ADDBA Req v/s ADDBA Rsp
1098 * 1 - ADDBA Req
1099 * 0 - ADDBA Rsp
1100 *
1101 * \return eSIR_SUCCESS if setup completes successfully
1102 * eSIR_FAILURE is some problem is encountered
1103 */
1104
1105static tSirMacStatusCodes
1106__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
1107 tpDphHashNode pSta,
1108 tDot11fFfAddBAParameterSet baParameterSet,
1109 tANI_U8 dialogueToken,
1110 tLimAddBaValidationReqType reqType ,
1111 tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
1112{
1113 if(baParameterSet.tid >= STACFG_MAX_TC)
1114 {
1115 return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
1116 }
1117
1118 //check if there is already a BA session setup with this STA/TID while processing AddBaReq
1119 if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
1120 (LIM_ADDBA_REQ == reqType))
1121 {
1122 //There is already BA session setup for STA/TID.
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001123 limLog( pMac, LOGE,
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
1125 pSta->staIndex, baParameterSet.tid);
1126 limPrintMacAddr( pMac, pSta->staAddr, LOGW );
1127
1128 if(pDelBAFlag)
1129 *pDelBAFlag = true;
1130 }
1131 return eSIR_MAC_SUCCESS_STATUS;
1132}
1133
1134/**
1135 * \brief Validate a DELBA Ind from peer with respect
1136 * to our own BA configuration
1137 *
1138 * \sa __limValidateDelBAParameterSet
1139 *
1140 * \param pMac The global tpAniSirGlobal object
1141 *
1142 * \param baParameterSet The DELBA Parameter Set.
1143 *
1144 * \param pSta Runtime, STA-related configuration cached
1145 * in the HashNode object
1146 *
1147 * \return eSIR_SUCCESS if setup completes successfully
1148 * eSIR_FAILURE is some problem is encountered
1149 */
1150static tSirMacStatusCodes
1151__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
1152 tDot11fFfDelBAParameterSet baParameterSet,
1153 tpDphHashNode pSta )
1154{
1155tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
1156
1157 // Validate if a BA is active for the requested TID
1158 if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
1159 pSta->tcCfg[baParameterSet.tid].fUseBARx )
1160 {
1161 statusCode = eSIR_MAC_SUCCESS_STATUS;
1162
1163 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001164 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 }
1166 else
1167 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001168 FL("Received an INVALID DELBA Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 baParameterSet.tid );
1170
1171 return statusCode;
1172}
1173
1174/**
1175 * \brief Process an ADDBA REQ
1176 *
1177 * \sa limProcessAddBAReq
1178 *
1179 * \param pMac The global tpAniSirGlobal object
1180 *
1181 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1182 *
1183 * \return none
1184 *
1185 */
1186static void
1187__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1188{
1189 tDot11fAddBAReq frmAddBAReq;
1190 tpSirMacMgmtHdr pHdr;
1191 tpDphHashNode pSta;
1192 tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
1193 tANI_U16 aid;
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001194 tANI_U32 frameLen, nStatus,val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 tANI_U8 *pBody;
1196 tANI_U8 delBAFlag =0;
1197
1198 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1199 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1200 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001201 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001202
1203 // Unpack the received frame
1204 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1205 if( DOT11F_FAILED( nStatus ))
1206 {
1207 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001208 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 nStatus,
1210 frameLen );
1211
1212 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1213
1214 // Without an unpacked request we cannot respond, so silently ignore the request
1215 return;
1216 }
1217 else if ( DOT11F_WARNED( nStatus ) )
1218 {
1219 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001220 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001221 nStatus,
1222 frameLen );
1223
1224 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1225 }
1226
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001227 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1228
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1230 if( pSta == NULL )
1231 {
1232 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001233 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001234 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001235
1236 // FIXME - Should we do this?
1237 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1238 goto returnAfterError;
1239 }
1240
1241 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001242 FL( "ADDBA Req from STA with AID %d, tid = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 aid, frmAddBAReq.AddBAParameterSet.tid);
1244
1245#ifdef WLAN_SOFTAP_VSTA_FEATURE
1246 // we can only do BA on "hard" STAs
1247 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1248 {
1249 status = eSIR_MAC_REQ_DECLINED_STATUS;
1250 goto returnAfterError;
1251 }
1252#endif //WLAN_SOFTAP_VSTA_FEATURE
1253
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001254 if (wlan_cfgGetInt(pMac, WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC, &val) !=
1255 eSIR_SUCCESS)
1256 {
1257 limLog(pMac, LOGE,
1258 FL("Unable to get WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC"));
1259 val = 0;
1260 }
1261 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1262 val)
1263 {
1264 limLog( pMac, LOGW,
1265 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1266 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1267
1268 status = eSIR_MAC_REQ_DECLINED_STATUS;
1269 goto returnAfterError;
1270 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001271
1272 // Now, validate the ADDBA Req
1273 if( eSIR_MAC_SUCCESS_STATUS !=
1274 (status = __limValidateAddBAParameterSet( pMac, pSta,
1275 frmAddBAReq.AddBAParameterSet,
1276 0, //dialogue token is don't care in request validation.
1277 LIM_ADDBA_REQ, &delBAFlag)))
1278 goto returnAfterError;
1279
1280 //BA already set, so we need to delete it before adding new one.
1281 if(delBAFlag)
1282 {
1283 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1284 pSta,
1285 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1286 eBA_RECIPIENT,psessionEntry))
1287 {
1288 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1289 goto returnAfterError;
1290 }
1291 }
1292
1293 // Check if the ADD BA Declined configuration is Disabled
1294 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001295 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 frmAddBAReq.AddBAParameterSet.tid);
1297 status = eSIR_MAC_REQ_DECLINED_STATUS;
1298 goto returnAfterError;
1299 }
1300
1301 //
1302 // Post WDA_ADDBA_REQ to HAL.
1303 // If HAL/HDD decide to allow this ADDBA Req session,
1304 // then this BA session is termed active
1305 //
1306
1307 // Change the Block Ack state of this STA to wait for
1308 // ADDBA Rsp from HAL
1309 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001310
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001311 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001312 {
1313 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001314 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001315 }
1316
1317
1318 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1319 {
1320 frmAddBAReq.AddBAParameterSet.bufferSize =
1321 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1322 }
1323 else
1324 {
1325 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1326 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001327 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001328 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001329
1330 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1331 pSta,
1332 (tANI_U8) frmAddBAReq.DialogToken.token,
1333 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1334 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1335 frmAddBAReq.AddBAParameterSet.bufferSize,
1336 frmAddBAReq.BATimeout.timeout,
1337 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1338 eBA_RECIPIENT,psessionEntry))
1339 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1340 else
1341 return;
1342
1343returnAfterError:
1344
1345 //
1346 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1347 // status code. MLME will then send an ADDBA RSP
1348 // over the air to the peer MAC entity
1349 //
1350 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1351 pHdr->sa,
1352 status,
1353 frmAddBAReq.DialogToken.token,
1354 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1355 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1356 frmAddBAReq.AddBAParameterSet.bufferSize,
1357 frmAddBAReq.BATimeout.timeout,psessionEntry))
1358 {
1359 limLog( pMac, LOGW,
1360 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1361 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1362 }
1363
1364}
1365
1366/**
1367 * \brief Process an ADDBA RSP
1368 *
1369 * \sa limProcessAddBARsp
1370 *
1371 * \param pMac The global tpAniSirGlobal object
1372 *
1373 * \param pRxPacketInfo Handle to the packet info structure from HDD
1374 *
1375 * \return none
1376 *
1377 */
1378static void
1379__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1380{
1381tDot11fAddBARsp frmAddBARsp;
1382tpSirMacMgmtHdr pHdr;
1383tpDphHashNode pSta;
1384tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1385tANI_U16 aid;
1386tANI_U32 frameLen, nStatus;
1387tANI_U8 *pBody;
1388
1389 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1390 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1391 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1392
1393 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1394 if( pSta == NULL )
1395 {
1396 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001397 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1399 return;
1400 }
1401
1402#ifdef WLAN_SOFTAP_VSTA_FEATURE
1403 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1404 // Request, so we should never be processing a ADDBA Response
1405 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1406 {
1407 return;
1408 }
1409#endif //WLAN_SOFTAP_VSTA_FEATURE
1410
1411 // Unpack the received frame
1412 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1413 if( DOT11F_FAILED( nStatus ))
1414 {
1415 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001416 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 nStatus,
1418 frameLen );
1419
1420 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1421 goto returnAfterError;
1422 }
1423 else if ( DOT11F_WARNED( nStatus ) )
1424 {
1425 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001426 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 nStatus,
1428 frameLen );
1429
1430 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1431 }
1432
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001433 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001434 FL( "ADDBA Rsp from STA with AID %d, tid = %d, status = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 aid, frmAddBARsp.AddBAParameterSet.tid, frmAddBARsp.Status.status);
1436
1437 //if there is no matchin dialougue token then ignore the response.
1438
1439 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1440 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1441 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001442 PELOGW(limLog(pMac, LOGE, FL("dialogueToken in received addBARsp did not match with outstanding requests"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 return;
1444 }
1445
1446 // Check first if the peer accepted the ADDBA Req
1447 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1448 {
1449 //if peer responded with buffer size 0 then we should pick the default.
1450 if(0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1451 frmAddBARsp.AddBAParameterSet.bufferSize = BA_DEFAULT_TX_BUFFER_SIZE;
1452
1453 // Now, validate the ADDBA Rsp
1454 if( eSIR_MAC_SUCCESS_STATUS !=
1455 __limValidateAddBAParameterSet( pMac, pSta,
1456 frmAddBARsp.AddBAParameterSet,
1457 (tANI_U8)frmAddBARsp.DialogToken.token,
1458 LIM_ADDBA_RSP, NULL))
1459 goto returnAfterError;
1460 }
1461 else
1462 goto returnAfterError;
1463
1464 // Change STA state to wait for ADDBA Rsp from HAL
1465 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1466
1467 //
1468 // Post WDA_ADDBA_REQ to HAL.
1469 // If HAL/HDD decide to allow this ADDBA Rsp session,
1470 // then this BA session is termed active
1471 //
1472
1473 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1474 pSta,
1475 (tANI_U8) frmAddBARsp.DialogToken.token,
1476 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1477 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1478 frmAddBARsp.AddBAParameterSet.bufferSize,
1479 frmAddBARsp.BATimeout.timeout,
1480 0,
1481 eBA_INITIATOR,psessionEntry))
1482 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1483 else
1484 return;
1485
1486returnAfterError:
1487
1488 // TODO: Do we need to signal an error status to SME,
1489 // if status != eSIR_MAC_SUCCESS_STATUS
1490
1491 // Restore STA "BA" State
1492 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1493 //
1494 // Need to send a DELBA IND to peer, who
1495 // would have setup a BA session with this STA
1496 //
1497 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1498 {
1499 //
1500 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1501 // status code. MLME will then send a DELBA IND
1502 // over the air to the peer MAC entity
1503 //
1504 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1505 pSta,
1506 eBA_INITIATOR,
1507 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1508 reasonCode, psessionEntry))
1509 {
1510 limLog( pMac, LOGW,
1511 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1512 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1513 }
1514 }
1515}
1516
1517/**
1518 * \brief Process a DELBA Indication
1519 *
1520 * \sa limProcessDelBAInd
1521 *
1522 * \param pMac The global tpAniSirGlobal object
1523 *
1524 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1525 *
1526 * \return none
1527 *
1528 */
1529static void
1530__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1531{
1532tDot11fDelBAInd frmDelBAInd;
1533tpSirMacMgmtHdr pHdr;
1534tpDphHashNode pSta;
1535tANI_U16 aid;
1536tANI_U32 frameLen, nStatus;
1537tANI_U8 *pBody;
1538
1539 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1540 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1541 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1542
1543 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1544 if( pSta == NULL )
1545 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001546 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1548 return;
1549 }
1550
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001551 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001552
1553 // Unpack the received frame
1554 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1555 if( DOT11F_FAILED( nStatus ))
1556 {
1557 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001558 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 nStatus,
1560 frameLen );
1561
1562 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1563 return;
1564 }
1565 else if ( DOT11F_WARNED( nStatus ) )
1566 {
1567 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001568 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 nStatus,
1570 frameLen );
1571
1572 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1573 }
1574
1575 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001576 FL( "Received DELBA for TID %d, Reason code %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 frmDelBAInd.DelBAParameterSet.tid,
1578 frmDelBAInd.Reason.code );
1579
1580 // Now, validate the DELBA Ind
1581 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1582 frmDelBAInd.DelBAParameterSet,
1583 pSta ))
1584 return;
1585
1586 //
1587 // Post WDA_DELBA_IND to HAL and delete the
1588 // existing BA session
1589 //
1590 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1591 // is kind of confusing...
1592 //
1593 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1594 pSta,
1595 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1596 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1597 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001598 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001599
1600 return;
1601
1602}
1603
1604static void
1605__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1606{
1607
1608#if 0
1609 tpSirMacMgmtHdr pHdr;
1610 tDot11fSMPowerSave frmSMPower;
1611 tSirMacHTMIMOPowerSaveState state;
1612 tpDphHashNode pSta;
1613 tANI_U16 aid;
1614 tANI_U32 frameLen, nStatus;
1615 tANI_U8 *pBody;
1616
1617 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1618 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1619 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1620
1621 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1622 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001623 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001624 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1625 return;
1626 }
1627
1628 /**Unpack the received frame */
1629 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1630
1631 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001632 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 nStatus, frameLen );
1634 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1635 return;
1636 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001637 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 nStatus, frameLen );
1639 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1640 }
1641
1642 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1643 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1644 frmSMPower.SMPowerModeSet.Mode);
1645
1646 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1647 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1648 state = eSIR_HT_MIMO_PS_DYNAMIC;
1649 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1650 state = eSIR_HT_MIMO_PS_STATIC;
1651 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1652 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1653 else {
1654 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1655 return;
1656 }
1657
1658 if (state == pSta->htMIMOPSState) {
1659 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1660 return;
1661 }
1662
1663 /** Update in the HAL Station Table for the Update of the Protection Mode */
1664 pSta->htMIMOPSState = state;
1665 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1666
1667#endif
1668
1669}
1670
1671#if defined WLAN_FEATURE_VOWIFI
1672
1673static void
1674__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1675{
1676 tpSirMacMgmtHdr pHdr;
1677 tDot11fRadioMeasurementRequest frm;
1678 tANI_U32 frameLen, nStatus;
1679 tANI_U8 *pBody;
1680
1681 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1682 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1683 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1684
1685 if( psessionEntry == NULL )
1686 {
1687 return;
1688 }
1689
1690 /**Unpack the received frame */
1691 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1692
1693 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001694 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 nStatus, frameLen );
1696 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1697 return;
1698 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001699 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 nStatus, frameLen );
1701 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1702 }
1703
1704 // Call rrm function to handle the request.
1705
1706 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1707}
1708
1709static void
1710__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1711{
1712 tpSirMacMgmtHdr pHdr;
1713 tDot11fLinkMeasurementRequest frm;
1714 tANI_U32 frameLen, nStatus;
1715 tANI_U8 *pBody;
1716
1717 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1718 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1719 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1720
1721 if( psessionEntry == NULL )
1722 {
1723 return;
1724 }
1725
1726 /**Unpack the received frame */
1727 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1728
1729 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001730 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 nStatus, frameLen );
1732 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1733 return;
1734 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001735 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 nStatus, frameLen );
1737 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1738 }
1739
1740 // Call rrm function to handle the request.
1741
1742 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1743
1744}
1745
1746static void
1747__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1748{
1749 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001750 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 tANI_U32 frameLen, nStatus;
1752 tANI_U8 *pBody;
1753
1754 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1755 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1756 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1757
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001758 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1759 (void **)&pFrm, sizeof(tDot11fNeighborReportResponse)))
1760 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001761 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001762 return;
1763 }
1764
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 if( psessionEntry == NULL )
1766 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001767 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 return;
1769 }
1770
1771 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001772 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07001773
1774 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001775 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 nStatus, frameLen );
1777 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001778 palFreeMemory(pMac->hHdd, pFrm);
1779 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001780 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001781 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 nStatus, frameLen );
1783 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1784 }
1785
1786 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001787 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
1788
1789 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001790}
1791
1792#endif
1793
1794#ifdef WLAN_FEATURE_11W
1795/**
Chet Lanctot186b5732013-03-18 10:26:30 -07001796 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 *
1798 *FUNCTION:
1799 * This function is called by limProcessActionFrame() upon
1800 * SA query request Action frame reception.
1801 *
1802 *LOGIC:
1803 *
1804 *ASSUMPTIONS:
1805 *
1806 *NOTE:
1807 *
1808 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07001809 * @param *pRxPacketInfo - Handle to the Rx packet info
1810 * @param psessionEntry - PE session entry
1811 *
Jeff Johnson295189b2012-06-20 16:38:30 -07001812 * @return None
1813 */
Chet Lanctot186b5732013-03-18 10:26:30 -07001814static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001815{
1816 tpSirMacMgmtHdr pHdr;
1817 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07001818 tANI_U8 transId[2];
Jeff Johnson295189b2012-06-20 16:38:30 -07001819
1820 /* Prima --- Below Macro not available in prima
1821 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1822 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1823
1824 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1825 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1826
Chet Lanctot186b5732013-03-18 10:26:30 -07001827 /* If this is an unprotected SA Query Request, then ignore it. */
1828 if (pHdr->fc.wep == 0)
1829 return;
1830
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 /*Extract 11w trsansId from SA query request action frame
1832 In SA query response action frame we will send same transId
1833 In SA query request action frame:
1834 Category : 1 byte
1835 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07001836 Transaction ID : 2 bytes */
1837 vos_mem_copy( &transId[0], &pBody[2], 2 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001838
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 //Send 11w SA query response action frame
1840 if (limSendSaQueryResponseFrame(pMac,
1841 transId,
1842 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
1843 {
Chet Lanctot186b5732013-03-18 10:26:30 -07001844 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 return;
1846 }
1847}
1848
Chet Lanctot186b5732013-03-18 10:26:30 -07001849/**
1850 * __limProcessSAQueryResponseActionFrame
1851 *
1852 *FUNCTION:
1853 * This function is called by limProcessActionFrame() upon
1854 * SA query response Action frame reception.
1855 *
1856 *LOGIC:
1857 *
1858 *ASSUMPTIONS:
1859 *
1860 *NOTE:
1861 *
1862 * @param pMac - Pointer to Global MAC structure
1863 * @param *pRxPacketInfo - Handle to the Rx packet info
1864 * @param psessionEntry - PE session entry
1865 * @return None
1866 */
1867static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
1868{
1869 tpSirMacMgmtHdr pHdr;
1870 tANI_U32 frameLen;
1871
1872 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1873 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1874 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1875 ("SA Query Response received...")) ;
1876 /* Forward to the SME to HDD to wpa_supplicant */
1877 // type is ACTION
1878 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
1879 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
1880 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, 0);
1881}
1882
Jeff Johnson295189b2012-06-20 16:38:30 -07001883#endif
1884
1885/**
1886 * limProcessActionFrame
1887 *
1888 *FUNCTION:
1889 * This function is called by limProcessMessageQueue() upon
1890 * Action frame reception.
1891 *
1892 *LOGIC:
1893 *
1894 *ASSUMPTIONS:
1895 *
1896 *NOTE:
1897 *
1898 * @param pMac - Pointer to Global MAC structure
1899 * @param *pRxPacketInfo - A pointer to packet info structure
1900 * @return None
1901 */
1902
1903void
1904limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1905{
1906 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1907 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07001908#ifdef WLAN_FEATURE_11W
1909 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1910#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001911
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 switch (pActionHdr->category)
1913 {
1914 case SIR_MAC_ACTION_QOS_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07001915#ifdef WLAN_FEATURE_11W
1916 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
1917 {
1918 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
1919 "since RMF is enabled."), pActionHdr->category);)
1920 break;
1921 }
1922#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 if (psessionEntry->limQosEnabled)
1924 {
1925 switch (pActionHdr->actionID)
1926 {
1927 case SIR_MAC_QOS_ADD_TS_REQ:
1928 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1929 break;
1930
1931 case SIR_MAC_QOS_ADD_TS_RSP:
1932 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1933 break;
1934
1935 case SIR_MAC_QOS_DEL_TS_REQ:
1936 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1937 break;
1938
1939 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001940 PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 break;
1942 }
1943 break ;
1944 }
1945
1946 break;
1947
1948 case SIR_MAC_ACTION_SPECTRUM_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07001949#ifdef WLAN_FEATURE_11W
1950 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
1951 {
1952 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
1953 "since RMF is enabled."), pActionHdr->category);)
1954 break;
1955 }
1956#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 switch (pActionHdr->actionID)
1958 {
1959#ifdef ANI_SUPPORT_11H
1960 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
1961 if(psessionEntry->lim11hEnable)
1962 {
1963 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
1964 }
1965 break;
1966
1967 case SIR_MAC_ACTION_TPC_REQUEST_ID:
1968 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
1969 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
1970 {
1971 if(psessionEntry->lim11hEnable)
1972 {
1973 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
1974 }
1975 }
1976 break;
1977
1978#endif
1979 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
1980 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
1981 {
1982 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
1983 }
1984 break;
1985 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001986 PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 break;
1988 }
1989 break;
1990
1991 case SIR_MAC_ACTION_WME:
1992 if (! psessionEntry->limWmeEnabled)
1993 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001994 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001995 pActionHdr->actionID);
1996 break;
1997 }
1998 switch(pActionHdr->actionID)
1999 {
2000 case SIR_MAC_QOS_ADD_TS_REQ:
2001 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2002 break;
2003
2004 case SIR_MAC_QOS_ADD_TS_RSP:
2005 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2006 break;
2007
2008 case SIR_MAC_QOS_DEL_TS_REQ:
2009 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2010 break;
2011
2012 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002013 PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 break;
2015 }
2016 break;
2017
2018 case SIR_MAC_ACTION_BLKACK:
2019 // Determine the "type" of BA Action Frame
Chet Lanctot186b5732013-03-18 10:26:30 -07002020#ifdef WLAN_FEATURE_11W
2021 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
2022 {
2023 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2024 "since RMF is enabled."), pActionHdr->category);)
2025 break;
2026 }
2027#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 switch(pActionHdr->actionID)
2029 {
2030 case SIR_MAC_BLKACK_ADD_REQ:
2031 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2032 break;
2033
2034 case SIR_MAC_BLKACK_ADD_RSP:
2035 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2036 break;
2037
2038 case SIR_MAC_BLKACK_DEL:
2039 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2040 break;
2041
2042 default:
2043 break;
2044 }
2045
2046 break;
2047 case SIR_MAC_ACTION_HT:
2048 /** Type of HT Action to be performed*/
2049 switch(pActionHdr->actionID) {
2050 case SIR_MAC_SM_POWER_SAVE:
2051 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2052 break;
2053 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002054 PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 break;
2056 }
2057 break;
2058
2059#if defined WLAN_FEATURE_VOWIFI
2060 case SIR_MAC_ACTION_RRM:
Chet Lanctot186b5732013-03-18 10:26:30 -07002061#ifdef WLAN_FEATURE_11W
2062 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
2063 {
2064 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2065 "since RMF is enabled."), pActionHdr->category);)
2066 break;
2067 }
2068#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 if( pMac->rrm.rrmPEContext.rrmEnable )
2070 {
2071 switch(pActionHdr->actionID) {
2072 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2073 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2074 break;
2075 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2076 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2077 break;
2078 case SIR_MAC_RRM_NEIGHBOR_RPT:
2079 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2080 break;
2081 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002082 PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 break;
2084
2085 }
2086 }
2087 else
2088 {
2089 // Else we will just ignore the RRM messages.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002090 PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 }
2092 break;
2093#endif
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002094#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2095 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2096 {
2097 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
2098 tpSirMacMgmtHdr pHdr;
2099 tANI_U32 frameLen;
2100 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2101
2102 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2103 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2104
2105 //Check if it is a vendor specific action frame.
2106 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
2107 (VOS_TRUE == palEqualMemory(pMac->hHdd, psessionEntry->selfMacAddr,
2108 &pHdr->da[0], sizeof(tSirMacAddr))) &&
2109 IS_WES_MODE_ENABLED(pMac) && palEqualMemory( pMac->hHdd, pVendorSpecific->Oui, Oui, 3))
2110 {
2111 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2112 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2113 /* Forward to the SME to HDD to wpa_supplicant */
2114 // type is ACTION
2115 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2116 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
2117 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, 0);
2118 }
2119 else
2120 {
2121 limLog( pMac, LOGE, FL("Dropping the vendor specific action frame because of( "
2122 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
2123 "not received with SelfSta Mac address) system role = %d"),
2124 IS_WES_MODE_ENABLED(pMac),
2125 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2126 pVendorSpecific->Oui[2],
2127 psessionEntry->limSystemRole );
2128 }
2129 }
2130 break;
2131#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 case SIR_MAC_ACTION_PUBLIC_USAGE:
2133 switch(pActionHdr->actionID) {
2134 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2135 {
2136 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
2137 tpSirMacMgmtHdr pHdr;
2138 tANI_U32 frameLen;
2139 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2140
2141 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2142 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2143
2144 //Check if it is a P2P public action frame.
2145 if( palEqualMemory( pMac->hHdd, pPubAction->Oui, P2POui, 4 ) )
2146 {
2147 /* Forward to the SME to HDD to wpa_supplicant */
2148 // type is ACTION
2149 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2150 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302151 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 }
2153 else
2154 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002155 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
2157 }
2158 }
2159 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002160#ifdef FEATURE_WLAN_TDLS
2161 case SIR_MAC_TDLS_DIS_RSP:
2162 {
2163#ifdef FEATURE_WLAN_TDLS_INTERNAL
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002164 //LIM_LOG_TDLS(printk("Public Action TDLS Discovery RSP ..")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002165 limProcessTdlsPublicActionFrame(pMac, (tANI_U32*)pRxPacketInfo, psessionEntry) ;
2166#else
2167 tpSirMacMgmtHdr pHdr;
2168 tANI_U32 frameLen;
Chilam NG571c65a2013-01-19 12:27:36 +05302169 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002170
2171 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2172 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Chilam NG571c65a2013-01-19 12:27:36 +05302173 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002174 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002175 ("Public Action TDLS Discovery RSP ..")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002176 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2177 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302178 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002179#endif
2180 }
2181 break;
2182#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002183
2184 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002185 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 break;
2187 }
2188 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002189
2190#ifdef WLAN_FEATURE_11W
2191 case SIR_MAC_ACTION_SA_QUERY:
2192 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002193 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
2194 switch (pActionHdr->actionID)
2195 {
2196 case SIR_MAC_SA_QUERY_REQ:
2197 /**11w SA query request action frame received**/
2198 /* Respond directly to the incoming request in LIM */
2199 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2200 break;
2201 case SIR_MAC_SA_QUERY_RSP:
2202 /**11w SA query response action frame received**/
2203 /* Forward to the SME to HDD to wpa_supplicant */
2204 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2205 break;
2206 default:
2207 break;
2208 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 break;
2210 }
2211#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002212#ifdef WLAN_FEATURE_11AC
2213 case SIR_MAC_ACTION_VHT:
2214 {
2215 if (psessionEntry->vhtCapability)
2216 {
2217 switch (pActionHdr->actionID)
2218 {
2219 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2220 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2221 break;
2222 default:
2223 break;
2224 }
2225 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002226 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002227 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002228#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002230 PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled"), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 break;
2232 }
2233}
2234
Jeff Johnson295189b2012-06-20 16:38:30 -07002235/**
2236 * limProcessActionFrameNoSession
2237 *
2238 *FUNCTION:
2239 * This function is called by limProcessMessageQueue() upon
2240 * Action frame reception and no session.
2241 * Currently only public action frames can be received from
2242 * a non-associated station.
2243 *
2244 *LOGIC:
2245 *
2246 *ASSUMPTIONS:
2247 *
2248 *NOTE:
2249 *
2250 * @param pMac - Pointer to Global MAC structure
2251 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2252 * @return None
2253 */
2254
2255void
2256limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2257{
2258 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2259 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2260
Mohit Khanna23863762012-09-11 17:40:09 -07002261 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002262
2263 switch ( pActionHdr->category )
2264 {
2265 case SIR_MAC_ACTION_PUBLIC_USAGE:
2266 switch(pActionHdr->actionID) {
2267 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2268 {
2269 tpSirMacMgmtHdr pHdr;
2270 tANI_U32 frameLen;
2271 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2272
2273 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
2274 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
2275
2276 //Check if it is a P2P public action frame.
2277 if( palEqualMemory( pMac->hHdd, pActionHdr->Oui, P2POui, 4 ) )
2278 {
2279 /* Forward to the SME to HDD to wpa_supplicant */
2280 // type is ACTION
2281 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2282 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302283 WDA_GET_RX_CH( pBd ), NULL, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 }
2285 else
2286 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002287 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
2289 }
2290 }
2291 break;
2292 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002293 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 break;
2295 }
2296 break;
2297 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002298 PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x "), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 break;
2300
2301 }
2302}