blob: 29423ece2f69c0ab5f501077150b57d3996542ed [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080024 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam842dad02014-02-18 18:44:02 -080026 *
Jeff Johnson295189b2012-06-20 16:38:30 -070027 */
Kiet Lam842dad02014-02-18 18:44:02 -080028
29
Jeff Johnson295189b2012-06-20 16:38:30 -070030/*
Jeff Johnson295189b2012-06-20 16:38:30 -070031 * This file limProcessActionFrame.cc contains the code
32 * for processing Action Frame.
33 * Author: Michael Lui
34 * Date: 05/23/03
35 * History:-
36 * Date Modified by Modification Information
37 * --------------------------------------------------------------------
38 *
39 */
40#include "palTypes.h"
41#include "wniApi.h"
42#include "sirApi.h"
43#include "aniGlobal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#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
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080062#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
63#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070064#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
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700102 PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
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 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -0800145 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, 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 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700150 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700151 }
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{
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700167 PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch"));)
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 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700174 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d"), psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700175 return eSIR_SUCCESS;
176 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -0800177 psessionEntry->channelChangeCSA = LIM_SWITCH_CHANNEL_CSA;
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);
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800180 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnsone7245742012-09-05 17:12:55 -0700181 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
182 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700183 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700184 return eSIR_FAILURE;
185 }
186
187 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
188 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
189 0) != TX_SUCCESS)
190 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700191 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnsone7245742012-09-05 17:12:55 -0700192 return eSIR_FAILURE;
193 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700194
195 /* Follow the channel switch, forget about the previous quiet. */
196 //If quiet is running, chance is there to resume tx on its timeout.
197 //so stop timer for a safer side.
Jeff Johnsone7245742012-09-05 17:12:55 -0700198 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -0700199 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700200 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
202 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700203 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700204 return eSIR_FAILURE;
205 }
206 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700207 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700209 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
211 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700212 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700213 return eSIR_FAILURE;
214 }
215 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700216 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700217
218 /* Prepare for 11h channel switch */
219 limPrepareFor11hChannelSwitch(pMac, psessionEntry);
220
221 /** Dont add any more statements here as we posted finish scan request
222 * to HAL, wait till we get the response
223 */
224 return eSIR_SUCCESS;
225}
226
227
228/**
229 * __limProcessChannelSwitchActionFrame
230 *
231 *FUNCTION:
232 *
233 *LOGIC:
234 *
235 *ASSUMPTIONS:
236 *
237 *NOTE:
238 *
239 * @param pMac - Pointer to Global MAC structure
240 * @param *pRxPacketInfo - A pointer to packet info structure
241 * @return None
242 */
243
244static void
245
246__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
247{
248
249 tpSirMacMgmtHdr pHdr;
250 tANI_U8 *pBody;
251 tDot11fChannelSwitch *pChannelSwitchFrame;
252 tANI_U16 beaconPeriod;
253 tANI_U32 val;
254 tANI_U32 frameLen;
255 tANI_U32 nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700256
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
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700261 PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 if (!psessionEntry->lim11hEnable)
263 return;
264
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530265 pChannelSwitchFrame = vos_mem_malloc(sizeof(*pChannelSwitchFrame));
266 if (NULL == pChannelSwitchFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 {
268 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530269 FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 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,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700279 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 nStatus,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700281 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530282 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return;
284 }
285 else if(DOT11F_WARNED( nStatus ))
286 {
287 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700288 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 nStatus,
290 frameLen);
291 }
292
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530293 if (vos_mem_compare((tANI_U8 *) &psessionEntry->bssId,
294 (tANI_U8 *) &pHdr->sa,
295 sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 {
297 #if 0
298 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
299 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530300 vos_mem_free(pChannelSwitchFrame);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700301 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 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
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700325 PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
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 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700369 PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 }
371
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530372 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 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;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700387 tpDphHashNode pSta;
388 tANI_U16 aid;
389 tANI_U8 operMode;
390
391 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
392 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
393 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
394
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700395 PELOG3(limLog(pMac, LOG3, FL("Received Operating Mode action frame"));)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530396 pOperatingModeframe = vos_mem_malloc(sizeof(*pOperatingModeframe));
397 if (NULL == pOperatingModeframe)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700398 {
399 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530400 FL("AllocateMemory failed"));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700401 return;
402 }
403
404 /* Unpack channel switch frame */
405 nStatus = dot11fUnpackOperatingMode(pMac, pBody, frameLen, pOperatingModeframe);
406
407 if( DOT11F_FAILED( nStatus ))
408 {
409 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700410 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700411 nStatus,
412 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530413 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700414 return;
415 }
416 else if(DOT11F_WARNED( nStatus ))
417 {
418 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700419 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700420 nStatus,
421 frameLen);
422 }
423 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
424
425 operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
426 if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
427 {
428 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700429 FL(" received Chanwidth %d, staIdx = %d"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700430 (pOperatingModeframe->OperatingMode.chanWidth ),
431 pSta->staIndex);
432
433 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700434 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700435 pHdr->sa[0],
436 pHdr->sa[1],
437 pHdr->sa[2],
438 pHdr->sa[3],
439 pHdr->sa[4],
440 pHdr->sa[5]);
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700441
Mohit Khanna4a70d262012-09-11 16:30:12 -0700442 if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
443 {
444 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
445 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
446 }
447 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
448 {
449 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
450 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
451 }
452 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
453 {
454 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
455 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
456 }
457 limCheckVHTOpModeChange( pMac, psessionEntry,
458 (pOperatingModeframe->OperatingMode.chanWidth), pSta->staIndex);\
459 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530460 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700461 return;
462}
463#endif
464
Jeff Johnson295189b2012-06-20 16:38:30 -0700465static void
466__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
467{
Jeff Johnson295189b2012-06-20 16:38:30 -0700468}
469
470
471static void
472__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
473{
474 tSirAddtsRspInfo addts;
475 tSirRetStatus retval;
476 tpSirMacMgmtHdr pHdr;
477 tpDphHashNode pSta;
478 tANI_U16 aid;
479 tANI_U32 frameLen;
480 tANI_U8 *pBody;
481 tpLimTspecInfo tspecInfo;
482 tANI_U8 ac;
483 tpDphHashNode pStaDs = NULL;
484 tANI_U8 rspReqd = 1;
485 tANI_U32 cfgLen;
486 tSirMacAddr peerMacAddr;
487
488
489 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
490 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
491 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
492
493
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700494 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
496 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700497 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 return;
499 }
500
501 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
502 if (pSta == NULL)
503 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700504 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 return;
506 }
507
508 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
509 if (retval != eSIR_SUCCESS)
510 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700511 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 return;
513 }
514
515 // don't have to check for qos/wme capabilities since we wouldn't have this
516 // flag set otherwise
517 if (! pMac->lim.gLimAddtsSent)
518 {
519 // we never sent an addts request!
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700520 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 return;
522 }
523
524 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
525 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700526 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring",
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
528 return;
529 }
530
531 /*
532 * for successful addts reponse, try to add the classifier.
533 * if this fails for any reason, we should send a delts request to the ap
534 * for now, its ok not to send a delts since we are going to add support for
535 * multiple tclas soon and until then we won't send any addts requests with
536 * multiple tclas elements anyway.
537 * In case of addClassifier failure, we just let the addts timer run out
538 */
539 if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
540 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
541 (addts.status == eSIR_MAC_SUCCESS_STATUS))
542 {
543 // add the classifier - this should always succeed
544 if (addts.numTclas > 1) // currently no support for multiple tclas elements
545 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700546 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 aid, addts.numTclas);
548 return;
549 }
550 else if (addts.numTclas == 1)
551 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700552 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!", aid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
554 }
555 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700556 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
558 addts.status);
559
560 // deactivate the response timer
561 limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
562
563 if (addts.status != eSIR_MAC_SUCCESS_STATUS)
564 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700565 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
567 addts.status);
568 limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
569 psessionEntry->smeSessionId, psessionEntry->transactionId);
570
571 // clear the addts flag
572 pMac->lim.gLimAddtsSent = false;
573
574 return;
575 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800576#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 if (addts.tsmPresent)
578 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700579 limLog(pMac, LOGW, "TSM IE Present");
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800580 psessionEntry->eseContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
581 vos_mem_copy(&psessionEntry->eseContext.tsm.tsmInfo,
582 &addts.tsmIE,sizeof(tSirMacESETSMIE));
583#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700584 limSendSmeTsmIEInd(pMac, psessionEntry, addts.tsmIE.tsid,
585 addts.tsmIE.state, addts.tsmIE.msmt_interval);
586#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 limActivateTSMStatsTimer(pMac, psessionEntry);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800588#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 }
590#endif
591 /* Since AddTS response was successful, check for the PSB flag
592 * and directional flag inside the TS Info field.
593 * An AC is trigger enabled AC if the PSB subfield is set to 1
594 * in the uplink direction.
595 * An AC is delivery enabled AC if the PSB subfield is set to 1
596 * in the downlink direction.
597 * An AC is trigger and delivery enabled AC if the PSB subfield
598 * is set to 1 in the bi-direction field.
599 */
600 if (addts.tspec.tsinfo.traffic.psb == 1)
601 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
602 else
603 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
604
605
606 /* ADDTS success, so AC is now admitted. We shall now use the default
607 * EDCA parameters as advertised by AP and send the updated EDCA params
608 * to HAL.
609 */
610 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
611 if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
612 {
613 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
614 }
615 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
616 {
617 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
618 }
619 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
620 {
621 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
622 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
623 }
624
625 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
626
627 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
628 if (pStaDs != NULL)
629 {
630 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
631 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
632 else
633 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
634 }
635 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700636 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700637
638
639 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
640
641 //if schedule is not present then add TSPEC with svcInterval as 0.
642 if(!addts.schedulePresent)
643 addts.schedule.svcInterval = 0;
644 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
645 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700646 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
648 psessionEntry);
649 pMac->lim.gLimAddtsSent = false;
650 return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
651 }
652 if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +0530653 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 {
655 retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
656 if(eSIR_SUCCESS != retval)
657 {
658 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
659
660 // Send DELTS action frame to AP
661 cfgLen = sizeof(tSirMacAddr);
662 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
663 psessionEntry);
664 limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
665 psessionEntry->smeSessionId, psessionEntry->transactionId);
666 pMac->lim.gLimAddtsSent = false;
667 return;
668 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700669 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
671 }
672 else
673 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700674 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700676 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 // Use the smesessionId and smetransactionId from the PE session context
678 limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
679 psessionEntry->smeSessionId, psessionEntry->transactionId);
680 }
681
682 // clear the addts flag
683 pMac->lim.gLimAddtsSent = false;
684 return;
685}
686
687
688static void
689__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
690{
691 tSirRetStatus retval;
692 tSirDeltsReqInfo delts;
693 tpSirMacMgmtHdr pHdr;
694 tpDphHashNode pSta;
695 tANI_U32 frameLen;
696 tANI_U16 aid;
697 tANI_U8 *pBody;
698 tANI_U8 tsStatus;
699 tSirMacTSInfo *tsinfo;
700 tANI_U8 tspecIdx;
701 tANI_U8 ac;
702 tpDphHashNode pStaDs = NULL;
703
704
705 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
706 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
707 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
708
709 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
710 if (pSta == NULL)
711 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700712 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 return;
714 }
715
716 // parse the delts request
717 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
718 if (retval != eSIR_SUCCESS)
719 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700720 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 return;
722 }
723
724 if (delts.wmeTspecPresent)
725 {
726 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
727 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700728 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 return;
730 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700731 PELOG2(limLog(pMac, LOG2, FL("WME Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 }
733 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
734 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700735 PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 }
737 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
738 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700739 PELOG2(limLog(pMac, LOG2, FL("WSM Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 }
741 else
742 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700743 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 return;
745 }
746
747 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
748
749 // if no Admit Control, ignore the request
750 if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
751 {
752
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530753 if (upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC)
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700755 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 tsinfo->traffic.userPrio);
757 return;
758 }
759 }
760
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530761 if ((psessionEntry->limSystemRole != eLIM_AP_ROLE) &&
762 (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
763 limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
764
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 // try to delete the TS
766 if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
767 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700768 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 return;
770 }
771
772 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
773 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
774 {
775 //Edca only for now.
776 }
777 else
778 {
779 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530780 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
781 pSta->staIndex,
782 tspecIdx,
783 delts,
784 psessionEntry->peSessionId,
785 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700787 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 tsinfo->traffic.userPrio);
789 return;
790 }
791 }
792
793 /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
794 * The AC for this TSPEC is no longer trigger enabled if this Tspec
795 * was set-up in uplink direction only.
796 * The AC for this TSPEC is no longer delivery enabled if this Tspec
797 * was set-up in downlink direction only.
798 * The AC for this TSPEC is no longer triiger enabled and delivery
799 * enabled if this Tspec was a bidirectional TSPEC.
800 */
801 limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
802
803
804 /* We're deleting the TSPEC.
805 * The AC for this TSPEC is no longer admitted in uplink/downlink direction
806 * if this TSPEC was set-up in uplink/downlink direction only.
807 * The AC for this TSPEC is no longer admitted in both uplink and downlink
808 * directions if this TSPEC was a bi-directional TSPEC.
809 * If ACM is set for this AC and this AC is admitted only in downlink
810 * direction, PE needs to downgrade the EDCA parameter
811 * (for the AC for which TS is being deleted) to the
812 * next best AC for which ACM is not enabled, and send the
813 * updated values to HAL.
814 */
815 ac = upToAc(tsinfo->traffic.userPrio);
816
817 if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
818 {
819 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
820 }
821 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
822 {
823 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
824 }
825 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
826 {
827 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
828 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
829 }
830
831 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
832
833 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
834 if (pStaDs != NULL)
835 {
836 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
837 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
838 else
839 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
840 }
841 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700842 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700843
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700844 PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700845
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800846#ifdef FEATURE_WLAN_ESE
847#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700848 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
849#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800851#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700852#endif
853
854}
855
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700856static void
857__limProcessQosMapConfigureFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
858 tpPESession psessionEntry)
859{
860 tpSirMacMgmtHdr pHdr;
861 tANI_U32 frameLen;
862 tANI_U8 *pBody;
863 tSirRetStatus retval;
864 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
865 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
866 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
867 retval = sirConvertQosMapConfigureFrame2Struct(pMac, pBody, frameLen,
868 &pMac->QosMapSet);
869 if (retval != eSIR_SUCCESS)
870 {
871 PELOGW(limLog(pMac, LOGE,
872 FL("QosMapConfigure frame parsing failed (error %d)"), retval);)
873 return;
874 }
875 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo, psessionEntry, 0);
876}
Jeff Johnson295189b2012-06-20 16:38:30 -0700877
878#ifdef ANI_SUPPORT_11H
879/**
880 * limProcessBasicMeasReq
881 *
882 *FUNCTION:
883 * This function is called by limProcessMeasurementRequestFrame()
884 * when it received a Basic measurement Request action frame.
885 * Station/BP receiving this should perform basic measurements
886 * and then send Basic Measurement Report. AP should not perform
887 * any measurements, and send report indicating refusal.
888 *
889 *LOGIC:
890 *
891 *ASSUMPTIONS:
892 *
893 *NOTE:
894 *
895 * @param pMac - Pointer to Global MAC structure
896 * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
897 * @return None
898 */
899static void
900__limProcessBasicMeasReq(tpAniSirGlobal pMac,
901 tpSirMacMeasReqActionFrame pMeasReqFrame,
902 tSirMacAddr peerMacAddr)
903{
904 // TBD - Station shall perform basic measurements
905
906 if (limSendMeasReportFrame(pMac,
907 pMeasReqFrame,
908 peerMacAddr) != eSIR_SUCCESS)
909 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700910 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 return;
912 }
913}
914
915
916/**
917 * limProcessCcaMeasReq
918 *
919 *FUNCTION:
920 * This function is called by limProcessMeasurementRequestFrame()
921 * when it received a CCA measurement Request action frame.
922 * Station/BP receiving this should perform CCA measurements
923 * and then send CCA Measurement Report. AP should not perform
924 * any measurements, and send report indicating refusal.
925 *
926 *LOGIC:
927 *
928 *ASSUMPTIONS:
929 *
930 *NOTE:
931 *
932 * @param pMac - Pointer to Global MAC structure
933 * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
934 * @return None
935 */
936static void
937__limProcessCcaMeasReq(tpAniSirGlobal pMac,
938 tpSirMacMeasReqActionFrame pMeasReqFrame,
939 tSirMacAddr peerMacAddr)
940{
941 // TBD - Station shall perform cca measurements
942
943 if (limSendMeasReportFrame(pMac,
944 pMeasReqFrame,
945 peerMacAddr) != eSIR_SUCCESS)
946 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700947 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 return;
949 }
950}
951
952
953/**
954 * __limProcessRpiMeasReq
955 *
956 *FUNCTION:
957 * This function is called by limProcessMeasurementRequestFrame()
958 * when it received a RPI measurement Request action frame.
959 * Station/BP/AP receiving this shall not perform any measurements,
960 * and send report indicating refusal.
961 *
962 *LOGIC:
963 *
964 *ASSUMPTIONS:
965 *
966 *NOTE:
967 *
968 * @param pMac - Pointer to Global MAC structure
969 * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
970 * @return None
971 */
972static void
973__limProcessRpiMeasReq(tpAniSirGlobal pMac,
974 tpSirMacMeasReqActionFrame pMeasReqFrame,
975 tSirMacAddr peerMacAddr)
976{
977 if (limSendMeasReportFrame(pMac,
978 pMeasReqFrame,
979 peerMacAddr) != eSIR_SUCCESS)
980 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700981 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 return;
983 }
984}
985
986
987/**
988 * __limProcessMeasurementRequestFrame
989 *
990 *FUNCTION:
991 *
992 *LOGIC:
993 *
994 *ASSUMPTIONS:
995 *
996 *NOTE:
997 *
998 * @param pMac - Pointer to Global MAC structure
999 * @param *pRxPacketInfo - A pointer to packet info structure
1000 * @return None
1001 */
1002
1003static void
1004__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1005{
1006 tpSirMacMgmtHdr pHdr;
1007 tANI_U8 *pBody;
1008 tpSirMacMeasReqActionFrame pMeasReqFrame;
1009 tANI_U32 frameLen;
1010
1011 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1012 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1013 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1014
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301015 pMeasReqFrame = vos_mem_malloc(sizeof( tSirMacMeasReqActionFrame ));
1016 if (NULL == pMeasReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 {
1018 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301019 FL("limProcessMeasurementRequestFrame: AllocateMemory failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 return;
1021 }
1022
1023 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1024 eSIR_SUCCESS)
1025 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001026 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 return;
1028 }
1029
1030
1031 switch(pMeasReqFrame->measReqIE.measType)
1032 {
1033 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
1034 __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1035 break;
1036
1037 case SIR_MAC_CCA_MEASUREMENT_TYPE:
1038 __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1039 break;
1040
1041 case SIR_MAC_RPI_MEASUREMENT_TYPE:
1042 __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1043 break;
1044
1045 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001046 PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 pMeasReqFrame->measReqIE.measType);)
1048 break;
1049 }
1050
1051} /*** end limProcessMeasurementRequestFrame ***/
1052
1053
1054/**
1055 * limProcessTpcRequestFrame
1056 *
1057 *FUNCTION:
1058 * This function is called upon receiving Tpc Request frame.
1059 *
1060 *NOTE:
1061 *
1062 * @param pMac - Pointer to Global MAC structure
1063 * @param *pRxPacketInfo - A pointer to packet info structure
1064 * @return None
1065 */
1066
1067static void
1068__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1069{
1070 tpSirMacMgmtHdr pHdr;
1071 tANI_U8 *pBody;
1072 tpSirMacTpcReqActionFrame pTpcReqFrame;
1073 tANI_U32 frameLen;
1074
1075 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1076 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1077 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1078
1079 PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
1080
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301081 pTpcReqFrame = vos_mem_malloc(sizeof( tSirMacTpcReqActionFrame ));
1082 if (NULL == pTpcReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301084 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 return;
1086 }
1087
1088 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1089 eSIR_SUCCESS)
1090 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001091 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 return;
1093 }
1094
1095 if (limSendTpcReportFrame(pMac,
1096 pTpcReqFrame,
1097 pHdr->sa) != eSIR_SUCCESS)
1098 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001099 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 return;
1101 }
1102}
1103#endif
1104
1105
1106/**
1107 * \brief Validate an ADDBA Req from peer with respect
1108 * to our own BA configuration
1109 *
1110 * \sa __limValidateAddBAParameterSet
1111 *
1112 * \param pMac The global tpAniSirGlobal object
1113 *
1114 * \param baParameterSet The ADDBA Parameter Set.
1115 *
1116 * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
1117 * delBAFlag is set when entry already exists.
1118 *
1119 * \param reqType ADDBA Req v/s ADDBA Rsp
1120 * 1 - ADDBA Req
1121 * 0 - ADDBA Rsp
1122 *
1123 * \return eSIR_SUCCESS if setup completes successfully
1124 * eSIR_FAILURE is some problem is encountered
1125 */
1126
1127static tSirMacStatusCodes
1128__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
1129 tpDphHashNode pSta,
1130 tDot11fFfAddBAParameterSet baParameterSet,
1131 tANI_U8 dialogueToken,
1132 tLimAddBaValidationReqType reqType ,
1133 tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
1134{
1135 if(baParameterSet.tid >= STACFG_MAX_TC)
1136 {
1137 return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
1138 }
1139
1140 //check if there is already a BA session setup with this STA/TID while processing AddBaReq
1141 if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
1142 (LIM_ADDBA_REQ == reqType))
1143 {
1144 //There is already BA session setup for STA/TID.
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001145 limLog( pMac, LOGE,
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
1147 pSta->staIndex, baParameterSet.tid);
1148 limPrintMacAddr( pMac, pSta->staAddr, LOGW );
1149
1150 if(pDelBAFlag)
1151 *pDelBAFlag = true;
1152 }
1153 return eSIR_MAC_SUCCESS_STATUS;
1154}
1155
1156/**
1157 * \brief Validate a DELBA Ind from peer with respect
1158 * to our own BA configuration
1159 *
1160 * \sa __limValidateDelBAParameterSet
1161 *
1162 * \param pMac The global tpAniSirGlobal object
1163 *
1164 * \param baParameterSet The DELBA Parameter Set.
1165 *
1166 * \param pSta Runtime, STA-related configuration cached
1167 * in the HashNode object
1168 *
1169 * \return eSIR_SUCCESS if setup completes successfully
1170 * eSIR_FAILURE is some problem is encountered
1171 */
1172static tSirMacStatusCodes
1173__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
1174 tDot11fFfDelBAParameterSet baParameterSet,
1175 tpDphHashNode pSta )
1176{
1177tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
1178
1179 // Validate if a BA is active for the requested TID
1180 if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
1181 pSta->tcCfg[baParameterSet.tid].fUseBARx )
1182 {
1183 statusCode = eSIR_MAC_SUCCESS_STATUS;
1184
1185 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001186 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 }
1188 else
1189 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001190 FL("Received an INVALID DELBA Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 baParameterSet.tid );
1192
1193 return statusCode;
1194}
1195
1196/**
1197 * \brief Process an ADDBA REQ
1198 *
1199 * \sa limProcessAddBAReq
1200 *
1201 * \param pMac The global tpAniSirGlobal object
1202 *
1203 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1204 *
1205 * \return none
1206 *
1207 */
1208static void
1209__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1210{
1211 tDot11fAddBAReq frmAddBAReq;
1212 tpSirMacMgmtHdr pHdr;
1213 tpDphHashNode pSta;
1214 tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
1215 tANI_U16 aid;
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001216 tANI_U32 frameLen, nStatus,val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 tANI_U8 *pBody;
1218 tANI_U8 delBAFlag =0;
1219
1220 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1221 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1222 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001223 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001224
1225 // Unpack the received frame
1226 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1227 if( DOT11F_FAILED( nStatus ))
1228 {
1229 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001230 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 nStatus,
1232 frameLen );
1233
1234 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1235
1236 // Without an unpacked request we cannot respond, so silently ignore the request
1237 return;
1238 }
1239 else if ( DOT11F_WARNED( nStatus ) )
1240 {
1241 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001242 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 nStatus,
1244 frameLen );
1245
1246 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1247 }
1248
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001249 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1250
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1252 if( pSta == NULL )
1253 {
1254 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001255 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001256 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001257
1258 // FIXME - Should we do this?
1259 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1260 goto returnAfterError;
1261 }
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301262 limLog( pMac, LOG1, FL( "ADDBA Req from STA "MAC_ADDRESS_STR " with AID %d"
1263 " tid = %d policy = %d buffsize = %d"
1264 " amsduSupported = %d"), MAC_ADDR_ARRAY(pHdr->sa),
1265 aid, frmAddBAReq.AddBAParameterSet.tid,
1266 frmAddBAReq.AddBAParameterSet.policy,
1267 frmAddBAReq.AddBAParameterSet.bufferSize,
1268 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07001269
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301270 limLog( pMac, LOG1, FL( "ssn = %d fragNumber = %d" ),
1271 frmAddBAReq.BAStartingSequenceControl.ssn,
1272 frmAddBAReq.BAStartingSequenceControl.fragNumber);
1273
Jeff Johnson295189b2012-06-20 16:38:30 -07001274#ifdef WLAN_SOFTAP_VSTA_FEATURE
1275 // we can only do BA on "hard" STAs
1276 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1277 {
1278 status = eSIR_MAC_REQ_DECLINED_STATUS;
1279 goto returnAfterError;
1280 }
1281#endif //WLAN_SOFTAP_VSTA_FEATURE
1282
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001283 if (wlan_cfgGetInt(pMac, WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC, &val) !=
1284 eSIR_SUCCESS)
1285 {
1286 limLog(pMac, LOGE,
1287 FL("Unable to get WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC"));
1288 val = 0;
1289 }
1290 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1291 val)
1292 {
1293 limLog( pMac, LOGW,
1294 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1295 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1296
1297 status = eSIR_MAC_REQ_DECLINED_STATUS;
1298 goto returnAfterError;
1299 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001300
1301 // Now, validate the ADDBA Req
1302 if( eSIR_MAC_SUCCESS_STATUS !=
1303 (status = __limValidateAddBAParameterSet( pMac, pSta,
1304 frmAddBAReq.AddBAParameterSet,
1305 0, //dialogue token is don't care in request validation.
1306 LIM_ADDBA_REQ, &delBAFlag)))
1307 goto returnAfterError;
1308
1309 //BA already set, so we need to delete it before adding new one.
1310 if(delBAFlag)
1311 {
1312 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1313 pSta,
1314 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1315 eBA_RECIPIENT,psessionEntry))
1316 {
1317 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1318 goto returnAfterError;
1319 }
1320 }
1321
1322 // Check if the ADD BA Declined configuration is Disabled
1323 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001324 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 frmAddBAReq.AddBAParameterSet.tid);
1326 status = eSIR_MAC_REQ_DECLINED_STATUS;
1327 goto returnAfterError;
1328 }
1329
1330 //
1331 // Post WDA_ADDBA_REQ to HAL.
1332 // If HAL/HDD decide to allow this ADDBA Req session,
1333 // then this BA session is termed active
1334 //
1335
1336 // Change the Block Ack state of this STA to wait for
1337 // ADDBA Rsp from HAL
1338 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001339
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001340 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001341 {
1342 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001343 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001344 }
1345
1346
1347 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1348 {
1349 frmAddBAReq.AddBAParameterSet.bufferSize =
1350 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1351 }
1352 else
1353 {
1354 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1355 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001356 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001357 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1360 pSta,
1361 (tANI_U8) frmAddBAReq.DialogToken.token,
1362 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1363 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1364 frmAddBAReq.AddBAParameterSet.bufferSize,
1365 frmAddBAReq.BATimeout.timeout,
1366 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1367 eBA_RECIPIENT,psessionEntry))
1368 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1369 else
1370 return;
1371
1372returnAfterError:
1373
1374 //
1375 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1376 // status code. MLME will then send an ADDBA RSP
1377 // over the air to the peer MAC entity
1378 //
1379 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1380 pHdr->sa,
1381 status,
1382 frmAddBAReq.DialogToken.token,
1383 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1384 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1385 frmAddBAReq.AddBAParameterSet.bufferSize,
1386 frmAddBAReq.BATimeout.timeout,psessionEntry))
1387 {
1388 limLog( pMac, LOGW,
1389 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1390 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1391 }
1392
1393}
1394
1395/**
1396 * \brief Process an ADDBA RSP
1397 *
1398 * \sa limProcessAddBARsp
1399 *
1400 * \param pMac The global tpAniSirGlobal object
1401 *
1402 * \param pRxPacketInfo Handle to the packet info structure from HDD
1403 *
1404 * \return none
1405 *
1406 */
1407static void
1408__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1409{
1410tDot11fAddBARsp frmAddBARsp;
1411tpSirMacMgmtHdr pHdr;
1412tpDphHashNode pSta;
1413tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1414tANI_U16 aid;
1415tANI_U32 frameLen, nStatus;
1416tANI_U8 *pBody;
1417
1418 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1419 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1420 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1421
1422 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1423 if( pSta == NULL )
1424 {
1425 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001426 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1428 return;
1429 }
1430
1431#ifdef WLAN_SOFTAP_VSTA_FEATURE
1432 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1433 // Request, so we should never be processing a ADDBA Response
1434 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1435 {
1436 return;
1437 }
1438#endif //WLAN_SOFTAP_VSTA_FEATURE
1439
1440 // Unpack the received frame
1441 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1442 if( DOT11F_FAILED( nStatus ))
1443 {
1444 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001445 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 nStatus,
1447 frameLen );
1448
1449 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1450 goto returnAfterError;
1451 }
1452 else if ( DOT11F_WARNED( nStatus ) )
1453 {
1454 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001455 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 nStatus,
1457 frameLen );
1458
1459 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1460 }
1461
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301462 limLog( pMac, LOG1, FL( "ADDBA Rsp from STA "MAC_ADDRESS_STR " with AID %d "
1463 "tid = %d policy = %d buffsize = %d "
1464 "amsduSupported = %d status = %d"),
1465 MAC_ADDR_ARRAY(pHdr->sa), aid,
1466 frmAddBARsp.AddBAParameterSet.tid,
1467 frmAddBARsp.AddBAParameterSet.policy,
1468 frmAddBARsp.AddBAParameterSet.bufferSize,
1469 frmAddBARsp.AddBAParameterSet.amsduSupported,
1470 frmAddBARsp.Status.status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001471 //if there is no matchin dialougue token then ignore the response.
1472
1473 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1474 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1475 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001476 PELOGW(limLog(pMac, LOGE, FL("dialogueToken in received addBARsp did not match with outstanding requests"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 return;
1478 }
1479
1480 // Check first if the peer accepted the ADDBA Req
1481 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1482 {
1483 //if peer responded with buffer size 0 then we should pick the default.
1484 if(0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1485 frmAddBARsp.AddBAParameterSet.bufferSize = BA_DEFAULT_TX_BUFFER_SIZE;
1486
1487 // Now, validate the ADDBA Rsp
1488 if( eSIR_MAC_SUCCESS_STATUS !=
1489 __limValidateAddBAParameterSet( pMac, pSta,
1490 frmAddBARsp.AddBAParameterSet,
1491 (tANI_U8)frmAddBARsp.DialogToken.token,
1492 LIM_ADDBA_RSP, NULL))
1493 goto returnAfterError;
1494 }
1495 else
1496 goto returnAfterError;
1497
1498 // Change STA state to wait for ADDBA Rsp from HAL
1499 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1500
1501 //
1502 // Post WDA_ADDBA_REQ to HAL.
1503 // If HAL/HDD decide to allow this ADDBA Rsp session,
1504 // then this BA session is termed active
1505 //
1506
1507 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1508 pSta,
1509 (tANI_U8) frmAddBARsp.DialogToken.token,
1510 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1511 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1512 frmAddBARsp.AddBAParameterSet.bufferSize,
1513 frmAddBARsp.BATimeout.timeout,
1514 0,
1515 eBA_INITIATOR,psessionEntry))
1516 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1517 else
1518 return;
1519
1520returnAfterError:
1521
1522 // TODO: Do we need to signal an error status to SME,
1523 // if status != eSIR_MAC_SUCCESS_STATUS
1524
1525 // Restore STA "BA" State
1526 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1527 //
1528 // Need to send a DELBA IND to peer, who
1529 // would have setup a BA session with this STA
1530 //
1531 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1532 {
1533 //
1534 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1535 // status code. MLME will then send a DELBA IND
1536 // over the air to the peer MAC entity
1537 //
1538 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1539 pSta,
1540 eBA_INITIATOR,
1541 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1542 reasonCode, psessionEntry))
1543 {
1544 limLog( pMac, LOGW,
1545 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1546 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1547 }
1548 }
1549}
1550
1551/**
1552 * \brief Process a DELBA Indication
1553 *
1554 * \sa limProcessDelBAInd
1555 *
1556 * \param pMac The global tpAniSirGlobal object
1557 *
1558 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1559 *
1560 * \return none
1561 *
1562 */
1563static void
1564__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1565{
1566tDot11fDelBAInd frmDelBAInd;
1567tpSirMacMgmtHdr pHdr;
1568tpDphHashNode pSta;
1569tANI_U16 aid;
1570tANI_U32 frameLen, nStatus;
1571tANI_U8 *pBody;
1572
1573 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1574 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1575 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1576
1577 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1578 if( pSta == NULL )
1579 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001580 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1582 return;
1583 }
1584
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001585 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001586
1587 // Unpack the received frame
1588 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1589 if( DOT11F_FAILED( nStatus ))
1590 {
1591 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001592 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 nStatus,
1594 frameLen );
1595
1596 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1597 return;
1598 }
1599 else if ( DOT11F_WARNED( nStatus ) )
1600 {
1601 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001602 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 nStatus,
1604 frameLen );
1605
1606 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1607 }
1608
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301609 limLog( pMac, LOG1,
1610 FL( "Received DELBA from: "MAC_ADDRESS_STR" for TID %d, Reason code %d" ),
1611 MAC_ADDR_ARRAY(pHdr->sa),
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 frmDelBAInd.DelBAParameterSet.tid,
1613 frmDelBAInd.Reason.code );
1614
1615 // Now, validate the DELBA Ind
1616 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1617 frmDelBAInd.DelBAParameterSet,
1618 pSta ))
1619 return;
1620
1621 //
1622 // Post WDA_DELBA_IND to HAL and delete the
1623 // existing BA session
1624 //
1625 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1626 // is kind of confusing...
1627 //
1628 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1629 pSta,
1630 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1631 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1632 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001633 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001634
1635 return;
1636
1637}
1638
1639static void
1640__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1641{
1642
1643#if 0
1644 tpSirMacMgmtHdr pHdr;
1645 tDot11fSMPowerSave frmSMPower;
1646 tSirMacHTMIMOPowerSaveState state;
1647 tpDphHashNode pSta;
1648 tANI_U16 aid;
1649 tANI_U32 frameLen, nStatus;
1650 tANI_U8 *pBody;
1651
1652 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1653 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1654 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1655
1656 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1657 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001658 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1660 return;
1661 }
1662
1663 /**Unpack the received frame */
1664 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1665
1666 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001667 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 nStatus, frameLen );
1669 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1670 return;
1671 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001672 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 nStatus, frameLen );
1674 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1675 }
1676
1677 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1678 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1679 frmSMPower.SMPowerModeSet.Mode);
1680
1681 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1682 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1683 state = eSIR_HT_MIMO_PS_DYNAMIC;
1684 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1685 state = eSIR_HT_MIMO_PS_STATIC;
1686 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1687 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1688 else {
1689 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1690 return;
1691 }
1692
1693 if (state == pSta->htMIMOPSState) {
1694 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1695 return;
1696 }
1697
1698 /** Update in the HAL Station Table for the Update of the Protection Mode */
1699 pSta->htMIMOPSState = state;
1700 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1701
1702#endif
1703
1704}
1705
1706#if defined WLAN_FEATURE_VOWIFI
1707
1708static void
1709__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1710{
1711 tpSirMacMgmtHdr pHdr;
1712 tDot11fRadioMeasurementRequest frm;
1713 tANI_U32 frameLen, nStatus;
1714 tANI_U8 *pBody;
1715
1716 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1717 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1718 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1719
1720 if( psessionEntry == NULL )
1721 {
1722 return;
1723 }
1724
1725 /**Unpack the received frame */
1726 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1727
1728 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001729 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 nStatus, frameLen );
1731 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1732 return;
1733 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001734 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 nStatus, frameLen );
1736 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1737 }
1738
1739 // Call rrm function to handle the request.
1740
1741 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1742}
1743
1744static void
1745__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1746{
1747 tpSirMacMgmtHdr pHdr;
1748 tDot11fLinkMeasurementRequest frm;
1749 tANI_U32 frameLen, nStatus;
1750 tANI_U8 *pBody;
1751
1752 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1753 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1754 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1755
1756 if( psessionEntry == NULL )
1757 {
1758 return;
1759 }
1760
1761 /**Unpack the received frame */
1762 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1763
1764 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001765 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 nStatus, frameLen );
1767 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1768 return;
1769 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001770 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 nStatus, frameLen );
1772 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1773 }
1774
1775 // Call rrm function to handle the request.
1776
1777 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1778
1779}
1780
1781static void
1782__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1783{
1784 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001785 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001786 tANI_U32 frameLen, nStatus;
1787 tANI_U8 *pBody;
1788
1789 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1790 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1791 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1792
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301793 pFrm = vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
1794 if (NULL == pFrm)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001795 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301796 limLog(pMac, LOGE, FL("Unable to allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001797 return;
1798 }
1799
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301800 if(psessionEntry == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001801 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301802 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 return;
1804 }
1805
1806 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001807 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07001808
1809 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001810 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 nStatus, frameLen );
1812 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301813 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001814 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001816 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 nStatus, frameLen );
1818 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1819 }
1820
1821 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001822 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
1823
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301824 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001825}
1826
1827#endif
1828
1829#ifdef WLAN_FEATURE_11W
1830/**
Chet Lanctot186b5732013-03-18 10:26:30 -07001831 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 *
1833 *FUNCTION:
1834 * This function is called by limProcessActionFrame() upon
1835 * SA query request Action frame reception.
1836 *
1837 *LOGIC:
1838 *
1839 *ASSUMPTIONS:
1840 *
1841 *NOTE:
1842 *
1843 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07001844 * @param *pRxPacketInfo - Handle to the Rx packet info
1845 * @param psessionEntry - PE session entry
1846 *
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 * @return None
1848 */
Chet Lanctot186b5732013-03-18 10:26:30 -07001849static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001850{
1851 tpSirMacMgmtHdr pHdr;
1852 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07001853 tANI_U8 transId[2];
Jeff Johnson295189b2012-06-20 16:38:30 -07001854
1855 /* Prima --- Below Macro not available in prima
1856 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1857 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1858
1859 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1860 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1861
Chet Lanctot186b5732013-03-18 10:26:30 -07001862 /* If this is an unprotected SA Query Request, then ignore it. */
1863 if (pHdr->fc.wep == 0)
1864 return;
1865
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 /*Extract 11w trsansId from SA query request action frame
1867 In SA query response action frame we will send same transId
1868 In SA query request action frame:
1869 Category : 1 byte
1870 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07001871 Transaction ID : 2 bytes */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301872 vos_mem_copy(&transId[0], &pBody[2], 2);
Jeff Johnson295189b2012-06-20 16:38:30 -07001873
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 //Send 11w SA query response action frame
1875 if (limSendSaQueryResponseFrame(pMac,
1876 transId,
1877 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
1878 {
Chet Lanctot186b5732013-03-18 10:26:30 -07001879 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 return;
1881 }
1882}
1883
Chet Lanctot186b5732013-03-18 10:26:30 -07001884/**
1885 * __limProcessSAQueryResponseActionFrame
1886 *
1887 *FUNCTION:
1888 * This function is called by limProcessActionFrame() upon
1889 * SA query response Action frame reception.
1890 *
1891 *LOGIC:
1892 *
1893 *ASSUMPTIONS:
1894 *
1895 *NOTE:
1896 *
1897 * @param pMac - Pointer to Global MAC structure
1898 * @param *pRxPacketInfo - Handle to the Rx packet info
1899 * @param psessionEntry - PE session entry
1900 * @return None
1901 */
1902static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
1903{
1904 tpSirMacMgmtHdr pHdr;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001905 tANI_U8 *pBody;
1906 tpDphHashNode pSta;
1907 tANI_U16 aid;
1908 tANI_U16 transId;
1909 tANI_U8 retryNum;
Chet Lanctot186b5732013-03-18 10:26:30 -07001910
1911 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Chet Lanctot8cecea22014-02-11 19:09:36 -08001912 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Chet Lanctot186b5732013-03-18 10:26:30 -07001913 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1914 ("SA Query Response received...")) ;
Chet Lanctot186b5732013-03-18 10:26:30 -07001915
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07001916 /* When a station, supplicant handles SA Query Response.
1917 Forward to SME to HDD to wpa_supplicant. */
1918 if (eLIM_STA_ROLE == psessionEntry->limSystemRole)
1919 {
1920 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo, psessionEntry, 0);
1921 return;
1922 }
1923
Chet Lanctot8cecea22014-02-11 19:09:36 -08001924 /* If this is an unprotected SA Query Response, then ignore it. */
1925 if (pHdr->fc.wep == 0)
1926 return;
1927
1928 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
1929 if (NULL == pSta)
1930 return;
1931
1932 limLog(pMac, LOG1,
1933 FL("SA Query Response source addr - %0x:%0x:%0x:%0x:%0x:%0x"),
1934 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
1935 pHdr->sa[4], pHdr->sa[5]);
1936 limLog(pMac, LOG1,
1937 FL("SA Query state for station - %d"), pSta->pmfSaQueryState);
1938
1939 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
1940 return;
1941
1942 /* Extract 11w trsansId from SA query reponse action frame
1943 In SA query response action frame:
1944 Category : 1 byte
1945 Action : 1 byte
1946 Transaction ID : 2 bytes */
1947 vos_mem_copy(&transId, &pBody[2], 2);
1948
1949 /* If SA Query is in progress with the station and the station
1950 responds then the association request that triggered the SA
1951 query is from a rogue station, just go back to initial state. */
1952 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
1953 if (transId == pSta->pmfSaQueryStartTransId + retryNum)
1954 {
1955 limLog(pMac, LOG1,
1956 FL("Found matching SA Query Request - transaction ID %d"), transId);
1957 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
1958 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1959 break;
1960 }
1961}
Jeff Johnson295189b2012-06-20 16:38:30 -07001962#endif
1963
Chet Lanctotf7abfd42014-05-23 12:42:15 -07001964#ifdef WLAN_FEATURE_11W
1965/**
1966 * limDropUnprotectedActionFrame
1967 *
1968 *FUNCTION:
1969 * This function checks if an Action frame should be dropped since it is
1970 * a Robust Managment Frame, it is unprotected, and it is received on a
1971 * connection where PMF is enabled.
1972 *
1973 *LOGIC:
1974 *
1975 *ASSUMPTIONS:
1976 *
1977 *NOTE:
1978 *
1979 * @param pMac - Global MAC structure
1980 * @param psessionEntry - PE session entry
1981 * @param pHdr - Frame header
1982 * @param category - Action frame category
1983 * @return TRUE if frame should be dropped
1984 */
1985
1986static tANI_BOOLEAN
1987limDropUnprotectedActionFrame (tpAniSirGlobal pMac, tpPESession psessionEntry,
1988 tpSirMacMgmtHdr pHdr, tANI_U8 category)
1989{
1990 tANI_U16 aid;
1991 tpDphHashNode pStaDs;
1992 tANI_BOOLEAN rmfConnection = eANI_BOOLEAN_FALSE;
1993
1994 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1995 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
1996 {
1997 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
1998 if (pStaDs != NULL)
1999 if (pStaDs->rmfEnabled)
2000 rmfConnection = eANI_BOOLEAN_TRUE;
2001 }
2002 else if (psessionEntry->limRmfEnabled)
2003 rmfConnection = eANI_BOOLEAN_TRUE;
2004
2005 if (rmfConnection && (pHdr->fc.wep == 0))
2006 {
2007 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2008 "since RMF is enabled."), category);)
2009 return eANI_BOOLEAN_TRUE;
2010 }
2011 else
2012 return eANI_BOOLEAN_FALSE;
2013}
2014#endif
2015
Jeff Johnson295189b2012-06-20 16:38:30 -07002016/**
2017 * limProcessActionFrame
2018 *
2019 *FUNCTION:
2020 * This function is called by limProcessMessageQueue() upon
2021 * Action frame reception.
2022 *
2023 *LOGIC:
2024 *
2025 *ASSUMPTIONS:
2026 *
2027 *NOTE:
2028 *
2029 * @param pMac - Pointer to Global MAC structure
2030 * @param *pRxPacketInfo - A pointer to packet info structure
2031 * @return None
2032 */
2033
2034void
2035limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2036{
2037 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2038 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002039#ifdef WLAN_FEATURE_11W
2040 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2041#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002042
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 switch (pActionHdr->category)
2044 {
2045 case SIR_MAC_ACTION_QOS_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07002046#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002047 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Chet Lanctot186b5732013-03-18 10:26:30 -07002048 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002049#endif
Leela Venkata Kiran Kumar Reddy Chiralac7c4e7e2014-04-29 10:50:16 -07002050 if ( (psessionEntry->limQosEnabled) ||
2051 (pActionHdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 {
2053 switch (pActionHdr->actionID)
2054 {
2055 case SIR_MAC_QOS_ADD_TS_REQ:
2056 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2057 break;
2058
2059 case SIR_MAC_QOS_ADD_TS_RSP:
2060 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2061 break;
2062
2063 case SIR_MAC_QOS_DEL_TS_REQ:
2064 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2065 break;
2066
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002067 case SIR_MAC_QOS_MAP_CONFIGURE:
2068 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2069 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002071 PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 break;
2073 }
2074 break ;
2075 }
2076
2077 break;
2078
2079 case SIR_MAC_ACTION_SPECTRUM_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07002080#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002081 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Chet Lanctot186b5732013-03-18 10:26:30 -07002082 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002083#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 switch (pActionHdr->actionID)
2085 {
2086#ifdef ANI_SUPPORT_11H
2087 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2088 if(psessionEntry->lim11hEnable)
2089 {
2090 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2091 }
2092 break;
2093
2094 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2095 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2096 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2097 {
2098 if(psessionEntry->lim11hEnable)
2099 {
2100 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2101 }
2102 }
2103 break;
2104
2105#endif
2106 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2107 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2108 {
2109 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2110 }
2111 break;
2112 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002113 PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 break;
2115 }
2116 break;
2117
2118 case SIR_MAC_ACTION_WME:
2119 if (! psessionEntry->limWmeEnabled)
2120 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002121 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 pActionHdr->actionID);
2123 break;
2124 }
2125 switch(pActionHdr->actionID)
2126 {
2127 case SIR_MAC_QOS_ADD_TS_REQ:
2128 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2129 break;
2130
2131 case SIR_MAC_QOS_ADD_TS_RSP:
2132 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2133 break;
2134
2135 case SIR_MAC_QOS_DEL_TS_REQ:
2136 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2137 break;
2138
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002139 case SIR_MAC_QOS_MAP_CONFIGURE:
2140 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2141 break;
2142
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002144 PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 break;
2146 }
2147 break;
2148
2149 case SIR_MAC_ACTION_BLKACK:
2150 // Determine the "type" of BA Action Frame
Chet Lanctot186b5732013-03-18 10:26:30 -07002151#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002152 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Chet Lanctot186b5732013-03-18 10:26:30 -07002153 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002154#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 switch(pActionHdr->actionID)
2156 {
2157 case SIR_MAC_BLKACK_ADD_REQ:
2158 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2159 break;
2160
2161 case SIR_MAC_BLKACK_ADD_RSP:
2162 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2163 break;
2164
2165 case SIR_MAC_BLKACK_DEL:
2166 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2167 break;
2168
2169 default:
2170 break;
2171 }
2172
2173 break;
2174 case SIR_MAC_ACTION_HT:
2175 /** Type of HT Action to be performed*/
2176 switch(pActionHdr->actionID) {
2177 case SIR_MAC_SM_POWER_SAVE:
2178 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2179 break;
2180 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002181 PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 break;
2183 }
2184 break;
2185
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002186 case SIR_MAC_ACTION_WNM:
2187 {
2188#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002189 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002190 break;
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002191#endif
2192 PELOGE(limLog(pMac, LOG1, FL("WNM Action category %d action %d."),
2193 pActionHdr->category, pActionHdr->actionID);)
2194 switch (pActionHdr->actionID)
2195 {
2196 case SIR_MAC_WNM_BSS_TM_QUERY:
2197 case SIR_MAC_WNM_BSS_TM_REQUEST:
2198 case SIR_MAC_WNM_BSS_TM_RESPONSE:
2199 case SIR_MAC_WNM_NOTIF_REQUEST:
2200 case SIR_MAC_WNM_NOTIF_RESPONSE:
2201 {
2202 tpSirMacMgmtHdr pHdr;
2203 tANI_S8 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
2204 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2205 /* Forward to the SME to HDD to wpa_supplicant */
2206 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2207 psessionEntry, rssi);
2208 break;
2209 }
2210 }
2211 break;
2212 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002213#if defined WLAN_FEATURE_VOWIFI
2214 case SIR_MAC_ACTION_RRM:
Chet Lanctot186b5732013-03-18 10:26:30 -07002215#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002216 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
2217 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002218#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 if( pMac->rrm.rrmPEContext.rrmEnable )
2220 {
2221 switch(pActionHdr->actionID) {
2222 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2223 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2224 break;
2225 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2226 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2227 break;
2228 case SIR_MAC_RRM_NEIGHBOR_RPT:
2229 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2230 break;
2231 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002232 PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 break;
2234
2235 }
2236 }
2237 else
2238 {
2239 // Else we will just ignore the RRM messages.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002240 PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 }
2242 break;
2243#endif
Kiet Lam47325522014-03-10 11:50:46 -07002244#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002245 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2246 {
2247 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
2248 tpSirMacMgmtHdr pHdr;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002249 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2250
2251 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002252
2253 //Check if it is a vendor specific action frame.
2254 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302255 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002256 &pHdr->da[0], sizeof(tSirMacAddr))) &&
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002257 IS_WES_MODE_ENABLED(pMac) &&
2258 vos_mem_compare(pVendorSpecific->Oui, Oui, 3))
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002259 {
2260 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2261 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2262 /* Forward to the SME to HDD to wpa_supplicant */
2263 // type is ACTION
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302264 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2265 psessionEntry, 0);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002266 }
2267 else
2268 {
2269 limLog( pMac, LOGE, FL("Dropping the vendor specific action frame because of( "
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002270 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002271 "not received with SelfSta Mac address) system role = %d"),
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002272 IS_WES_MODE_ENABLED(pMac),
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002273 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2274 pVendorSpecific->Oui[2],
2275 psessionEntry->limSystemRole );
2276 }
2277 }
2278 break;
2279#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 case SIR_MAC_ACTION_PUBLIC_USAGE:
2281 switch(pActionHdr->actionID) {
2282 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2283 {
2284 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2286
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302288 if (vos_mem_compare(pPubAction->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 {
2290 /* Forward to the SME to HDD to wpa_supplicant */
2291 // type is ACTION
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302292 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2293 psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 }
2295 else
2296 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002297 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
2299 }
2300 }
2301 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002302#ifdef FEATURE_WLAN_TDLS
2303 case SIR_MAC_TDLS_DIS_RSP:
2304 {
2305#ifdef FEATURE_WLAN_TDLS_INTERNAL
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002306 //LIM_LOG_TDLS(printk("Public Action TDLS Discovery RSP ..")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002307 limProcessTdlsPublicActionFrame(pMac, (tANI_U32*)pRxPacketInfo, psessionEntry) ;
2308#else
Chilam NG571c65a2013-01-19 12:27:36 +05302309 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002310
Chilam NG571c65a2013-01-19 12:27:36 +05302311 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002312 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002313 ("Public Action TDLS Discovery RSP ..")) ;
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302314 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2315 psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002316#endif
2317 }
2318 break;
2319#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002320
2321 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002322 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 break;
2324 }
2325 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002326
2327#ifdef WLAN_FEATURE_11W
2328 case SIR_MAC_ACTION_SA_QUERY:
2329 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002330 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002331 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
2332 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002333 switch (pActionHdr->actionID)
2334 {
2335 case SIR_MAC_SA_QUERY_REQ:
2336 /**11w SA query request action frame received**/
2337 /* Respond directly to the incoming request in LIM */
2338 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2339 break;
2340 case SIR_MAC_SA_QUERY_RSP:
2341 /**11w SA query response action frame received**/
Chet Lanctot8cecea22014-02-11 19:09:36 -08002342 /* Handle based on the current SA Query state */
Chet Lanctot186b5732013-03-18 10:26:30 -07002343 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2344 break;
2345 default:
2346 break;
2347 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 break;
2349 }
2350#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002351#ifdef WLAN_FEATURE_11AC
2352 case SIR_MAC_ACTION_VHT:
2353 {
2354 if (psessionEntry->vhtCapability)
2355 {
2356 switch (pActionHdr->actionID)
2357 {
2358 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2359 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2360 break;
2361 default:
2362 break;
2363 }
2364 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002365 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002366 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002367#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002369 PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled"), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 break;
2371 }
2372}
2373
Jeff Johnson295189b2012-06-20 16:38:30 -07002374/**
2375 * limProcessActionFrameNoSession
2376 *
2377 *FUNCTION:
2378 * This function is called by limProcessMessageQueue() upon
2379 * Action frame reception and no session.
2380 * Currently only public action frames can be received from
2381 * a non-associated station.
2382 *
2383 *LOGIC:
2384 *
2385 *ASSUMPTIONS:
2386 *
2387 *NOTE:
2388 *
2389 * @param pMac - Pointer to Global MAC structure
2390 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2391 * @return None
2392 */
2393
2394void
2395limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2396{
2397 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2398 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2399
Mohit Khanna23863762012-09-11 17:40:09 -07002400 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002401
2402 switch ( pActionHdr->category )
2403 {
2404 case SIR_MAC_ACTION_PUBLIC_USAGE:
2405 switch(pActionHdr->actionID) {
2406 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2407 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002408 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2409
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302411 if (vos_mem_compare(pActionHdr->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 {
2413 /* Forward to the SME to HDD to wpa_supplicant */
2414 // type is ACTION
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302415 limSendSmeMgmtFrameInd(pMac, 0, pBd, NULL, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 }
2417 else
2418 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002419 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002420 pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
2421 }
2422 }
2423 break;
2424 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002425 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 break;
2427 }
2428 break;
2429 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002430 PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x "), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 break;
2432
2433 }
2434}