blob: a125450e56557339aece18f5f5716e572b306a79 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file limProcessActionFrame.cc contains the code
25 * for processing Action Frame.
26 * Author: Michael Lui
27 * Date: 05/23/03
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 *
32 */
33#include "palTypes.h"
34#include "wniApi.h"
35#include "sirApi.h"
36#include "aniGlobal.h"
37#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
38#include "halDataStruct.h"
39#endif
40#if (WNI_POLARIS_FW_PRODUCT == AP)
41#include "wniCfgAp.h"
42#else
43#include "wniCfgSta.h"
44#endif
45#include "schApi.h"
46#include "utilsApi.h"
47#include "limTypes.h"
48#include "limUtils.h"
49#include "limAssocUtils.h"
50#include "limSecurityUtils.h"
51#include "limSerDesUtils.h"
52#include "limSendSmeRspMessages.h"
53#include "parserApi.h"
54#include "limAdmitControl.h"
55#include "wmmApsd.h"
56#include "limSendMessages.h"
57#if defined WLAN_FEATURE_VOWIFI
58#include "rrmApi.h"
59#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070060#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62#if defined FEATURE_WLAN_CCX
63#include "ccxApi.h"
64#endif
65#include "wlan_qct_wda.h"
66
67
68#define BA_DEFAULT_TX_BUFFER_SIZE 64
69
70typedef enum
71{
72 LIM_ADDBA_RSP = 0,
73 LIM_ADDBA_REQ = 1
74}tLimAddBaValidationReqType;
75
76/* Note: The test passes if the STAUT stops sending any frames, and no further
77 frames are transmitted on this channel by the station when the AP has sent
78 the last 6 beacons, with the channel switch information elements as seen
79 with the sniffer.*/
80#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
81/**-----------------------------------------------------------------
82\fn limStopTxAndSwitchChannel
83\brief Stops the transmission if channel switch mode is silent and
84 starts the channel switch timer.
85
86\param pMac
87\return NONE
88-----------------------------------------------------------------*/
89void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
90{
91 tANI_U8 isFullPowerRequested = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -070092 tpPESession psessionEntry;
93
94 psessionEntry = peFindSessionBySessionId( pMac , sessionId );
95
96 if( NULL == psessionEntry )
97 {
98 limLog(pMac, LOGE, FL("Session %d not active\n "), sessionId);
99 return;
100 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
102 PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700103 psessionEntry->gLimChannelSwitch.switchMode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
Jeff Johnsone7245742012-09-05 17:12:55 -0700105 if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
106 psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 {
108 /* Freeze the transmission */
109 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
110
111 /*Request for Full power only if the device is in powersave*/
112 if(!limIsSystemInActiveState(pMac))
113 {
114 /* Request Full Power */
115 limSendSmePreChannelSwitchInd(pMac);
116 isFullPowerRequested = 1;
117 }
118 }
119 else
120 {
121 /* Resume the transmission */
122 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
123 }
124
Jeff Johnsone7245742012-09-05 17:12:55 -0700125 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 /* change the channel immediatly only if the channel switch count is 0 and the
127 * device is not in powersave
128 * If the device is in powersave channel switch should happen only after the
129 * device comes out of the powersave */
Jeff Johnsone7245742012-09-05 17:12:55 -0700130 if (psessionEntry->gLimChannelSwitch.switchCount == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 {
132 if(limIsSystemInActiveState(pMac))
133 {
134 limProcessChannelSwitchTimeout(pMac);
135 }
136 else if(!isFullPowerRequested)
137 {
138 /* If the Full power is already not requested
139 * Request Full Power so the channel switch happens
140 * after device comes to full power */
141 limSendSmePreChannelSwitchInd(pMac);
142 }
143 return;
144 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700145 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700146
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
148 if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
149 {
150 limLog(pMac, LOGP, FL("tx_timer_activate failed\n"));
151 }
152 return;
153}
154
155/**------------------------------------------------------------
156\fn limStartChannelSwitch
157\brief Switches the channel if switch count == 0, otherwise
158 starts the timer for channel switch and stops BG scan
159 and heartbeat timer tempororily.
160
161\param pMac
162\param psessionEntry
163\return NONE
164------------------------------------------------------------*/
165tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
166{
167 PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700168
169 /*If channel switch is already running and it is on a different session, just return*/
170 /*This need to be removed for MCC */
171 if( limIsChanSwitchRunning (pMac) &&
172 psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
173 {
174 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d\n"), psessionEntry->peSessionId);
175 return eSIR_SUCCESS;
176 }
177
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 /* Deactivate and change reconfigure the timeout value */
Jeff Johnsone7245742012-09-05 17:12:55 -0700179 //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
180 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
181 {
182 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
183 return eSIR_FAILURE;
184 }
185
186 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
187 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
188 0) != TX_SUCCESS)
189 {
190 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
191 return eSIR_FAILURE;
192 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700193
194 /* Follow the channel switch, forget about the previous quiet. */
195 //If quiet is running, chance is there to resume tx on its timeout.
196 //so stop timer for a safer side.
Jeff Johnsone7245742012-09-05 17:12:55 -0700197 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700199 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700200 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
201 {
202 limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
203 return eSIR_FAILURE;
204 }
205 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700206 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700208 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
210 {
211 limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
212 return eSIR_FAILURE;
213 }
214 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700215 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700216
217 /* Prepare for 11h channel switch */
218 limPrepareFor11hChannelSwitch(pMac, psessionEntry);
219
220 /** Dont add any more statements here as we posted finish scan request
221 * to HAL, wait till we get the response
222 */
223 return eSIR_SUCCESS;
224}
225
226
227/**
228 * __limProcessChannelSwitchActionFrame
229 *
230 *FUNCTION:
231 *
232 *LOGIC:
233 *
234 *ASSUMPTIONS:
235 *
236 *NOTE:
237 *
238 * @param pMac - Pointer to Global MAC structure
239 * @param *pRxPacketInfo - A pointer to packet info structure
240 * @return None
241 */
242
243static void
244
245__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
246{
247
248 tpSirMacMgmtHdr pHdr;
249 tANI_U8 *pBody;
250 tDot11fChannelSwitch *pChannelSwitchFrame;
251 tANI_U16 beaconPeriod;
252 tANI_U32 val;
253 tANI_U32 frameLen;
254 tANI_U32 nStatus;
255 eHalStatus status;
256
257 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
258 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
259 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
260
261 PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame\n"));)
262 if (!psessionEntry->lim11hEnable)
263 return;
264
265 status = palAllocateMemory( pMac->hHdd, (void **)&pChannelSwitchFrame, sizeof(*pChannelSwitchFrame));
266 if (eHAL_STATUS_SUCCESS != status)
267 {
268 limLog(pMac, LOGE,
269 FL("palAllocateMemory failed, status = %d \n"), status);
270 return;
271 }
272
273 /* Unpack channel switch frame */
274 nStatus = dot11fUnpackChannelSwitch(pMac, pBody, frameLen, pChannelSwitchFrame);
275
276 if( DOT11F_FAILED( nStatus ))
277 {
278 limLog( pMac, LOGE,
279 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
280 nStatus,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700281 frameLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
283 return;
284 }
285 else if(DOT11F_WARNED( nStatus ))
286 {
287 limLog( pMac, LOGW,
288 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
289 nStatus,
290 frameLen);
291 }
292
293 if (palEqualMemory( pMac->hHdd,(tANI_U8 *) &psessionEntry->bssId,
294 (tANI_U8 *) &pHdr->sa,
295 sizeof(tSirMacAddr)))
296 {
297 #if 0
298 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
299 {
300 palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
301 limLog(pMac, LOGP, FL("could not retrieve Beacon interval\n"));
302 return;
303 }
304 #endif// TO SUPPORT BT-AMP
305
306 /* copy the beacon interval from psessionEntry*/
307 val = psessionEntry->beaconParams.beaconInterval;
308
309 beaconPeriod = (tANI_U16) val;
310
Jeff Johnsone7245742012-09-05 17:12:55 -0700311 psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
312 psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
313 psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
314 psessionEntry->gLimChannelSwitch.switchCount;
315 psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700316#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700317 if ( pChannelSwitchFrame->WiderBWChanSwitchAnn.present && psessionEntry->vhtCapability)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700318 {
319 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth;
320 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0;
321 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq1;
322 }
323#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700324
325 PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700326 psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700327
328 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -0700329 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
330 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700331
Jeff Johnsone7245742012-09-05 17:12:55 -0700332 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700334 if ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
335 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700337 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
338 psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700340#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700341 if(psessionEntry->vhtCapability && pChannelSwitchFrame->WiderBWChanSwitchAnn.present)
342 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700343 if (pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
344 {
345 if (pChannelSwitchFrame->ExtChanSwitchAnn.present && ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
346 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)))
347 {
348 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700349 psessionEntry->gLimChannelSwitch.secondarySubBand =
350 limGet11ACPhyCBState(pMac,
351 psessionEntry->gLimChannelSwitch.primaryChannel,
352 pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset,
353 pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0,
354 psessionEntry);
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700355 }
356 }
357 }
358#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 }
360
361 }
362 else
363 {
364 PELOG1(limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));)
365 }
366
367 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
368 {
369 PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch\n"));)
370 }
371
372 palFreeMemory(pMac->hHdd, pChannelSwitchFrame);
373 return;
374} /*** end limProcessChannelSwitchActionFrame() ***/
375
376
Mohit Khanna4a70d262012-09-11 16:30:12 -0700377#ifdef WLAN_FEATURE_11AC
378static void
379__limProcessOperatingModeActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
380{
381
382 tpSirMacMgmtHdr pHdr;
383 tANI_U8 *pBody;
384 tDot11fOperatingMode *pOperatingModeframe;
385 tANI_U32 frameLen;
386 tANI_U32 nStatus;
387 eHalStatus status;
388 tpDphHashNode pSta;
389 tANI_U16 aid;
390 tANI_U8 operMode;
391
392 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
393 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
394 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
395
396 PELOG3(limLog(pMac, LOG3, FL("Received Operating Mode action frame\n"));)
397 status = palAllocateMemory( pMac->hHdd, (void **)&pOperatingModeframe, sizeof(*pOperatingModeframe));
398 if (eHAL_STATUS_SUCCESS != status)
399 {
400 limLog(pMac, LOGE,
401 FL("palAllocateMemory failed, status = %d \n"), status);
402 return;
403 }
404
405 /* Unpack channel switch frame */
406 nStatus = dot11fUnpackOperatingMode(pMac, pBody, frameLen, pOperatingModeframe);
407
408 if( DOT11F_FAILED( nStatus ))
409 {
410 limLog( pMac, LOGE,
411 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
412 nStatus,
413 frameLen);
414 palFreeMemory(pMac->hHdd, pOperatingModeframe);
415 return;
416 }
417 else if(DOT11F_WARNED( nStatus ))
418 {
419 limLog( pMac, LOGW,
420 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
421 nStatus,
422 frameLen);
423 }
424 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
425
426 operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
427 if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
428 {
429 limLog(pMac, LOGE,
430 FL(" recevied Chanwidth %d, staIdx = %d\n"),
431 (pOperatingModeframe->OperatingMode.chanWidth ),
432 pSta->staIndex);
433
434 limLog(pMac, LOGE,
435 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x\n"),
436 pHdr->sa[0],
437 pHdr->sa[1],
438 pHdr->sa[2],
439 pHdr->sa[3],
440 pHdr->sa[4],
441 pHdr->sa[5]);
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700442
Mohit Khanna4a70d262012-09-11 16:30:12 -0700443 if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
444 {
445 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
446 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
447 }
448 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
449 {
450 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
451 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
452 }
453 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
454 {
455 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
456 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
457 }
458 limCheckVHTOpModeChange( pMac, psessionEntry,
459 (pOperatingModeframe->OperatingMode.chanWidth), pSta->staIndex);\
460 }
461 palFreeMemory(pMac->hHdd, pOperatingModeframe);
462 return;
463}
464#endif
465
Jeff Johnson295189b2012-06-20 16:38:30 -0700466static void
467__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
468{
469#if (WNI_POLARIS_FW_PRODUCT == AP)
470
471 tSirAddtsReqInfo addts;
472 tSirRetStatus retval;
473 tpSirMacMgmtHdr pHdr;
474 tSirMacScheduleIE schedule;
475 tpDphHashNode pSta;
476 tANI_U16 status;
477 tANI_U16 aid;
478 tANI_U32 frameLen;
479 tANI_U8 *pBody;
480 tANI_U8 tspecIdx = 0; //index in the sch tspec table.
481
482 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
483 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
484 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
485
486
487 if ((psessionEntry->limSystemRole != eLIM_AP_ROLE)||(psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
488 {
489 PELOGW(limLog(pMac, LOGW, FL("AddTs request at non-AP: ignoring\n"));)
490 return;
491 }
492
493 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
494 if (pSta == NULL)
495 {
496 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTs\n"));)
497 return;
498 }
499
500 PELOGW(limLog(pMac, LOGW, "AddTs Request from STA %d\n", aid);)
501 retval = sirConvertAddtsReq2Struct(pMac, pBody, frameLen, &addts);
502 if (retval != eSIR_SUCCESS)
503 {
504 PELOGW(limLog(pMac, LOGW, FL("AddTs parsing failed (error %d)\n"), retval);)
505 return;
506 }
507
508 status = eSIR_MAC_SUCCESS_STATUS;
509
510
511 if (addts.wmeTspecPresent)
512 {
513 if ((! psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
514 {
515 PELOGW(limLog(pMac, LOGW, FL("Ignoring addts request: wme not enabled/capable\n"));)
516 status = eSIR_MAC_WME_REFUSED_STATUS;
517 }
518 else
519 {
520 PELOG2(limLog(pMac, LOG2, FL("WME Addts received\n"));)
521 }
522 }
523 else if (addts.wsmTspecPresent)
524 {
525 if ((! psessionEntry->limWsmEnabled) || (! pSta->wsmEnabled))
526 {
527 PELOGW(limLog(pMac, LOGW, FL("Ignoring addts request: wsm not enabled/capable\n"));)
528 status = eSIR_MAC_REQ_DECLINED_STATUS;
529 }
530 else
531 {
532 PELOG2(limLog(pMac, LOG2, FL("WSM Addts received\n"));)
533 }
534 }
535 else if ((! psessionEntry->limQosEnabled) || (! pSta->lleEnabled))
536 {
537 PELOGW(limLog(pMac, LOGW, FL("Ignoring addts request: qos not enabled/capable\n"));)
538 status = eSIR_MAC_REQ_DECLINED_STATUS;
539 }
540 else
541 {
542 PELOG2(limLog(pMac, LOG2, FL("11e QoS Addts received\n"));)
543 }
544
545 // for edca, if no Admit Control, ignore the request
546 if ((status == eSIR_MAC_SUCCESS_STATUS) &&
547 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
548 (! psessionEntry->gLimEdcaParamsBC[upToAc(addts.tspec.tsinfo.traffic.userPrio)].aci.acm))
549 {
550 limLog(pMac, LOGW, FL("AddTs with UP %d has no ACM - ignoring request\n"),
551 addts.tspec.tsinfo.traffic.userPrio);
552 status = (addts.wmeTspecPresent) ?
553 eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
554 }
555
556 if (status != eSIR_MAC_SUCCESS_STATUS)
557 {
558 limSendAddtsRspActionFrame(pMac, pHdr->sa, status, &addts, NULL,psessionEntry);
559 return;
560 }
561
562 // try to admit the STA and send the appropriate response
563 retval = limAdmitControlAddTS(pMac, &pSta->staAddr[0], &addts, NULL, pSta->assocId, true, &schedule, &tspecIdx, psessionEntry);
564 if (retval != eSIR_SUCCESS)
565 {
566 PELOGW(limLog(pMac, LOGW, FL("Unable to admit TS\n"));)
567 status = (addts.wmeTspecPresent) ?
568 eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
569 }
570 else if (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA)
571 {
572 if(eSIR_SUCCESS != limSendHalMsgAddTs(pMac, pSta->staIndex, tspecIdx, addts.tspec, psessionEntry->peSessionId))
573 {
574 limLog(pMac, LOGW, FL("AddTs with UP %d failed in limSendHalMsgAddTs - ignoring request\n"),
575 addts.tspec.tsinfo.traffic.userPrio);
576 status = (addts.wmeTspecPresent) ?
577 eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
578
579 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecIdx);
580 }
581 if (status != eSIR_MAC_SUCCESS_STATUS)
582 {
583 limSendAddtsRspActionFrame(pMac, pHdr->sa, status, &addts, NULL,psessionEntry);
584 return;
585 }
586 }
587#if 0 //only EDCA is supported now.
588 else if (addts.numTclas > 1)
589 {
590 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported\n"),
591 aid, addts.numTclas);
592 status = (addts.wmeTspecPresent) ?
593 eSIR_MAC_WME_REFUSED_STATUS : eSIR_MAC_UNSPEC_FAILURE_STATUS;
594 }
595 else if (addts.numTclas == 1)
596 {
597 limLog(pMac, LOGW, "AddTs Request from STA %d: tsid %d, UP %d, OK!\n", aid,
598 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
599 status = eSIR_MAC_SUCCESS_STATUS;
600 }
601#endif
602
603 limLog(pMac, LOGW, "AddTs Request from STA %d: Sending AddTs Response with status %d\n",
604 aid, status);
605
606 limSendAddtsRspActionFrame(pMac, pHdr->sa, status, &addts, &schedule,psessionEntry);
607#endif
608}
609
610
611static void
612__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
613{
614 tSirAddtsRspInfo addts;
615 tSirRetStatus retval;
616 tpSirMacMgmtHdr pHdr;
617 tpDphHashNode pSta;
618 tANI_U16 aid;
619 tANI_U32 frameLen;
620 tANI_U8 *pBody;
621 tpLimTspecInfo tspecInfo;
622 tANI_U8 ac;
623 tpDphHashNode pStaDs = NULL;
624 tANI_U8 rspReqd = 1;
625 tANI_U32 cfgLen;
626 tSirMacAddr peerMacAddr;
627
628
629 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
630 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
631 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
632
633
634 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response\n");)
635 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
636 {
637 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring\n"));)
638 return;
639 }
640
641 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
642 if (pSta == NULL)
643 {
644 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
645 return;
646 }
647
648 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
649 if (retval != eSIR_SUCCESS)
650 {
651 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)\n"), retval);)
652 return;
653 }
654
655 // don't have to check for qos/wme capabilities since we wouldn't have this
656 // flag set otherwise
657 if (! pMac->lim.gLimAddtsSent)
658 {
659 // we never sent an addts request!
660 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring\n");)
661 return;
662 }
663
664 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
665 {
666 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring\n",
667 addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
668 return;
669 }
670
671 /*
672 * for successful addts reponse, try to add the classifier.
673 * if this fails for any reason, we should send a delts request to the ap
674 * for now, its ok not to send a delts since we are going to add support for
675 * multiple tclas soon and until then we won't send any addts requests with
676 * multiple tclas elements anyway.
677 * In case of addClassifier failure, we just let the addts timer run out
678 */
679 if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
680 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
681 (addts.status == eSIR_MAC_SUCCESS_STATUS))
682 {
683 // add the classifier - this should always succeed
684 if (addts.numTclas > 1) // currently no support for multiple tclas elements
685 {
686 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported\n"),
687 aid, addts.numTclas);
688 return;
689 }
690 else if (addts.numTclas == 1)
691 {
692 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!\n", aid,
693 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
694 }
695 }
696 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d \n",
697 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
698 addts.status);
699
700 // deactivate the response timer
701 limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
702
703 if (addts.status != eSIR_MAC_SUCCESS_STATUS)
704 {
705 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d \n",
706 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
707 addts.status);
708 limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
709 psessionEntry->smeSessionId, psessionEntry->transactionId);
710
711 // clear the addts flag
712 pMac->lim.gLimAddtsSent = false;
713
714 return;
715 }
716#ifdef FEATURE_WLAN_CCX
717 if (addts.tsmPresent)
718 {
719 limLog(pMac, LOGW, "TSM IE Present\n");
720 psessionEntry->ccxContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
721 vos_mem_copy(&psessionEntry->ccxContext.tsm.tsmInfo,
722 &addts.tsmIE,sizeof(tSirMacCCXTSMIE));
723 limActivateTSMStatsTimer(pMac, psessionEntry);
724 }
725#endif
726 /* Since AddTS response was successful, check for the PSB flag
727 * and directional flag inside the TS Info field.
728 * An AC is trigger enabled AC if the PSB subfield is set to 1
729 * in the uplink direction.
730 * An AC is delivery enabled AC if the PSB subfield is set to 1
731 * in the downlink direction.
732 * An AC is trigger and delivery enabled AC if the PSB subfield
733 * is set to 1 in the bi-direction field.
734 */
735 if (addts.tspec.tsinfo.traffic.psb == 1)
736 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
737 else
738 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
739
740
741 /* ADDTS success, so AC is now admitted. We shall now use the default
742 * EDCA parameters as advertised by AP and send the updated EDCA params
743 * to HAL.
744 */
745 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
746 if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
747 {
748 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
749 }
750 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
751 {
752 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
753 }
754 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
755 {
756 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
757 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
758 }
759
760 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
761
762 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
763 if (pStaDs != NULL)
764 {
765 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
766 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
767 else
768 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
769 }
770 else
771 limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
772
773
774 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
775
776 //if schedule is not present then add TSPEC with svcInterval as 0.
777 if(!addts.schedulePresent)
778 addts.schedule.svcInterval = 0;
779 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
780 {
781 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
782 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
783 psessionEntry);
784 pMac->lim.gLimAddtsSent = false;
785 return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
786 }
787 if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
788 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC) &&
789 (psessionEntry->gLimEdcaParams[upToAc(addts.tspec.tsinfo.traffic.userPrio)].aci.acm)))
790 {
791 retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
792 if(eSIR_SUCCESS != retval)
793 {
794 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
795
796 // Send DELTS action frame to AP
797 cfgLen = sizeof(tSirMacAddr);
798 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
799 psessionEntry);
800 limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
801 psessionEntry->smeSessionId, psessionEntry->transactionId);
802 pMac->lim.gLimAddtsSent = false;
803 return;
804 }
805 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)\n"),
806 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
807 }
808 else
809 {
810 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)\n"),
811 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
812 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL \n"));)
813 // Use the smesessionId and smetransactionId from the PE session context
814 limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
815 psessionEntry->smeSessionId, psessionEntry->transactionId);
816 }
817
818 // clear the addts flag
819 pMac->lim.gLimAddtsSent = false;
820 return;
821}
822
823
824static void
825__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
826{
827 tSirRetStatus retval;
828 tSirDeltsReqInfo delts;
829 tpSirMacMgmtHdr pHdr;
830 tpDphHashNode pSta;
831 tANI_U32 frameLen;
832 tANI_U16 aid;
833 tANI_U8 *pBody;
834 tANI_U8 tsStatus;
835 tSirMacTSInfo *tsinfo;
836 tANI_U8 tspecIdx;
837 tANI_U8 ac;
838 tpDphHashNode pStaDs = NULL;
839
840
841 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
842 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
843 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
844
845 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
846 if (pSta == NULL)
847 {
848 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs\n"));)
849 return;
850 }
851
852 // parse the delts request
853 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
854 if (retval != eSIR_SUCCESS)
855 {
856 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)\n"), retval);)
857 return;
858 }
859
860 if (delts.wmeTspecPresent)
861 {
862 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
863 {
864 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable\n"));)
865 return;
866 }
867 PELOG2(limLog(pMac, LOG2, FL("WME Delts received\n"));)
868 }
869 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
870 {
871 PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received\n"));)
872 }
873 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
874 {
875 PELOG2(limLog(pMac, LOG2, FL("WSM Delts received\n"));)
876 }
877 else
878 {
879 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable\n"));)
880 return;
881 }
882
883 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
884
885 // if no Admit Control, ignore the request
886 if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
887 {
888
889#if(defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
890 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE &&
891 (! psessionEntry->gLimEdcaParamsBC[upToAc(tsinfo->traffic.userPrio)].aci.acm)) ||
892 (psessionEntry->limSystemRole != eLIM_AP_ROLE &&
893 (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)))
894#else
895 if ((upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC) || (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm))
896#endif
897 {
898 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request\n"),
899 tsinfo->traffic.userPrio);
900 return;
901 }
902 }
903
904 // try to delete the TS
905 if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
906 {
907 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS\n"));)
908 return;
909 }
910
911 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
912 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
913 {
914 //Edca only for now.
915 }
916 else
917 {
918 //send message to HAL to delete TS
Jeff Johnsone7245742012-09-05 17:12:55 -0700919 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts, psessionEntry->peSessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700920 {
921 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
922 tsinfo->traffic.userPrio);
923 return;
924 }
925 }
926
927 /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
928 * The AC for this TSPEC is no longer trigger enabled if this Tspec
929 * was set-up in uplink direction only.
930 * The AC for this TSPEC is no longer delivery enabled if this Tspec
931 * was set-up in downlink direction only.
932 * The AC for this TSPEC is no longer triiger enabled and delivery
933 * enabled if this Tspec was a bidirectional TSPEC.
934 */
935 limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
936
937
938 /* We're deleting the TSPEC.
939 * The AC for this TSPEC is no longer admitted in uplink/downlink direction
940 * if this TSPEC was set-up in uplink/downlink direction only.
941 * The AC for this TSPEC is no longer admitted in both uplink and downlink
942 * directions if this TSPEC was a bi-directional TSPEC.
943 * If ACM is set for this AC and this AC is admitted only in downlink
944 * direction, PE needs to downgrade the EDCA parameter
945 * (for the AC for which TS is being deleted) to the
946 * next best AC for which ACM is not enabled, and send the
947 * updated values to HAL.
948 */
949 ac = upToAc(tsinfo->traffic.userPrio);
950
951 if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
952 {
953 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
954 }
955 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
956 {
957 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
958 }
959 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
960 {
961 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
962 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
963 }
964
965 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
966
967 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
968 if (pStaDs != NULL)
969 {
970 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
971 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
972 else
973 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
974 }
975 else
976 limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
977
978 PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded\n"));)
979 if((psessionEntry->limSystemRole != eLIM_AP_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
980 limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
981
982#ifdef FEATURE_WLAN_CCX
983 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
984#endif
985
986}
987
988
989#ifdef ANI_SUPPORT_11H
990/**
991 * limProcessBasicMeasReq
992 *
993 *FUNCTION:
994 * This function is called by limProcessMeasurementRequestFrame()
995 * when it received a Basic measurement Request action frame.
996 * Station/BP receiving this should perform basic measurements
997 * and then send Basic Measurement Report. AP should not perform
998 * any measurements, and send report indicating refusal.
999 *
1000 *LOGIC:
1001 *
1002 *ASSUMPTIONS:
1003 *
1004 *NOTE:
1005 *
1006 * @param pMac - Pointer to Global MAC structure
1007 * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
1008 * @return None
1009 */
1010static void
1011__limProcessBasicMeasReq(tpAniSirGlobal pMac,
1012 tpSirMacMeasReqActionFrame pMeasReqFrame,
1013 tSirMacAddr peerMacAddr)
1014{
1015 // TBD - Station shall perform basic measurements
1016
1017 if (limSendMeasReportFrame(pMac,
1018 pMeasReqFrame,
1019 peerMacAddr) != eSIR_SUCCESS)
1020 {
1021 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report \n"));)
1022 return;
1023 }
1024}
1025
1026
1027/**
1028 * limProcessCcaMeasReq
1029 *
1030 *FUNCTION:
1031 * This function is called by limProcessMeasurementRequestFrame()
1032 * when it received a CCA measurement Request action frame.
1033 * Station/BP receiving this should perform CCA measurements
1034 * and then send CCA Measurement Report. AP should not perform
1035 * any measurements, and send report indicating refusal.
1036 *
1037 *LOGIC:
1038 *
1039 *ASSUMPTIONS:
1040 *
1041 *NOTE:
1042 *
1043 * @param pMac - Pointer to Global MAC structure
1044 * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
1045 * @return None
1046 */
1047static void
1048__limProcessCcaMeasReq(tpAniSirGlobal pMac,
1049 tpSirMacMeasReqActionFrame pMeasReqFrame,
1050 tSirMacAddr peerMacAddr)
1051{
1052 // TBD - Station shall perform cca measurements
1053
1054 if (limSendMeasReportFrame(pMac,
1055 pMeasReqFrame,
1056 peerMacAddr) != eSIR_SUCCESS)
1057 {
1058 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report \n"));)
1059 return;
1060 }
1061}
1062
1063
1064/**
1065 * __limProcessRpiMeasReq
1066 *
1067 *FUNCTION:
1068 * This function is called by limProcessMeasurementRequestFrame()
1069 * when it received a RPI measurement Request action frame.
1070 * Station/BP/AP receiving this shall not perform any measurements,
1071 * and send report indicating refusal.
1072 *
1073 *LOGIC:
1074 *
1075 *ASSUMPTIONS:
1076 *
1077 *NOTE:
1078 *
1079 * @param pMac - Pointer to Global MAC structure
1080 * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
1081 * @return None
1082 */
1083static void
1084__limProcessRpiMeasReq(tpAniSirGlobal pMac,
1085 tpSirMacMeasReqActionFrame pMeasReqFrame,
1086 tSirMacAddr peerMacAddr)
1087{
1088 if (limSendMeasReportFrame(pMac,
1089 pMeasReqFrame,
1090 peerMacAddr) != eSIR_SUCCESS)
1091 {
1092 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report \n"));)
1093 return;
1094 }
1095}
1096
1097
1098/**
1099 * __limProcessMeasurementRequestFrame
1100 *
1101 *FUNCTION:
1102 *
1103 *LOGIC:
1104 *
1105 *ASSUMPTIONS:
1106 *
1107 *NOTE:
1108 *
1109 * @param pMac - Pointer to Global MAC structure
1110 * @param *pRxPacketInfo - A pointer to packet info structure
1111 * @return None
1112 */
1113
1114static void
1115__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1116{
1117 tpSirMacMgmtHdr pHdr;
1118 tANI_U8 *pBody;
1119 tpSirMacMeasReqActionFrame pMeasReqFrame;
1120 tANI_U32 frameLen;
1121
1122 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1123 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1124 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1125
1126 if ( eHAL_STATUS_SUCCESS !=
1127 palAllocateMemory( pMac->hHdd, (void **)&pMeasReqFrame, sizeof( tSirMacMeasReqActionFrame ) ) )
1128 {
1129 limLog(pMac, LOGE,
1130 FL("limProcessMeasurementRequestFrame: palAllocateMemory failed \n"));
1131 return;
1132 }
1133
1134 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1135 eSIR_SUCCESS)
1136 {
1137 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame \n"));)
1138 return;
1139 }
1140
1141
1142 switch(pMeasReqFrame->measReqIE.measType)
1143 {
1144 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
1145 __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1146 break;
1147
1148 case SIR_MAC_CCA_MEASUREMENT_TYPE:
1149 __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1150 break;
1151
1152 case SIR_MAC_RPI_MEASUREMENT_TYPE:
1153 __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1154 break;
1155
1156 default:
1157 PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d \n"),
1158 pMeasReqFrame->measReqIE.measType);)
1159 break;
1160 }
1161
1162} /*** end limProcessMeasurementRequestFrame ***/
1163
1164
1165/**
1166 * limProcessTpcRequestFrame
1167 *
1168 *FUNCTION:
1169 * This function is called upon receiving Tpc Request frame.
1170 *
1171 *NOTE:
1172 *
1173 * @param pMac - Pointer to Global MAC structure
1174 * @param *pRxPacketInfo - A pointer to packet info structure
1175 * @return None
1176 */
1177
1178static void
1179__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1180{
1181 tpSirMacMgmtHdr pHdr;
1182 tANI_U8 *pBody;
1183 tpSirMacTpcReqActionFrame pTpcReqFrame;
1184 tANI_U32 frameLen;
1185
1186 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1187 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1188 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1189
1190 PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
1191
1192 if ( eHAL_STATUS_SUCCESS !=
1193 palAllocateMemory( pMac->hHdd, (void **)&pTpcReqFrame, sizeof( tSirMacTpcReqActionFrame ) ) )
1194 {
1195 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed \n"));)
1196 return;
1197 }
1198
1199 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1200 eSIR_SUCCESS)
1201 {
1202 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame \n"));)
1203 return;
1204 }
1205
1206 if (limSendTpcReportFrame(pMac,
1207 pTpcReqFrame,
1208 pHdr->sa) != eSIR_SUCCESS)
1209 {
1210 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. \n"));)
1211 return;
1212 }
1213}
1214#endif
1215
1216
1217/**
1218 * \brief Validate an ADDBA Req from peer with respect
1219 * to our own BA configuration
1220 *
1221 * \sa __limValidateAddBAParameterSet
1222 *
1223 * \param pMac The global tpAniSirGlobal object
1224 *
1225 * \param baParameterSet The ADDBA Parameter Set.
1226 *
1227 * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
1228 * delBAFlag is set when entry already exists.
1229 *
1230 * \param reqType ADDBA Req v/s ADDBA Rsp
1231 * 1 - ADDBA Req
1232 * 0 - ADDBA Rsp
1233 *
1234 * \return eSIR_SUCCESS if setup completes successfully
1235 * eSIR_FAILURE is some problem is encountered
1236 */
1237
1238static tSirMacStatusCodes
1239__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
1240 tpDphHashNode pSta,
1241 tDot11fFfAddBAParameterSet baParameterSet,
1242 tANI_U8 dialogueToken,
1243 tLimAddBaValidationReqType reqType ,
1244 tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
1245{
1246 if(baParameterSet.tid >= STACFG_MAX_TC)
1247 {
1248 return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
1249 }
1250
1251 //check if there is already a BA session setup with this STA/TID while processing AddBaReq
1252 if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
1253 (LIM_ADDBA_REQ == reqType))
1254 {
1255 //There is already BA session setup for STA/TID.
1256 limLog( pMac, LOGW,
1257 FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
1258 pSta->staIndex, baParameterSet.tid);
1259 limPrintMacAddr( pMac, pSta->staAddr, LOGW );
1260
1261 if(pDelBAFlag)
1262 *pDelBAFlag = true;
1263 }
1264 return eSIR_MAC_SUCCESS_STATUS;
1265}
1266
1267/**
1268 * \brief Validate a DELBA Ind from peer with respect
1269 * to our own BA configuration
1270 *
1271 * \sa __limValidateDelBAParameterSet
1272 *
1273 * \param pMac The global tpAniSirGlobal object
1274 *
1275 * \param baParameterSet The DELBA Parameter Set.
1276 *
1277 * \param pSta Runtime, STA-related configuration cached
1278 * in the HashNode object
1279 *
1280 * \return eSIR_SUCCESS if setup completes successfully
1281 * eSIR_FAILURE is some problem is encountered
1282 */
1283static tSirMacStatusCodes
1284__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
1285 tDot11fFfDelBAParameterSet baParameterSet,
1286 tpDphHashNode pSta )
1287{
1288tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
1289
1290 // Validate if a BA is active for the requested TID
1291 if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
1292 pSta->tcCfg[baParameterSet.tid].fUseBARx )
1293 {
1294 statusCode = eSIR_MAC_SUCCESS_STATUS;
1295
1296 limLog( pMac, LOGW,
1297 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL...\n"));
1298 }
1299 else
1300 limLog( pMac, LOGW,
1301 FL("Received an INVALID DELBA Ind for TID %d...\n"),
1302 baParameterSet.tid );
1303
1304 return statusCode;
1305}
1306
1307/**
1308 * \brief Process an ADDBA REQ
1309 *
1310 * \sa limProcessAddBAReq
1311 *
1312 * \param pMac The global tpAniSirGlobal object
1313 *
1314 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1315 *
1316 * \return none
1317 *
1318 */
1319static void
1320__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1321{
1322 tDot11fAddBAReq frmAddBAReq;
1323 tpSirMacMgmtHdr pHdr;
1324 tpDphHashNode pSta;
1325 tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
1326 tANI_U16 aid;
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001327 tANI_U32 frameLen, nStatus,val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 tANI_U8 *pBody;
1329 tANI_U8 delBAFlag =0;
1330
1331 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1332 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1333 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1334
1335 // Unpack the received frame
1336 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1337 if( DOT11F_FAILED( nStatus ))
1338 {
1339 limLog( pMac, LOGE,
1340 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):\n"),
1341 nStatus,
1342 frameLen );
1343
1344 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1345
1346 // Without an unpacked request we cannot respond, so silently ignore the request
1347 return;
1348 }
1349 else if ( DOT11F_WARNED( nStatus ) )
1350 {
1351 limLog( pMac, LOGW,
1352 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):\n"),
1353 nStatus,
1354 frameLen );
1355
1356 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1357 }
1358
1359 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1360 if( pSta == NULL )
1361 {
1362 limLog( pMac, LOGE,
1363 FL( "STA context not found - ignoring ADDBA from \n" ));
1364 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1365
1366 // FIXME - Should we do this?
1367 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1368 goto returnAfterError;
1369 }
1370
1371 limLog( pMac, LOGW,
1372 FL( "ADDBA Req from STA with AID %d, tid = %d\n" ),
1373 aid, frmAddBAReq.AddBAParameterSet.tid);
1374
1375#ifdef WLAN_SOFTAP_VSTA_FEATURE
1376 // we can only do BA on "hard" STAs
1377 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1378 {
1379 status = eSIR_MAC_REQ_DECLINED_STATUS;
1380 goto returnAfterError;
1381 }
1382#endif //WLAN_SOFTAP_VSTA_FEATURE
1383
1384
1385 // Now, validate the ADDBA Req
1386 if( eSIR_MAC_SUCCESS_STATUS !=
1387 (status = __limValidateAddBAParameterSet( pMac, pSta,
1388 frmAddBAReq.AddBAParameterSet,
1389 0, //dialogue token is don't care in request validation.
1390 LIM_ADDBA_REQ, &delBAFlag)))
1391 goto returnAfterError;
1392
1393 //BA already set, so we need to delete it before adding new one.
1394 if(delBAFlag)
1395 {
1396 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1397 pSta,
1398 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1399 eBA_RECIPIENT,psessionEntry))
1400 {
1401 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1402 goto returnAfterError;
1403 }
1404 }
1405
1406 // Check if the ADD BA Declined configuration is Disabled
1407 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
1408 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d \n" ),
1409 frmAddBAReq.AddBAParameterSet.tid);
1410 status = eSIR_MAC_REQ_DECLINED_STATUS;
1411 goto returnAfterError;
1412 }
1413
1414 //
1415 // Post WDA_ADDBA_REQ to HAL.
1416 // If HAL/HDD decide to allow this ADDBA Req session,
1417 // then this BA session is termed active
1418 //
1419
1420 // Change the Block Ack state of this STA to wait for
1421 // ADDBA Rsp from HAL
1422 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001423
1424 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
1425 {
1426 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT \n"));
1427 return ;
1428 }
1429
1430 frmAddBAReq.AddBAParameterSet.bufferSize=
1431 VOS_MIN(val,frmAddBAReq.AddBAParameterSet.bufferSize);
1432 limLog( pMac, LOGE, FL( "ADDBAREQ NUMBUFF %d \n" ),
1433 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001434
1435 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1436 pSta,
1437 (tANI_U8) frmAddBAReq.DialogToken.token,
1438 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1439 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1440 frmAddBAReq.AddBAParameterSet.bufferSize,
1441 frmAddBAReq.BATimeout.timeout,
1442 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1443 eBA_RECIPIENT,psessionEntry))
1444 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1445 else
1446 return;
1447
1448returnAfterError:
1449
1450 //
1451 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1452 // status code. MLME will then send an ADDBA RSP
1453 // over the air to the peer MAC entity
1454 //
1455 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1456 pHdr->sa,
1457 status,
1458 frmAddBAReq.DialogToken.token,
1459 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1460 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1461 frmAddBAReq.AddBAParameterSet.bufferSize,
1462 frmAddBAReq.BATimeout.timeout,psessionEntry))
1463 {
1464 limLog( pMac, LOGW,
1465 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1466 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1467 }
1468
1469}
1470
1471/**
1472 * \brief Process an ADDBA RSP
1473 *
1474 * \sa limProcessAddBARsp
1475 *
1476 * \param pMac The global tpAniSirGlobal object
1477 *
1478 * \param pRxPacketInfo Handle to the packet info structure from HDD
1479 *
1480 * \return none
1481 *
1482 */
1483static void
1484__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1485{
1486tDot11fAddBARsp frmAddBARsp;
1487tpSirMacMgmtHdr pHdr;
1488tpDphHashNode pSta;
1489tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1490tANI_U16 aid;
1491tANI_U32 frameLen, nStatus;
1492tANI_U8 *pBody;
1493
1494 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1495 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1496 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1497
1498 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1499 if( pSta == NULL )
1500 {
1501 limLog( pMac, LOGE,
1502 FL( "STA context not found - ignoring ADDBA from \n" ));
1503 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1504 return;
1505 }
1506
1507#ifdef WLAN_SOFTAP_VSTA_FEATURE
1508 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1509 // Request, so we should never be processing a ADDBA Response
1510 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1511 {
1512 return;
1513 }
1514#endif //WLAN_SOFTAP_VSTA_FEATURE
1515
1516 // Unpack the received frame
1517 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1518 if( DOT11F_FAILED( nStatus ))
1519 {
1520 limLog( pMac, LOGE,
1521 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):\n"),
1522 nStatus,
1523 frameLen );
1524
1525 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1526 goto returnAfterError;
1527 }
1528 else if ( DOT11F_WARNED( nStatus ) )
1529 {
1530 limLog( pMac, LOGW,
1531 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):\n"),
1532 nStatus,
1533 frameLen );
1534
1535 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1536 }
1537
1538 limLog( pMac, LOGW,
1539 FL( "ADDBA Rsp from STA with AID %d, tid = %d, status = %d\n" ),
1540 aid, frmAddBARsp.AddBAParameterSet.tid, frmAddBARsp.Status.status);
1541
1542 //if there is no matchin dialougue token then ignore the response.
1543
1544 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1545 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1546 {
1547 PELOGW(limLog(pMac, LOGW, FL("dialogueToken in received addBARsp did not match with outstanding requests\n"));)
1548 return;
1549 }
1550
1551 // Check first if the peer accepted the ADDBA Req
1552 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1553 {
1554 //if peer responded with buffer size 0 then we should pick the default.
1555 if(0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1556 frmAddBARsp.AddBAParameterSet.bufferSize = BA_DEFAULT_TX_BUFFER_SIZE;
1557
1558 // Now, validate the ADDBA Rsp
1559 if( eSIR_MAC_SUCCESS_STATUS !=
1560 __limValidateAddBAParameterSet( pMac, pSta,
1561 frmAddBARsp.AddBAParameterSet,
1562 (tANI_U8)frmAddBARsp.DialogToken.token,
1563 LIM_ADDBA_RSP, NULL))
1564 goto returnAfterError;
1565 }
1566 else
1567 goto returnAfterError;
1568
1569 // Change STA state to wait for ADDBA Rsp from HAL
1570 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1571
1572 //
1573 // Post WDA_ADDBA_REQ to HAL.
1574 // If HAL/HDD decide to allow this ADDBA Rsp session,
1575 // then this BA session is termed active
1576 //
1577
1578 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1579 pSta,
1580 (tANI_U8) frmAddBARsp.DialogToken.token,
1581 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1582 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1583 frmAddBARsp.AddBAParameterSet.bufferSize,
1584 frmAddBARsp.BATimeout.timeout,
1585 0,
1586 eBA_INITIATOR,psessionEntry))
1587 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1588 else
1589 return;
1590
1591returnAfterError:
1592
1593 // TODO: Do we need to signal an error status to SME,
1594 // if status != eSIR_MAC_SUCCESS_STATUS
1595
1596 // Restore STA "BA" State
1597 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1598 //
1599 // Need to send a DELBA IND to peer, who
1600 // would have setup a BA session with this STA
1601 //
1602 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1603 {
1604 //
1605 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1606 // status code. MLME will then send a DELBA IND
1607 // over the air to the peer MAC entity
1608 //
1609 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1610 pSta,
1611 eBA_INITIATOR,
1612 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1613 reasonCode, psessionEntry))
1614 {
1615 limLog( pMac, LOGW,
1616 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1617 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1618 }
1619 }
1620}
1621
1622/**
1623 * \brief Process a DELBA Indication
1624 *
1625 * \sa limProcessDelBAInd
1626 *
1627 * \param pMac The global tpAniSirGlobal object
1628 *
1629 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1630 *
1631 * \return none
1632 *
1633 */
1634static void
1635__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1636{
1637tDot11fDelBAInd frmDelBAInd;
1638tpSirMacMgmtHdr pHdr;
1639tpDphHashNode pSta;
1640tANI_U16 aid;
1641tANI_U32 frameLen, nStatus;
1642tANI_U8 *pBody;
1643
1644 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1645 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1646 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1647
1648 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1649 if( pSta == NULL )
1650 {
1651 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from \n"));
1652 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1653 return;
1654 }
1655
1656 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d\n" ), aid );
1657
1658 // Unpack the received frame
1659 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1660 if( DOT11F_FAILED( nStatus ))
1661 {
1662 limLog( pMac, LOGE,
1663 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):\n"),
1664 nStatus,
1665 frameLen );
1666
1667 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1668 return;
1669 }
1670 else if ( DOT11F_WARNED( nStatus ) )
1671 {
1672 limLog( pMac, LOGW,
1673 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):\n"),
1674 nStatus,
1675 frameLen );
1676
1677 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1678 }
1679
1680 limLog( pMac, LOGW,
1681 FL( "Received DELBA for TID %d, Reason code %d\n" ),
1682 frmDelBAInd.DelBAParameterSet.tid,
1683 frmDelBAInd.Reason.code );
1684
1685 // Now, validate the DELBA Ind
1686 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1687 frmDelBAInd.DelBAParameterSet,
1688 pSta ))
1689 return;
1690
1691 //
1692 // Post WDA_DELBA_IND to HAL and delete the
1693 // existing BA session
1694 //
1695 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1696 // is kind of confusing...
1697 //
1698 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1699 pSta,
1700 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1701 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1702 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
1703 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed \n"));
1704
1705 return;
1706
1707}
1708
1709static void
1710__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1711{
1712
1713#if 0
1714 tpSirMacMgmtHdr pHdr;
1715 tDot11fSMPowerSave frmSMPower;
1716 tSirMacHTMIMOPowerSaveState state;
1717 tpDphHashNode pSta;
1718 tANI_U16 aid;
1719 tANI_U32 frameLen, nStatus;
1720 tANI_U8 *pBody;
1721
1722 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1723 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1724 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1725
1726 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1727 if( pSta == NULL ) {
1728 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from \n" ));
1729 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1730 return;
1731 }
1732
1733 /**Unpack the received frame */
1734 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1735
1736 if( DOT11F_FAILED( nStatus )) {
1737 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):\n"),
1738 nStatus, frameLen );
1739 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1740 return;
1741 }else if ( DOT11F_WARNED( nStatus ) ) {
1742 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):\n"),
1743 nStatus, frameLen );
1744 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1745 }
1746
1747 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1748 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1749 frmSMPower.SMPowerModeSet.Mode);
1750
1751 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1752 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1753 state = eSIR_HT_MIMO_PS_DYNAMIC;
1754 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1755 state = eSIR_HT_MIMO_PS_STATIC;
1756 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1757 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1758 else {
1759 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1760 return;
1761 }
1762
1763 if (state == pSta->htMIMOPSState) {
1764 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1765 return;
1766 }
1767
1768 /** Update in the HAL Station Table for the Update of the Protection Mode */
1769 pSta->htMIMOPSState = state;
1770 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1771
1772#endif
1773
1774}
1775
1776#if defined WLAN_FEATURE_VOWIFI
1777
1778static void
1779__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1780{
1781 tpSirMacMgmtHdr pHdr;
1782 tDot11fRadioMeasurementRequest frm;
1783 tANI_U32 frameLen, nStatus;
1784 tANI_U8 *pBody;
1785
1786 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1787 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1788 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1789
1790 if( psessionEntry == NULL )
1791 {
1792 return;
1793 }
1794
1795 /**Unpack the received frame */
1796 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1797
1798 if( DOT11F_FAILED( nStatus )) {
1799 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):\n"),
1800 nStatus, frameLen );
1801 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1802 return;
1803 }else if ( DOT11F_WARNED( nStatus ) ) {
1804 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):\n"),
1805 nStatus, frameLen );
1806 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1807 }
1808
1809 // Call rrm function to handle the request.
1810
1811 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1812}
1813
1814static void
1815__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1816{
1817 tpSirMacMgmtHdr pHdr;
1818 tDot11fLinkMeasurementRequest frm;
1819 tANI_U32 frameLen, nStatus;
1820 tANI_U8 *pBody;
1821
1822 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1823 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1824 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1825
1826 if( psessionEntry == NULL )
1827 {
1828 return;
1829 }
1830
1831 /**Unpack the received frame */
1832 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1833
1834 if( DOT11F_FAILED( nStatus )) {
1835 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):\n"),
1836 nStatus, frameLen );
1837 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1838 return;
1839 }else if ( DOT11F_WARNED( nStatus ) ) {
1840 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):\n"),
1841 nStatus, frameLen );
1842 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1843 }
1844
1845 // Call rrm function to handle the request.
1846
1847 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1848
1849}
1850
1851static void
1852__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1853{
1854 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001855 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 tANI_U32 frameLen, nStatus;
1857 tANI_U8 *pBody;
1858
1859 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1860 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1861 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1862
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001863 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1864 (void **)&pFrm, sizeof(tDot11fNeighborReportResponse)))
1865 {
1866 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in __limProcessNeighborReport\n") );
1867 return;
1868 }
1869
Jeff Johnson295189b2012-06-20 16:38:30 -07001870 if( psessionEntry == NULL )
1871 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001872 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 return;
1874 }
1875
1876 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001877 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07001878
1879 if( DOT11F_FAILED( nStatus )) {
1880 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):\n"),
1881 nStatus, frameLen );
1882 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001883 palFreeMemory(pMac->hHdd, pFrm);
1884 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001885 }else if ( DOT11F_WARNED( nStatus ) ) {
1886 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):\n"),
1887 nStatus, frameLen );
1888 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1889 }
1890
1891 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001892 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
1893
1894 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001895}
1896
1897#endif
1898
1899#ifdef WLAN_FEATURE_11W
1900/**
1901 * limProcessActionFrame
1902 *
1903 *FUNCTION:
1904 * This function is called by limProcessActionFrame() upon
1905 * SA query request Action frame reception.
1906 *
1907 *LOGIC:
1908 *
1909 *ASSUMPTIONS:
1910 *
1911 *NOTE:
1912 *
1913 * @param pMac - Pointer to Global MAC structure
1914 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
1915 * @return None
1916 */
1917static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1918{
1919 tpSirMacMgmtHdr pHdr;
1920 tANI_U8 *pBody;
1921 tANI_U16 transId = 0;
1922
1923 /* Prima --- Below Macro not available in prima
1924 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1925 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1926
1927 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1928 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1929
1930 /*Extract 11w trsansId from SA query request action frame
1931 In SA query response action frame we will send same transId
1932 In SA query request action frame:
1933 Category : 1 byte
1934 Action : 1 byte
1935 Transaction ID : 2 bbytes */
1936
1937 transId = pBody[2];
1938 transId = transId << 8;
1939 transId |= pBody[3];
1940
1941 //Send 11w SA query response action frame
1942 if (limSendSaQueryResponseFrame(pMac,
1943 transId,
1944 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
1945 {
1946 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame. \n"));)
1947 return;
1948 }
1949}
1950
1951#endif
1952
1953/**
1954 * limProcessActionFrame
1955 *
1956 *FUNCTION:
1957 * This function is called by limProcessMessageQueue() upon
1958 * Action frame reception.
1959 *
1960 *LOGIC:
1961 *
1962 *ASSUMPTIONS:
1963 *
1964 *NOTE:
1965 *
1966 * @param pMac - Pointer to Global MAC structure
1967 * @param *pRxPacketInfo - A pointer to packet info structure
1968 * @return None
1969 */
1970
1971void
1972limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1973{
1974 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1975 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
1976
1977
1978 switch (pActionHdr->category)
1979 {
1980 case SIR_MAC_ACTION_QOS_MGMT:
1981 if (psessionEntry->limQosEnabled)
1982 {
1983 switch (pActionHdr->actionID)
1984 {
1985 case SIR_MAC_QOS_ADD_TS_REQ:
1986 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1987 break;
1988
1989 case SIR_MAC_QOS_ADD_TS_RSP:
1990 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1991 break;
1992
1993 case SIR_MAC_QOS_DEL_TS_REQ:
1994 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1995 break;
1996
1997 default:
1998 PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled\n"), pActionHdr->actionID);)
1999 break;
2000 }
2001 break ;
2002 }
2003
2004 break;
2005
2006 case SIR_MAC_ACTION_SPECTRUM_MGMT:
2007 switch (pActionHdr->actionID)
2008 {
2009#ifdef ANI_SUPPORT_11H
2010 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2011 if(psessionEntry->lim11hEnable)
2012 {
2013 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2014 }
2015 break;
2016
2017 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2018 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2019 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2020 {
2021 if(psessionEntry->lim11hEnable)
2022 {
2023 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2024 }
2025 }
2026 break;
2027
2028#endif
2029 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2030 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2031 {
2032 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2033 }
2034 break;
2035 default:
2036 PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled\n"), pActionHdr->actionID);)
2037 break;
2038 }
2039 break;
2040
2041 case SIR_MAC_ACTION_WME:
2042 if (! psessionEntry->limWmeEnabled)
2043 {
2044 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d\n"),
2045 pActionHdr->actionID);
2046 break;
2047 }
2048 switch(pActionHdr->actionID)
2049 {
2050 case SIR_MAC_QOS_ADD_TS_REQ:
2051 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2052 break;
2053
2054 case SIR_MAC_QOS_ADD_TS_RSP:
2055 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2056 break;
2057
2058 case SIR_MAC_QOS_DEL_TS_REQ:
2059 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2060 break;
2061
2062 default:
2063 PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled\n"), pActionHdr->actionID);)
2064 break;
2065 }
2066 break;
2067
2068 case SIR_MAC_ACTION_BLKACK:
2069 // Determine the "type" of BA Action Frame
2070 switch(pActionHdr->actionID)
2071 {
2072 case SIR_MAC_BLKACK_ADD_REQ:
2073 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2074 break;
2075
2076 case SIR_MAC_BLKACK_ADD_RSP:
2077 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2078 break;
2079
2080 case SIR_MAC_BLKACK_DEL:
2081 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2082 break;
2083
2084 default:
2085 break;
2086 }
2087
2088 break;
2089 case SIR_MAC_ACTION_HT:
2090 /** Type of HT Action to be performed*/
2091 switch(pActionHdr->actionID) {
2092 case SIR_MAC_SM_POWER_SAVE:
2093 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2094 break;
2095 default:
2096 PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category\n"), pActionHdr->actionID);)
2097 break;
2098 }
2099 break;
2100
2101#if defined WLAN_FEATURE_VOWIFI
2102 case SIR_MAC_ACTION_RRM:
2103 if( pMac->rrm.rrmPEContext.rrmEnable )
2104 {
2105 switch(pActionHdr->actionID) {
2106 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2107 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2108 break;
2109 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2110 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2111 break;
2112 case SIR_MAC_RRM_NEIGHBOR_RPT:
2113 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2114 break;
2115 default:
2116 PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM\n"), pActionHdr->actionID);)
2117 break;
2118
2119 }
2120 }
2121 else
2122 {
2123 // Else we will just ignore the RRM messages.
2124 PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg\n"));)
2125 }
2126 break;
2127#endif
2128#if defined WLAN_FEATURE_P2P
2129 case SIR_MAC_ACTION_PUBLIC_USAGE:
2130 switch(pActionHdr->actionID) {
2131 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2132 {
2133 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
2134 tpSirMacMgmtHdr pHdr;
2135 tANI_U32 frameLen;
2136 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2137
2138 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2139 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2140
2141 //Check if it is a P2P public action frame.
2142 if( palEqualMemory( pMac->hHdd, pPubAction->Oui, P2POui, 4 ) )
2143 {
2144 /* Forward to the SME to HDD to wpa_supplicant */
2145 // type is ACTION
2146 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2147 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Jeff Johnsone7245742012-09-05 17:12:55 -07002148 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 }
2150 else
2151 {
2152 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x\n"),
2153 pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
2154 }
2155 }
2156 break;
2157
2158 default:
2159 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x \n"), pActionHdr->actionID);)
2160 break;
2161 }
2162 break;
2163#endif
2164
2165#ifdef WLAN_FEATURE_11W
2166 case SIR_MAC_ACTION_SA_QUERY:
2167 {
2168 /**11w SA query request action frame received**/
2169 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2170 break;
2171 }
2172#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002173#ifdef WLAN_FEATURE_11AC
2174 case SIR_MAC_ACTION_VHT:
2175 {
2176 if (psessionEntry->vhtCapability)
2177 {
2178 switch (pActionHdr->actionID)
2179 {
2180 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2181 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2182 break;
2183 default:
2184 break;
2185 }
2186 }
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002187 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002188#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 default:
2190 PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled\n"), pActionHdr->category);)
2191 break;
2192 }
2193}
2194
2195#if defined WLAN_FEATURE_P2P
2196/**
2197 * limProcessActionFrameNoSession
2198 *
2199 *FUNCTION:
2200 * This function is called by limProcessMessageQueue() upon
2201 * Action frame reception and no session.
2202 * Currently only public action frames can be received from
2203 * a non-associated station.
2204 *
2205 *LOGIC:
2206 *
2207 *ASSUMPTIONS:
2208 *
2209 *NOTE:
2210 *
2211 * @param pMac - Pointer to Global MAC structure
2212 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2213 * @return None
2214 */
2215
2216void
2217limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2218{
2219 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2220 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2221
Mohit Khanna23863762012-09-11 17:40:09 -07002222 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002223
2224 switch ( pActionHdr->category )
2225 {
2226 case SIR_MAC_ACTION_PUBLIC_USAGE:
2227 switch(pActionHdr->actionID) {
2228 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2229 {
2230 tpSirMacMgmtHdr pHdr;
2231 tANI_U32 frameLen;
2232 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2233
2234 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
2235 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
2236
2237 //Check if it is a P2P public action frame.
2238 if( palEqualMemory( pMac->hHdd, pActionHdr->Oui, P2POui, 4 ) )
2239 {
2240 /* Forward to the SME to HDD to wpa_supplicant */
2241 // type is ACTION
2242 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2243 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Jeff Johnsone7245742012-09-05 17:12:55 -07002244 WDA_GET_RX_CH( pBd ), NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246 else
2247 {
2248 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x\n"),
2249 pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
2250 }
2251 }
2252 break;
2253 default:
2254 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x \n"), pActionHdr->actionID);)
2255 break;
2256 }
2257 break;
2258 default:
Mohit Khanna23863762012-09-11 17:40:09 -07002259 PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x \n"), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 break;
2261
2262 }
2263}
2264#endif