blob: e50d5e64bed8c92ed86c40d8cc1520de83798363 [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
114 PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d\n"),
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 {
162 limLog(pMac, LOGP, FL("tx_timer_activate failed\n"));
163 }
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{
179 PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch\n"));)
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 {
186 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d\n"), psessionEntry->peSessionId);
187 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 {
195 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
196 return eSIR_FAILURE;
197 }
198
199 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
200 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
201 0) != TX_SUCCESS)
202 {
203 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
204 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 {
215 limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
216 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 {
224 limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
225 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
274 PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame\n"));)
275 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,
282 FL("palAllocateMemory failed, status = %d \n"), status);
283 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,
292 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
293 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,
301 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
302 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);
314 limLog(pMac, LOGP, FL("could not retrieve Beacon interval\n"));
315 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
338 PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks\n"),
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 {
382 PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch\n"));)
383 }
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
409 PELOG3(limLog(pMac, LOG3, FL("Received Operating Mode action frame\n"));)
410 status = palAllocateMemory( pMac->hHdd, (void **)&pOperatingModeframe, sizeof(*pOperatingModeframe));
411 if (eHAL_STATUS_SUCCESS != status)
412 {
413 limLog(pMac, LOGE,
414 FL("palAllocateMemory failed, status = %d \n"), status);
415 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,
424 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
425 nStatus,
426 frameLen);
427 palFreeMemory(pMac->hHdd, pOperatingModeframe);
428 return;
429 }
430 else if(DOT11F_WARNED( nStatus ))
431 {
432 limLog( pMac, LOGW,
433 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):\n"),
434 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,
Jeff Johnson1250df42012-12-10 14:31:52 -0800443 FL(" received Chanwidth %d, staIdx = %d\n"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700444 (pOperatingModeframe->OperatingMode.chanWidth ),
445 pSta->staIndex);
446
447 limLog(pMac, LOGE,
448 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x\n"),
449 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
508 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response\n");)
509 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
510 {
511 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring\n"));)
512 return;
513 }
514
515 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
516 if (pSta == NULL)
517 {
518 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
519 return;
520 }
521
522 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
523 if (retval != eSIR_SUCCESS)
524 {
525 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)\n"), retval);)
526 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!
534 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring\n");)
535 return;
536 }
537
538 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
539 {
540 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring\n",
541 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 {
560 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported\n"),
561 aid, addts.numTclas);
562 return;
563 }
564 else if (addts.numTclas == 1)
565 {
566 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!\n", aid,
567 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
568 }
569 }
570 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d \n",
571 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 {
579 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d \n",
580 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 {
593 limLog(pMac, LOGW, "TSM IE Present\n");
594 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
645 limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
646
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 {
655 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
656 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 }
679 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)\n"),
680 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
681 }
682 else
683 {
684 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)\n"),
685 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
686 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL \n"));)
687 // 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 {
722 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs\n"));)
723 return;
724 }
725
726 // parse the delts request
727 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
728 if (retval != eSIR_SUCCESS)
729 {
730 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)\n"), retval);)
731 return;
732 }
733
734 if (delts.wmeTspecPresent)
735 {
736 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
737 {
738 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable\n"));)
739 return;
740 }
741 PELOG2(limLog(pMac, LOG2, FL("WME Delts received\n"));)
742 }
743 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
744 {
745 PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received\n"));)
746 }
747 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
748 {
749 PELOG2(limLog(pMac, LOG2, FL("WSM Delts received\n"));)
750 }
751 else
752 {
753 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable\n"));)
754 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 {
765 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request\n"),
766 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 {
774 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS\n"));)
775 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 {
788 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
789 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
843 limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
844
845 PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded\n"));)
846 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 {
888 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report \n"));)
889 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 {
925 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report \n"));)
926 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 {
959 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report \n"));)
960 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,
997 FL("limProcessMeasurementRequestFrame: palAllocateMemory failed \n"));
998 return;
999 }
1000
1001 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1002 eSIR_SUCCESS)
1003 {
1004 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame \n"));)
1005 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:
1024 PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d \n"),
1025 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 {
1062 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed \n"));)
1063 return;
1064 }
1065
1066 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1067 eSIR_SUCCESS)
1068 {
1069 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame \n"));)
1070 return;
1071 }
1072
1073 if (limSendTpcReportFrame(pMac,
1074 pTpcReqFrame,
1075 pHdr->sa) != eSIR_SUCCESS)
1076 {
1077 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. \n"));)
1078 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.
1123 limLog( pMac, LOGW,
1124 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,
1164 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL...\n"));
1165 }
1166 else
1167 limLog( pMac, LOGW,
1168 FL("Received an INVALID DELBA Ind for TID %d...\n"),
1169 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 );
1201
1202 // Unpack the received frame
1203 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1204 if( DOT11F_FAILED( nStatus ))
1205 {
1206 limLog( pMac, LOGE,
1207 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):\n"),
1208 nStatus,
1209 frameLen );
1210
1211 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1212
1213 // Without an unpacked request we cannot respond, so silently ignore the request
1214 return;
1215 }
1216 else if ( DOT11F_WARNED( nStatus ) )
1217 {
1218 limLog( pMac, LOGW,
1219 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):\n"),
1220 nStatus,
1221 frameLen );
1222
1223 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1224 }
1225
1226 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1227 if( pSta == NULL )
1228 {
1229 limLog( pMac, LOGE,
1230 FL( "STA context not found - ignoring ADDBA from \n" ));
1231 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1232
1233 // FIXME - Should we do this?
1234 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1235 goto returnAfterError;
1236 }
1237
1238 limLog( pMac, LOGW,
1239 FL( "ADDBA Req from STA with AID %d, tid = %d\n" ),
1240 aid, frmAddBAReq.AddBAParameterSet.tid);
1241
1242#ifdef WLAN_SOFTAP_VSTA_FEATURE
1243 // we can only do BA on "hard" STAs
1244 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1245 {
1246 status = eSIR_MAC_REQ_DECLINED_STATUS;
1247 goto returnAfterError;
1248 }
1249#endif //WLAN_SOFTAP_VSTA_FEATURE
1250
1251
1252 // Now, validate the ADDBA Req
1253 if( eSIR_MAC_SUCCESS_STATUS !=
1254 (status = __limValidateAddBAParameterSet( pMac, pSta,
1255 frmAddBAReq.AddBAParameterSet,
1256 0, //dialogue token is don't care in request validation.
1257 LIM_ADDBA_REQ, &delBAFlag)))
1258 goto returnAfterError;
1259
1260 //BA already set, so we need to delete it before adding new one.
1261 if(delBAFlag)
1262 {
1263 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1264 pSta,
1265 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1266 eBA_RECIPIENT,psessionEntry))
1267 {
1268 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1269 goto returnAfterError;
1270 }
1271 }
1272
1273 // Check if the ADD BA Declined configuration is Disabled
1274 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
1275 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d \n" ),
1276 frmAddBAReq.AddBAParameterSet.tid);
1277 status = eSIR_MAC_REQ_DECLINED_STATUS;
1278 goto returnAfterError;
1279 }
1280
1281 //
1282 // Post WDA_ADDBA_REQ to HAL.
1283 // If HAL/HDD decide to allow this ADDBA Req session,
1284 // then this BA session is termed active
1285 //
1286
1287 // Change the Block Ack state of this STA to wait for
1288 // ADDBA Rsp from HAL
1289 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001290
1291 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
1292 {
1293 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT \n"));
1294 return ;
1295 }
1296
1297 frmAddBAReq.AddBAParameterSet.bufferSize=
1298 VOS_MIN(val,frmAddBAReq.AddBAParameterSet.bufferSize);
1299 limLog( pMac, LOGE, FL( "ADDBAREQ NUMBUFF %d \n" ),
1300 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001301
1302 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1303 pSta,
1304 (tANI_U8) frmAddBAReq.DialogToken.token,
1305 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1306 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1307 frmAddBAReq.AddBAParameterSet.bufferSize,
1308 frmAddBAReq.BATimeout.timeout,
1309 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1310 eBA_RECIPIENT,psessionEntry))
1311 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1312 else
1313 return;
1314
1315returnAfterError:
1316
1317 //
1318 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1319 // status code. MLME will then send an ADDBA RSP
1320 // over the air to the peer MAC entity
1321 //
1322 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1323 pHdr->sa,
1324 status,
1325 frmAddBAReq.DialogToken.token,
1326 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1327 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1328 frmAddBAReq.AddBAParameterSet.bufferSize,
1329 frmAddBAReq.BATimeout.timeout,psessionEntry))
1330 {
1331 limLog( pMac, LOGW,
1332 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1333 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1334 }
1335
1336}
1337
1338/**
1339 * \brief Process an ADDBA RSP
1340 *
1341 * \sa limProcessAddBARsp
1342 *
1343 * \param pMac The global tpAniSirGlobal object
1344 *
1345 * \param pRxPacketInfo Handle to the packet info structure from HDD
1346 *
1347 * \return none
1348 *
1349 */
1350static void
1351__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1352{
1353tDot11fAddBARsp frmAddBARsp;
1354tpSirMacMgmtHdr pHdr;
1355tpDphHashNode pSta;
1356tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1357tANI_U16 aid;
1358tANI_U32 frameLen, nStatus;
1359tANI_U8 *pBody;
1360
1361 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1362 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1363 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1364
1365 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1366 if( pSta == NULL )
1367 {
1368 limLog( pMac, LOGE,
1369 FL( "STA context not found - ignoring ADDBA from \n" ));
1370 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1371 return;
1372 }
1373
1374#ifdef WLAN_SOFTAP_VSTA_FEATURE
1375 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1376 // Request, so we should never be processing a ADDBA Response
1377 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1378 {
1379 return;
1380 }
1381#endif //WLAN_SOFTAP_VSTA_FEATURE
1382
1383 // Unpack the received frame
1384 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1385 if( DOT11F_FAILED( nStatus ))
1386 {
1387 limLog( pMac, LOGE,
1388 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):\n"),
1389 nStatus,
1390 frameLen );
1391
1392 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1393 goto returnAfterError;
1394 }
1395 else if ( DOT11F_WARNED( nStatus ) )
1396 {
1397 limLog( pMac, LOGW,
1398 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):\n"),
1399 nStatus,
1400 frameLen );
1401
1402 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1403 }
1404
1405 limLog( pMac, LOGW,
1406 FL( "ADDBA Rsp from STA with AID %d, tid = %d, status = %d\n" ),
1407 aid, frmAddBARsp.AddBAParameterSet.tid, frmAddBARsp.Status.status);
1408
1409 //if there is no matchin dialougue token then ignore the response.
1410
1411 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1412 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1413 {
1414 PELOGW(limLog(pMac, LOGW, FL("dialogueToken in received addBARsp did not match with outstanding requests\n"));)
1415 return;
1416 }
1417
1418 // Check first if the peer accepted the ADDBA Req
1419 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1420 {
1421 //if peer responded with buffer size 0 then we should pick the default.
1422 if(0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1423 frmAddBARsp.AddBAParameterSet.bufferSize = BA_DEFAULT_TX_BUFFER_SIZE;
1424
1425 // Now, validate the ADDBA Rsp
1426 if( eSIR_MAC_SUCCESS_STATUS !=
1427 __limValidateAddBAParameterSet( pMac, pSta,
1428 frmAddBARsp.AddBAParameterSet,
1429 (tANI_U8)frmAddBARsp.DialogToken.token,
1430 LIM_ADDBA_RSP, NULL))
1431 goto returnAfterError;
1432 }
1433 else
1434 goto returnAfterError;
1435
1436 // Change STA state to wait for ADDBA Rsp from HAL
1437 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1438
1439 //
1440 // Post WDA_ADDBA_REQ to HAL.
1441 // If HAL/HDD decide to allow this ADDBA Rsp session,
1442 // then this BA session is termed active
1443 //
1444
1445 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1446 pSta,
1447 (tANI_U8) frmAddBARsp.DialogToken.token,
1448 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1449 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1450 frmAddBARsp.AddBAParameterSet.bufferSize,
1451 frmAddBARsp.BATimeout.timeout,
1452 0,
1453 eBA_INITIATOR,psessionEntry))
1454 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1455 else
1456 return;
1457
1458returnAfterError:
1459
1460 // TODO: Do we need to signal an error status to SME,
1461 // if status != eSIR_MAC_SUCCESS_STATUS
1462
1463 // Restore STA "BA" State
1464 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1465 //
1466 // Need to send a DELBA IND to peer, who
1467 // would have setup a BA session with this STA
1468 //
1469 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1470 {
1471 //
1472 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1473 // status code. MLME will then send a DELBA IND
1474 // over the air to the peer MAC entity
1475 //
1476 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1477 pSta,
1478 eBA_INITIATOR,
1479 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1480 reasonCode, psessionEntry))
1481 {
1482 limLog( pMac, LOGW,
1483 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1484 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1485 }
1486 }
1487}
1488
1489/**
1490 * \brief Process a DELBA Indication
1491 *
1492 * \sa limProcessDelBAInd
1493 *
1494 * \param pMac The global tpAniSirGlobal object
1495 *
1496 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1497 *
1498 * \return none
1499 *
1500 */
1501static void
1502__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1503{
1504tDot11fDelBAInd frmDelBAInd;
1505tpSirMacMgmtHdr pHdr;
1506tpDphHashNode pSta;
1507tANI_U16 aid;
1508tANI_U32 frameLen, nStatus;
1509tANI_U8 *pBody;
1510
1511 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1512 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1513 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1514
1515 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1516 if( pSta == NULL )
1517 {
1518 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from \n"));
1519 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1520 return;
1521 }
1522
1523 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d\n" ), aid );
1524
1525 // Unpack the received frame
1526 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1527 if( DOT11F_FAILED( nStatus ))
1528 {
1529 limLog( pMac, LOGE,
1530 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):\n"),
1531 nStatus,
1532 frameLen );
1533
1534 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1535 return;
1536 }
1537 else if ( DOT11F_WARNED( nStatus ) )
1538 {
1539 limLog( pMac, LOGW,
1540 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):\n"),
1541 nStatus,
1542 frameLen );
1543
1544 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1545 }
1546
1547 limLog( pMac, LOGW,
1548 FL( "Received DELBA for TID %d, Reason code %d\n" ),
1549 frmDelBAInd.DelBAParameterSet.tid,
1550 frmDelBAInd.Reason.code );
1551
1552 // Now, validate the DELBA Ind
1553 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1554 frmDelBAInd.DelBAParameterSet,
1555 pSta ))
1556 return;
1557
1558 //
1559 // Post WDA_DELBA_IND to HAL and delete the
1560 // existing BA session
1561 //
1562 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1563 // is kind of confusing...
1564 //
1565 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1566 pSta,
1567 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1568 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1569 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
1570 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed \n"));
1571
1572 return;
1573
1574}
1575
1576static void
1577__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1578{
1579
1580#if 0
1581 tpSirMacMgmtHdr pHdr;
1582 tDot11fSMPowerSave frmSMPower;
1583 tSirMacHTMIMOPowerSaveState state;
1584 tpDphHashNode pSta;
1585 tANI_U16 aid;
1586 tANI_U32 frameLen, nStatus;
1587 tANI_U8 *pBody;
1588
1589 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1590 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1591 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1592
1593 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1594 if( pSta == NULL ) {
1595 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from \n" ));
1596 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1597 return;
1598 }
1599
1600 /**Unpack the received frame */
1601 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1602
1603 if( DOT11F_FAILED( nStatus )) {
1604 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):\n"),
1605 nStatus, frameLen );
1606 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1607 return;
1608 }else if ( DOT11F_WARNED( nStatus ) ) {
1609 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):\n"),
1610 nStatus, frameLen );
1611 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1612 }
1613
1614 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1615 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1616 frmSMPower.SMPowerModeSet.Mode);
1617
1618 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1619 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1620 state = eSIR_HT_MIMO_PS_DYNAMIC;
1621 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1622 state = eSIR_HT_MIMO_PS_STATIC;
1623 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1624 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1625 else {
1626 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1627 return;
1628 }
1629
1630 if (state == pSta->htMIMOPSState) {
1631 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1632 return;
1633 }
1634
1635 /** Update in the HAL Station Table for the Update of the Protection Mode */
1636 pSta->htMIMOPSState = state;
1637 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1638
1639#endif
1640
1641}
1642
1643#if defined WLAN_FEATURE_VOWIFI
1644
1645static void
1646__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1647{
1648 tpSirMacMgmtHdr pHdr;
1649 tDot11fRadioMeasurementRequest frm;
1650 tANI_U32 frameLen, nStatus;
1651 tANI_U8 *pBody;
1652
1653 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1654 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1655 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1656
1657 if( psessionEntry == NULL )
1658 {
1659 return;
1660 }
1661
1662 /**Unpack the received frame */
1663 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1664
1665 if( DOT11F_FAILED( nStatus )) {
1666 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):\n"),
1667 nStatus, frameLen );
1668 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1669 return;
1670 }else if ( DOT11F_WARNED( nStatus ) ) {
1671 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):\n"),
1672 nStatus, frameLen );
1673 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1674 }
1675
1676 // Call rrm function to handle the request.
1677
1678 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1679}
1680
1681static void
1682__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1683{
1684 tpSirMacMgmtHdr pHdr;
1685 tDot11fLinkMeasurementRequest frm;
1686 tANI_U32 frameLen, nStatus;
1687 tANI_U8 *pBody;
1688
1689 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1690 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1691 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1692
1693 if( psessionEntry == NULL )
1694 {
1695 return;
1696 }
1697
1698 /**Unpack the received frame */
1699 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1700
1701 if( DOT11F_FAILED( nStatus )) {
1702 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):\n"),
1703 nStatus, frameLen );
1704 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1705 return;
1706 }else if ( DOT11F_WARNED( nStatus ) ) {
1707 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):\n"),
1708 nStatus, frameLen );
1709 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1710 }
1711
1712 // Call rrm function to handle the request.
1713
1714 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1715
1716}
1717
1718static void
1719__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1720{
1721 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001722 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001723 tANI_U32 frameLen, nStatus;
1724 tANI_U8 *pBody;
1725
1726 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1727 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1728 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1729
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001730 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1731 (void **)&pFrm, sizeof(tDot11fNeighborReportResponse)))
1732 {
1733 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in __limProcessNeighborReport\n") );
1734 return;
1735 }
1736
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 if( psessionEntry == NULL )
1738 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001739 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 return;
1741 }
1742
1743 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001744 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07001745
1746 if( DOT11F_FAILED( nStatus )) {
1747 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):\n"),
1748 nStatus, frameLen );
1749 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001750 palFreeMemory(pMac->hHdd, pFrm);
1751 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 }else if ( DOT11F_WARNED( nStatus ) ) {
1753 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):\n"),
1754 nStatus, frameLen );
1755 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1756 }
1757
1758 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001759 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
1760
1761 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001762}
1763
1764#endif
1765
1766#ifdef WLAN_FEATURE_11W
1767/**
1768 * limProcessActionFrame
1769 *
1770 *FUNCTION:
1771 * This function is called by limProcessActionFrame() upon
1772 * SA query request Action frame reception.
1773 *
1774 *LOGIC:
1775 *
1776 *ASSUMPTIONS:
1777 *
1778 *NOTE:
1779 *
1780 * @param pMac - Pointer to Global MAC structure
1781 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
1782 * @return None
1783 */
1784static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1785{
1786 tpSirMacMgmtHdr pHdr;
1787 tANI_U8 *pBody;
1788 tANI_U16 transId = 0;
1789
1790 /* Prima --- Below Macro not available in prima
1791 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1792 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1793
1794 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1795 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1796
1797 /*Extract 11w trsansId from SA query request action frame
1798 In SA query response action frame we will send same transId
1799 In SA query request action frame:
1800 Category : 1 byte
1801 Action : 1 byte
1802 Transaction ID : 2 bbytes */
1803
1804 transId = pBody[2];
1805 transId = transId << 8;
1806 transId |= pBody[3];
1807
1808 //Send 11w SA query response action frame
1809 if (limSendSaQueryResponseFrame(pMac,
1810 transId,
1811 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
1812 {
1813 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame. \n"));)
1814 return;
1815 }
1816}
1817
1818#endif
1819
1820/**
1821 * limProcessActionFrame
1822 *
1823 *FUNCTION:
1824 * This function is called by limProcessMessageQueue() upon
1825 * Action frame reception.
1826 *
1827 *LOGIC:
1828 *
1829 *ASSUMPTIONS:
1830 *
1831 *NOTE:
1832 *
1833 * @param pMac - Pointer to Global MAC structure
1834 * @param *pRxPacketInfo - A pointer to packet info structure
1835 * @return None
1836 */
1837
1838void
1839limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1840{
1841 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1842 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
1843
1844
1845 switch (pActionHdr->category)
1846 {
1847 case SIR_MAC_ACTION_QOS_MGMT:
1848 if (psessionEntry->limQosEnabled)
1849 {
1850 switch (pActionHdr->actionID)
1851 {
1852 case SIR_MAC_QOS_ADD_TS_REQ:
1853 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1854 break;
1855
1856 case SIR_MAC_QOS_ADD_TS_RSP:
1857 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1858 break;
1859
1860 case SIR_MAC_QOS_DEL_TS_REQ:
1861 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1862 break;
1863
1864 default:
1865 PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled\n"), pActionHdr->actionID);)
1866 break;
1867 }
1868 break ;
1869 }
1870
1871 break;
1872
1873 case SIR_MAC_ACTION_SPECTRUM_MGMT:
1874 switch (pActionHdr->actionID)
1875 {
1876#ifdef ANI_SUPPORT_11H
1877 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
1878 if(psessionEntry->lim11hEnable)
1879 {
1880 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
1881 }
1882 break;
1883
1884 case SIR_MAC_ACTION_TPC_REQUEST_ID:
1885 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
1886 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
1887 {
1888 if(psessionEntry->lim11hEnable)
1889 {
1890 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
1891 }
1892 }
1893 break;
1894
1895#endif
1896 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
1897 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
1898 {
1899 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
1900 }
1901 break;
1902 default:
1903 PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled\n"), pActionHdr->actionID);)
1904 break;
1905 }
1906 break;
1907
1908 case SIR_MAC_ACTION_WME:
1909 if (! psessionEntry->limWmeEnabled)
1910 {
1911 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d\n"),
1912 pActionHdr->actionID);
1913 break;
1914 }
1915 switch(pActionHdr->actionID)
1916 {
1917 case SIR_MAC_QOS_ADD_TS_REQ:
1918 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1919 break;
1920
1921 case SIR_MAC_QOS_ADD_TS_RSP:
1922 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1923 break;
1924
1925 case SIR_MAC_QOS_DEL_TS_REQ:
1926 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1927 break;
1928
1929 default:
1930 PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled\n"), pActionHdr->actionID);)
1931 break;
1932 }
1933 break;
1934
1935 case SIR_MAC_ACTION_BLKACK:
1936 // Determine the "type" of BA Action Frame
1937 switch(pActionHdr->actionID)
1938 {
1939 case SIR_MAC_BLKACK_ADD_REQ:
1940 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1941 break;
1942
1943 case SIR_MAC_BLKACK_ADD_RSP:
1944 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1945 break;
1946
1947 case SIR_MAC_BLKACK_DEL:
1948 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1949 break;
1950
1951 default:
1952 break;
1953 }
1954
1955 break;
1956 case SIR_MAC_ACTION_HT:
1957 /** Type of HT Action to be performed*/
1958 switch(pActionHdr->actionID) {
1959 case SIR_MAC_SM_POWER_SAVE:
1960 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1961 break;
1962 default:
1963 PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category\n"), pActionHdr->actionID);)
1964 break;
1965 }
1966 break;
1967
1968#if defined WLAN_FEATURE_VOWIFI
1969 case SIR_MAC_ACTION_RRM:
1970 if( pMac->rrm.rrmPEContext.rrmEnable )
1971 {
1972 switch(pActionHdr->actionID) {
1973 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
1974 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
1975 break;
1976 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
1977 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
1978 break;
1979 case SIR_MAC_RRM_NEIGHBOR_RPT:
1980 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
1981 break;
1982 default:
1983 PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM\n"), pActionHdr->actionID);)
1984 break;
1985
1986 }
1987 }
1988 else
1989 {
1990 // Else we will just ignore the RRM messages.
1991 PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg\n"));)
1992 }
1993 break;
1994#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001995 case SIR_MAC_ACTION_PUBLIC_USAGE:
1996 switch(pActionHdr->actionID) {
1997 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
1998 {
1999 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
2000 tpSirMacMgmtHdr pHdr;
2001 tANI_U32 frameLen;
2002 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2003
2004 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2005 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2006
2007 //Check if it is a P2P public action frame.
2008 if( palEqualMemory( pMac->hHdd, pPubAction->Oui, P2POui, 4 ) )
2009 {
2010 /* Forward to the SME to HDD to wpa_supplicant */
2011 // type is ACTION
2012 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2013 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302014 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 }
2016 else
2017 {
2018 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x\n"),
2019 pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
2020 }
2021 }
2022 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002023#ifdef FEATURE_WLAN_TDLS
2024 case SIR_MAC_TDLS_DIS_RSP:
2025 {
2026#ifdef FEATURE_WLAN_TDLS_INTERNAL
2027 //LIM_LOG_TDLS(printk("Public Action TDLS Discovery RSP ..\n")) ;
2028 limProcessTdlsPublicActionFrame(pMac, (tANI_U32*)pRxPacketInfo, psessionEntry) ;
2029#else
2030 tpSirMacMgmtHdr pHdr;
2031 tANI_U32 frameLen;
Chilam NG571c65a2013-01-19 12:27:36 +05302032 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002033
2034 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2035 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Chilam NG571c65a2013-01-19 12:27:36 +05302036 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002037 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2038 ("Public Action TDLS Discovery RSP ..\n")) ;
2039 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2040 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302041 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002042#endif
2043 }
2044 break;
2045#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002046
2047 default:
2048 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x \n"), pActionHdr->actionID);)
2049 break;
2050 }
2051 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002052
2053#ifdef WLAN_FEATURE_11W
2054 case SIR_MAC_ACTION_SA_QUERY:
2055 {
2056 /**11w SA query request action frame received**/
2057 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2058 break;
2059 }
2060#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002061#ifdef WLAN_FEATURE_11AC
2062 case SIR_MAC_ACTION_VHT:
2063 {
2064 if (psessionEntry->vhtCapability)
2065 {
2066 switch (pActionHdr->actionID)
2067 {
2068 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2069 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2070 break;
2071 default:
2072 break;
2073 }
2074 }
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002075 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002076#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 default:
2078 PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled\n"), pActionHdr->category);)
2079 break;
2080 }
2081}
2082
Jeff Johnson295189b2012-06-20 16:38:30 -07002083/**
2084 * limProcessActionFrameNoSession
2085 *
2086 *FUNCTION:
2087 * This function is called by limProcessMessageQueue() upon
2088 * Action frame reception and no session.
2089 * Currently only public action frames can be received from
2090 * a non-associated station.
2091 *
2092 *LOGIC:
2093 *
2094 *ASSUMPTIONS:
2095 *
2096 *NOTE:
2097 *
2098 * @param pMac - Pointer to Global MAC structure
2099 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2100 * @return None
2101 */
2102
2103void
2104limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2105{
2106 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2107 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2108
Mohit Khanna23863762012-09-11 17:40:09 -07002109 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002110
2111 switch ( pActionHdr->category )
2112 {
2113 case SIR_MAC_ACTION_PUBLIC_USAGE:
2114 switch(pActionHdr->actionID) {
2115 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2116 {
2117 tpSirMacMgmtHdr pHdr;
2118 tANI_U32 frameLen;
2119 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2120
2121 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
2122 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
2123
2124 //Check if it is a P2P public action frame.
2125 if( palEqualMemory( pMac->hHdd, pActionHdr->Oui, P2POui, 4 ) )
2126 {
2127 /* Forward to the SME to HDD to wpa_supplicant */
2128 // type is ACTION
2129 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2130 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302131 WDA_GET_RX_CH( pBd ), NULL, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 }
2133 else
2134 {
2135 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x\n"),
2136 pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
2137 }
2138 }
2139 break;
2140 default:
2141 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x \n"), pActionHdr->actionID);)
2142 break;
2143 }
2144 break;
2145 default:
Mohit Khanna23863762012-09-11 17:40:09 -07002146 PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x \n"), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 break;
2148
2149 }
2150}