blob: 733dff5fe4561e6367355adc0c7248dcefbbbbfe [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/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Jeff Johnson295189b2012-06-20 16:38:30 -070026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file limProcessActionFrame.cc contains the code
33 * for processing Action Frame.
34 * Author: Michael Lui
35 * Date: 05/23/03
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41#include "palTypes.h"
42#include "wniApi.h"
43#include "sirApi.h"
44#include "aniGlobal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046#include "schApi.h"
47#include "utilsApi.h"
48#include "limTypes.h"
49#include "limUtils.h"
50#include "limAssocUtils.h"
51#include "limSecurityUtils.h"
52#include "limSerDesUtils.h"
53#include "limSendSmeRspMessages.h"
54#include "parserApi.h"
55#include "limAdmitControl.h"
56#include "wmmApsd.h"
57#include "limSendMessages.h"
58#if defined WLAN_FEATURE_VOWIFI
59#include "rrmApi.h"
60#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070061#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080063#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
64#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070065#endif
66#include "wlan_qct_wda.h"
67
68
69#define BA_DEFAULT_TX_BUFFER_SIZE 64
70
71typedef enum
72{
73 LIM_ADDBA_RSP = 0,
74 LIM_ADDBA_REQ = 1
75}tLimAddBaValidationReqType;
76
77/* Note: The test passes if the STAUT stops sending any frames, and no further
78 frames are transmitted on this channel by the station when the AP has sent
79 the last 6 beacons, with the channel switch information elements as seen
80 with the sniffer.*/
81#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
82/**-----------------------------------------------------------------
83\fn limStopTxAndSwitchChannel
84\brief Stops the transmission if channel switch mode is silent and
85 starts the channel switch timer.
86
87\param pMac
88\return NONE
89-----------------------------------------------------------------*/
90void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
91{
92 tANI_U8 isFullPowerRequested = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -070093 tpPESession psessionEntry;
94
95 psessionEntry = peFindSessionBySessionId( pMac , sessionId );
96
97 if( NULL == psessionEntry )
98 {
99 limLog(pMac, LOGE, FL("Session %d not active\n "), sessionId);
100 return;
101 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700102
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700103 PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700104 psessionEntry->gLimChannelSwitch.switchMode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105
Jeff Johnsone7245742012-09-05 17:12:55 -0700106 if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
107 psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108 {
109 /* Freeze the transmission */
110 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
111
112 /*Request for Full power only if the device is in powersave*/
113 if(!limIsSystemInActiveState(pMac))
114 {
115 /* Request Full Power */
116 limSendSmePreChannelSwitchInd(pMac);
117 isFullPowerRequested = 1;
118 }
119 }
120 else
121 {
122 /* Resume the transmission */
123 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
124 }
125
Jeff Johnsone7245742012-09-05 17:12:55 -0700126 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 /* change the channel immediatly only if the channel switch count is 0 and the
128 * device is not in powersave
129 * If the device is in powersave channel switch should happen only after the
130 * device comes out of the powersave */
Jeff Johnsone7245742012-09-05 17:12:55 -0700131 if (psessionEntry->gLimChannelSwitch.switchCount == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700132 {
133 if(limIsSystemInActiveState(pMac))
134 {
135 limProcessChannelSwitchTimeout(pMac);
136 }
137 else if(!isFullPowerRequested)
138 {
139 /* If the Full power is already not requested
140 * Request Full Power so the channel switch happens
141 * after device comes to full power */
142 limSendSmePreChannelSwitchInd(pMac);
143 }
144 return;
145 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -0800146 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
Jeff Johnson295189b2012-06-20 16:38:30 -0700148
149 if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
150 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700151 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 }
153 return;
154}
155
156/**------------------------------------------------------------
157\fn limStartChannelSwitch
158\brief Switches the channel if switch count == 0, otherwise
159 starts the timer for channel switch and stops BG scan
160 and heartbeat timer tempororily.
161
162\param pMac
163\param psessionEntry
164\return NONE
165------------------------------------------------------------*/
166tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
167{
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700168 PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700169
170 /*If channel switch is already running and it is on a different session, just return*/
171 /*This need to be removed for MCC */
172 if( limIsChanSwitchRunning (pMac) &&
173 psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
174 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700175 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d"), psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700176 return eSIR_SUCCESS;
177 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -0800178 psessionEntry->channelChangeCSA = LIM_SWITCH_CHANNEL_CSA;
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 /* Deactivate and change reconfigure the timeout value */
Jeff Johnsone7245742012-09-05 17:12:55 -0700180 //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800181 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnsone7245742012-09-05 17:12:55 -0700182 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
183 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700184 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700185 return eSIR_FAILURE;
186 }
187
188 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
189 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
190 0) != TX_SUCCESS)
191 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700192 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnsone7245742012-09-05 17:12:55 -0700193 return eSIR_FAILURE;
194 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700195
196 /* Follow the channel switch, forget about the previous quiet. */
197 //If quiet is running, chance is there to resume tx on its timeout.
198 //so stop timer for a safer side.
Jeff Johnsone7245742012-09-05 17:12:55 -0700199 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -0700200 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700201 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
203 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700204 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700205 return eSIR_FAILURE;
206 }
207 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700208 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700210 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
212 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700213 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700214 return eSIR_FAILURE;
215 }
216 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700217 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700218
219 /* Prepare for 11h channel switch */
220 limPrepareFor11hChannelSwitch(pMac, psessionEntry);
221
222 /** Dont add any more statements here as we posted finish scan request
223 * to HAL, wait till we get the response
224 */
225 return eSIR_SUCCESS;
226}
227
228
229/**
230 * __limProcessChannelSwitchActionFrame
231 *
232 *FUNCTION:
233 *
234 *LOGIC:
235 *
236 *ASSUMPTIONS:
237 *
238 *NOTE:
239 *
240 * @param pMac - Pointer to Global MAC structure
241 * @param *pRxPacketInfo - A pointer to packet info structure
242 * @return None
243 */
244
245static void
246
247__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
248{
249
250 tpSirMacMgmtHdr pHdr;
251 tANI_U8 *pBody;
252 tDot11fChannelSwitch *pChannelSwitchFrame;
253 tANI_U16 beaconPeriod;
254 tANI_U32 val;
255 tANI_U32 frameLen;
256 tANI_U32 nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700257
258 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
259 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
260 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
261
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700262 PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 if (!psessionEntry->lim11hEnable)
264 return;
265
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530266 pChannelSwitchFrame = vos_mem_malloc(sizeof(*pChannelSwitchFrame));
267 if (NULL == pChannelSwitchFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 {
269 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530270 FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 return;
272 }
273
274 /* Unpack channel switch frame */
275 nStatus = dot11fUnpackChannelSwitch(pMac, pBody, frameLen, pChannelSwitchFrame);
276
277 if( DOT11F_FAILED( nStatus ))
278 {
279 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700280 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 nStatus,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700282 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530283 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 return;
285 }
286 else if(DOT11F_WARNED( nStatus ))
287 {
288 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700289 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 nStatus,
291 frameLen);
292 }
293
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530294 if (vos_mem_compare((tANI_U8 *) &psessionEntry->bssId,
295 (tANI_U8 *) &pHdr->sa,
296 sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 {
298 #if 0
299 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
300 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530301 vos_mem_free(pChannelSwitchFrame);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700302 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 return;
304 }
305 #endif// TO SUPPORT BT-AMP
306
307 /* copy the beacon interval from psessionEntry*/
308 val = psessionEntry->beaconParams.beaconInterval;
309
310 beaconPeriod = (tANI_U16) val;
311
Jeff Johnsone7245742012-09-05 17:12:55 -0700312 psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
313 psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
314 psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
315 psessionEntry->gLimChannelSwitch.switchCount;
316 psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700317#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700318 if ( pChannelSwitchFrame->WiderBWChanSwitchAnn.present && psessionEntry->vhtCapability)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700319 {
320 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth;
321 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0;
322 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq1;
323 }
324#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700325
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700326 PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700327 psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700328
329 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -0700330 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
331 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
Jeff Johnsone7245742012-09-05 17:12:55 -0700333 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700335 if ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
336 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700338 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
339 psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700341#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700342 if(psessionEntry->vhtCapability && pChannelSwitchFrame->WiderBWChanSwitchAnn.present)
343 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700344 if (pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
345 {
346 if (pChannelSwitchFrame->ExtChanSwitchAnn.present && ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
347 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)))
348 {
349 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700350 psessionEntry->gLimChannelSwitch.secondarySubBand =
351 limGet11ACPhyCBState(pMac,
352 psessionEntry->gLimChannelSwitch.primaryChannel,
353 pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset,
354 pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0,
355 psessionEntry);
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700356 }
357 }
358 }
359#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 }
361
362 }
363 else
364 {
365 PELOG1(limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));)
366 }
367
368 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
369 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700370 PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 }
372
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530373 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 return;
375} /*** end limProcessChannelSwitchActionFrame() ***/
376
377
Mohit Khanna4a70d262012-09-11 16:30:12 -0700378#ifdef WLAN_FEATURE_11AC
379static void
380__limProcessOperatingModeActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
381{
382
383 tpSirMacMgmtHdr pHdr;
384 tANI_U8 *pBody;
385 tDot11fOperatingMode *pOperatingModeframe;
386 tANI_U32 frameLen;
387 tANI_U32 nStatus;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700388 tpDphHashNode pSta;
389 tANI_U16 aid;
Abhishek Singhdf8eb312014-11-15 00:49:28 +0530390 tANI_U8 operMode;
391 tANI_U32 channelBondingMode;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700392
393 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
394 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
395 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
396
Abhishek Singhdf8eb312014-11-15 00:49:28 +0530397 limLog(pMac, LOG1, FL("Received Operating Mode action frame"));
398
399 if( RF_CHAN_14 >= psessionEntry->currentOperChannel )
400 {
401 channelBondingMode = pMac->roam.configParam.channelBondingMode24GHz;
402 }
403 else
404 {
405 channelBondingMode = pMac->roam.configParam.channelBondingMode5GHz;
406 }
407
408 /* Do not update the channel bonding mode if channel bonding
409 * mode is disabled in INI.
410 */
411 if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == channelBondingMode)
412 {
413 limLog(pMac, LOGW,
414 FL("channel bonding disabled"));
415 return;
416 }
417
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530418 pOperatingModeframe = vos_mem_malloc(sizeof(*pOperatingModeframe));
419 if (NULL == pOperatingModeframe)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700420 {
421 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530422 FL("AllocateMemory failed"));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700423 return;
424 }
425
426 /* Unpack channel switch frame */
427 nStatus = dot11fUnpackOperatingMode(pMac, pBody, frameLen, pOperatingModeframe);
428
429 if( DOT11F_FAILED( nStatus ))
430 {
431 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700432 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700433 nStatus,
434 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530435 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700436 return;
437 }
438 else if(DOT11F_WARNED( nStatus ))
439 {
440 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700441 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700442 nStatus,
443 frameLen);
444 }
445 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
446
447 operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
448 if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
449 {
450 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700451 FL(" received Chanwidth %d, staIdx = %d"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700452 (pOperatingModeframe->OperatingMode.chanWidth ),
453 pSta->staIndex);
454
455 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700456 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700457 pHdr->sa[0],
458 pHdr->sa[1],
459 pHdr->sa[2],
460 pHdr->sa[3],
461 pHdr->sa[4],
462 pHdr->sa[5]);
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700463
Mohit Khanna4a70d262012-09-11 16:30:12 -0700464 if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
465 {
466 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
467 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
468 }
469 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
470 {
471 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
472 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
473 }
474 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
475 {
476 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
477 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
478 }
479 limCheckVHTOpModeChange( pMac, psessionEntry,
480 (pOperatingModeframe->OperatingMode.chanWidth), pSta->staIndex);\
481 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530482 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700483 return;
484}
485#endif
486
Jeff Johnson295189b2012-06-20 16:38:30 -0700487static void
488__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
489{
Jeff Johnson295189b2012-06-20 16:38:30 -0700490}
491
492
493static void
494__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
495{
496 tSirAddtsRspInfo addts;
497 tSirRetStatus retval;
498 tpSirMacMgmtHdr pHdr;
499 tpDphHashNode pSta;
500 tANI_U16 aid;
501 tANI_U32 frameLen;
502 tANI_U8 *pBody;
503 tpLimTspecInfo tspecInfo;
504 tANI_U8 ac;
505 tpDphHashNode pStaDs = NULL;
506 tANI_U8 rspReqd = 1;
507 tANI_U32 cfgLen;
508 tSirMacAddr peerMacAddr;
509
510
511 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
512 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
513 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
514
515
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700516 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
518 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700519 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 return;
521 }
522
523 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
524 if (pSta == NULL)
525 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700526 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 return;
528 }
529
530 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
531 if (retval != eSIR_SUCCESS)
532 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700533 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 return;
535 }
536
537 // don't have to check for qos/wme capabilities since we wouldn't have this
538 // flag set otherwise
539 if (! pMac->lim.gLimAddtsSent)
540 {
541 // we never sent an addts request!
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700542 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 return;
544 }
545
546 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
547 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700548 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring",
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
550 return;
551 }
552
553 /*
554 * for successful addts reponse, try to add the classifier.
555 * if this fails for any reason, we should send a delts request to the ap
556 * for now, its ok not to send a delts since we are going to add support for
557 * multiple tclas soon and until then we won't send any addts requests with
558 * multiple tclas elements anyway.
559 * In case of addClassifier failure, we just let the addts timer run out
560 */
561 if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
562 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
563 (addts.status == eSIR_MAC_SUCCESS_STATUS))
564 {
565 // add the classifier - this should always succeed
566 if (addts.numTclas > 1) // currently no support for multiple tclas elements
567 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700568 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 aid, addts.numTclas);
570 return;
571 }
572 else if (addts.numTclas == 1)
573 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700574 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!", aid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
576 }
577 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700578 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
580 addts.status);
581
582 // deactivate the response timer
583 limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
584
585 if (addts.status != eSIR_MAC_SUCCESS_STATUS)
586 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700587 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
589 addts.status);
590 limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
591 psessionEntry->smeSessionId, psessionEntry->transactionId);
592
593 // clear the addts flag
594 pMac->lim.gLimAddtsSent = false;
595
596 return;
597 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800598#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 if (addts.tsmPresent)
600 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700601 limLog(pMac, LOGW, "TSM IE Present");
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800602 psessionEntry->eseContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
603 vos_mem_copy(&psessionEntry->eseContext.tsm.tsmInfo,
604 &addts.tsmIE,sizeof(tSirMacESETSMIE));
605#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700606 limSendSmeTsmIEInd(pMac, psessionEntry, addts.tsmIE.tsid,
607 addts.tsmIE.state, addts.tsmIE.msmt_interval);
608#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 limActivateTSMStatsTimer(pMac, psessionEntry);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800610#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 }
612#endif
613 /* Since AddTS response was successful, check for the PSB flag
614 * and directional flag inside the TS Info field.
615 * An AC is trigger enabled AC if the PSB subfield is set to 1
616 * in the uplink direction.
617 * An AC is delivery enabled AC if the PSB subfield is set to 1
618 * in the downlink direction.
619 * An AC is trigger and delivery enabled AC if the PSB subfield
620 * is set to 1 in the bi-direction field.
621 */
622 if (addts.tspec.tsinfo.traffic.psb == 1)
623 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
624 else
625 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
626
627
628 /* ADDTS success, so AC is now admitted. We shall now use the default
629 * EDCA parameters as advertised by AP and send the updated EDCA params
630 * to HAL.
631 */
632 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
633 if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
634 {
635 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
636 }
637 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
638 {
639 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
640 }
641 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
642 {
643 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
644 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
645 }
646
647 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
648
649 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
650 if (pStaDs != NULL)
651 {
652 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
653 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
654 else
655 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
656 }
657 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700658 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700659
660
661 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
662
663 //if schedule is not present then add TSPEC with svcInterval as 0.
664 if(!addts.schedulePresent)
665 addts.schedule.svcInterval = 0;
666 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
667 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700668 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
670 psessionEntry);
671 pMac->lim.gLimAddtsSent = false;
672 return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
673 }
674 if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +0530675 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 {
677 retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
678 if(eSIR_SUCCESS != retval)
679 {
680 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
681
682 // Send DELTS action frame to AP
683 cfgLen = sizeof(tSirMacAddr);
684 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
685 psessionEntry);
686 limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
687 psessionEntry->smeSessionId, psessionEntry->transactionId);
688 pMac->lim.gLimAddtsSent = false;
689 return;
690 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700691 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
693 }
694 else
695 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700696 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700698 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 // Use the smesessionId and smetransactionId from the PE session context
700 limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
701 psessionEntry->smeSessionId, psessionEntry->transactionId);
702 }
703
704 // clear the addts flag
705 pMac->lim.gLimAddtsSent = false;
706 return;
707}
708
709
710static void
711__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
712{
713 tSirRetStatus retval;
714 tSirDeltsReqInfo delts;
715 tpSirMacMgmtHdr pHdr;
716 tpDphHashNode pSta;
717 tANI_U32 frameLen;
718 tANI_U16 aid;
719 tANI_U8 *pBody;
720 tANI_U8 tsStatus;
721 tSirMacTSInfo *tsinfo;
722 tANI_U8 tspecIdx;
723 tANI_U8 ac;
724 tpDphHashNode pStaDs = NULL;
725
726
727 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
728 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
729 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
730
731 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
732 if (pSta == NULL)
733 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700734 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 return;
736 }
737
738 // parse the delts request
739 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
740 if (retval != eSIR_SUCCESS)
741 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700742 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 return;
744 }
745
746 if (delts.wmeTspecPresent)
747 {
748 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
749 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700750 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 return;
752 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700753 PELOG2(limLog(pMac, LOG2, FL("WME Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 }
755 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
756 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700757 PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 }
759 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
760 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700761 PELOG2(limLog(pMac, LOG2, FL("WSM Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 }
763 else
764 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700765 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 return;
767 }
768
769 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
770
771 // if no Admit Control, ignore the request
772 if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
773 {
774
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530775 if (upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC)
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700777 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 tsinfo->traffic.userPrio);
779 return;
780 }
781 }
782
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530783 if ((psessionEntry->limSystemRole != eLIM_AP_ROLE) &&
784 (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
785 limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
786
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 // try to delete the TS
788 if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
789 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700790 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 return;
792 }
793
794 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
795 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
796 {
797 //Edca only for now.
798 }
799 else
800 {
801 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530802 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
803 pSta->staIndex,
804 tspecIdx,
805 delts,
806 psessionEntry->peSessionId,
807 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700809 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 tsinfo->traffic.userPrio);
811 return;
812 }
813 }
814
815 /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
816 * The AC for this TSPEC is no longer trigger enabled if this Tspec
817 * was set-up in uplink direction only.
818 * The AC for this TSPEC is no longer delivery enabled if this Tspec
819 * was set-up in downlink direction only.
820 * The AC for this TSPEC is no longer triiger enabled and delivery
821 * enabled if this Tspec was a bidirectional TSPEC.
822 */
823 limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
824
825
826 /* We're deleting the TSPEC.
827 * The AC for this TSPEC is no longer admitted in uplink/downlink direction
828 * if this TSPEC was set-up in uplink/downlink direction only.
829 * The AC for this TSPEC is no longer admitted in both uplink and downlink
830 * directions if this TSPEC was a bi-directional TSPEC.
831 * If ACM is set for this AC and this AC is admitted only in downlink
832 * direction, PE needs to downgrade the EDCA parameter
833 * (for the AC for which TS is being deleted) to the
834 * next best AC for which ACM is not enabled, and send the
835 * updated values to HAL.
836 */
837 ac = upToAc(tsinfo->traffic.userPrio);
838
839 if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
840 {
841 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
842 }
843 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
844 {
845 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
846 }
847 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
848 {
849 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
850 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
851 }
852
853 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
854
855 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
856 if (pStaDs != NULL)
857 {
858 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
859 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
860 else
861 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
862 }
863 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700864 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700865
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700866 PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700867
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800868#ifdef FEATURE_WLAN_ESE
869#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700870 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
871#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800873#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700874#endif
875
876}
877
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700878static void
879__limProcessQosMapConfigureFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,
880 tpPESession psessionEntry)
881{
882 tpSirMacMgmtHdr pHdr;
883 tANI_U32 frameLen;
884 tANI_U8 *pBody;
885 tSirRetStatus retval;
886 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
887 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
888 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
889 retval = sirConvertQosMapConfigureFrame2Struct(pMac, pBody, frameLen,
Kumar Anand82c009f2014-05-29 00:29:42 -0700890 &psessionEntry->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700891 if (retval != eSIR_SUCCESS)
892 {
893 PELOGW(limLog(pMac, LOGE,
894 FL("QosMapConfigure frame parsing failed (error %d)"), retval);)
895 return;
896 }
897 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo, psessionEntry, 0);
898}
Jeff Johnson295189b2012-06-20 16:38:30 -0700899
900#ifdef ANI_SUPPORT_11H
901/**
902 * limProcessBasicMeasReq
903 *
904 *FUNCTION:
905 * This function is called by limProcessMeasurementRequestFrame()
906 * when it received a Basic measurement Request action frame.
907 * Station/BP receiving this should perform basic measurements
908 * and then send Basic Measurement Report. AP should not perform
909 * any measurements, and send report indicating refusal.
910 *
911 *LOGIC:
912 *
913 *ASSUMPTIONS:
914 *
915 *NOTE:
916 *
917 * @param pMac - Pointer to Global MAC structure
918 * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
919 * @return None
920 */
921static void
922__limProcessBasicMeasReq(tpAniSirGlobal pMac,
923 tpSirMacMeasReqActionFrame pMeasReqFrame,
924 tSirMacAddr peerMacAddr)
925{
926 // TBD - Station shall perform basic measurements
927
928 if (limSendMeasReportFrame(pMac,
929 pMeasReqFrame,
930 peerMacAddr) != eSIR_SUCCESS)
931 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700932 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 return;
934 }
935}
936
937
938/**
939 * limProcessCcaMeasReq
940 *
941 *FUNCTION:
942 * This function is called by limProcessMeasurementRequestFrame()
943 * when it received a CCA measurement Request action frame.
944 * Station/BP receiving this should perform CCA measurements
945 * and then send CCA Measurement Report. AP should not perform
946 * any measurements, and send report indicating refusal.
947 *
948 *LOGIC:
949 *
950 *ASSUMPTIONS:
951 *
952 *NOTE:
953 *
954 * @param pMac - Pointer to Global MAC structure
955 * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
956 * @return None
957 */
958static void
959__limProcessCcaMeasReq(tpAniSirGlobal pMac,
960 tpSirMacMeasReqActionFrame pMeasReqFrame,
961 tSirMacAddr peerMacAddr)
962{
963 // TBD - Station shall perform cca measurements
964
965 if (limSendMeasReportFrame(pMac,
966 pMeasReqFrame,
967 peerMacAddr) != eSIR_SUCCESS)
968 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700969 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 return;
971 }
972}
973
974
975/**
976 * __limProcessRpiMeasReq
977 *
978 *FUNCTION:
979 * This function is called by limProcessMeasurementRequestFrame()
980 * when it received a RPI measurement Request action frame.
981 * Station/BP/AP receiving this shall not perform any measurements,
982 * and send report indicating refusal.
983 *
984 *LOGIC:
985 *
986 *ASSUMPTIONS:
987 *
988 *NOTE:
989 *
990 * @param pMac - Pointer to Global MAC structure
991 * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
992 * @return None
993 */
994static void
995__limProcessRpiMeasReq(tpAniSirGlobal pMac,
996 tpSirMacMeasReqActionFrame pMeasReqFrame,
997 tSirMacAddr peerMacAddr)
998{
999 if (limSendMeasReportFrame(pMac,
1000 pMeasReqFrame,
1001 peerMacAddr) != eSIR_SUCCESS)
1002 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001003 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 return;
1005 }
1006}
1007
1008
1009/**
1010 * __limProcessMeasurementRequestFrame
1011 *
1012 *FUNCTION:
1013 *
1014 *LOGIC:
1015 *
1016 *ASSUMPTIONS:
1017 *
1018 *NOTE:
1019 *
1020 * @param pMac - Pointer to Global MAC structure
1021 * @param *pRxPacketInfo - A pointer to packet info structure
1022 * @return None
1023 */
1024
1025static void
1026__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1027{
1028 tpSirMacMgmtHdr pHdr;
1029 tANI_U8 *pBody;
1030 tpSirMacMeasReqActionFrame pMeasReqFrame;
1031 tANI_U32 frameLen;
1032
1033 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1034 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1035 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1036
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301037 pMeasReqFrame = vos_mem_malloc(sizeof( tSirMacMeasReqActionFrame ));
1038 if (NULL == pMeasReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 {
1040 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301041 FL("limProcessMeasurementRequestFrame: AllocateMemory failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 return;
1043 }
1044
1045 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1046 eSIR_SUCCESS)
1047 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001048 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 return;
1050 }
1051
1052
1053 switch(pMeasReqFrame->measReqIE.measType)
1054 {
1055 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
1056 __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1057 break;
1058
1059 case SIR_MAC_CCA_MEASUREMENT_TYPE:
1060 __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1061 break;
1062
1063 case SIR_MAC_RPI_MEASUREMENT_TYPE:
1064 __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1065 break;
1066
1067 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001068 PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 pMeasReqFrame->measReqIE.measType);)
1070 break;
1071 }
1072
1073} /*** end limProcessMeasurementRequestFrame ***/
1074
1075
1076/**
1077 * limProcessTpcRequestFrame
1078 *
1079 *FUNCTION:
1080 * This function is called upon receiving Tpc Request frame.
1081 *
1082 *NOTE:
1083 *
1084 * @param pMac - Pointer to Global MAC structure
1085 * @param *pRxPacketInfo - A pointer to packet info structure
1086 * @return None
1087 */
1088
1089static void
1090__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1091{
1092 tpSirMacMgmtHdr pHdr;
1093 tANI_U8 *pBody;
1094 tpSirMacTpcReqActionFrame pTpcReqFrame;
1095 tANI_U32 frameLen;
1096
1097 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1098 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1099 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1100
1101 PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
1102
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301103 pTpcReqFrame = vos_mem_malloc(sizeof( tSirMacTpcReqActionFrame ));
1104 if (NULL == pTpcReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301106 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 return;
1108 }
1109
1110 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1111 eSIR_SUCCESS)
1112 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001113 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 return;
1115 }
1116
1117 if (limSendTpcReportFrame(pMac,
1118 pTpcReqFrame,
1119 pHdr->sa) != eSIR_SUCCESS)
1120 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001121 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 return;
1123 }
1124}
1125#endif
1126
1127
1128/**
1129 * \brief Validate an ADDBA Req from peer with respect
1130 * to our own BA configuration
1131 *
1132 * \sa __limValidateAddBAParameterSet
1133 *
1134 * \param pMac The global tpAniSirGlobal object
1135 *
1136 * \param baParameterSet The ADDBA Parameter Set.
1137 *
1138 * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
1139 * delBAFlag is set when entry already exists.
1140 *
1141 * \param reqType ADDBA Req v/s ADDBA Rsp
1142 * 1 - ADDBA Req
1143 * 0 - ADDBA Rsp
1144 *
1145 * \return eSIR_SUCCESS if setup completes successfully
1146 * eSIR_FAILURE is some problem is encountered
1147 */
1148
1149static tSirMacStatusCodes
1150__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
1151 tpDphHashNode pSta,
1152 tDot11fFfAddBAParameterSet baParameterSet,
1153 tANI_U8 dialogueToken,
1154 tLimAddBaValidationReqType reqType ,
1155 tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
1156{
1157 if(baParameterSet.tid >= STACFG_MAX_TC)
1158 {
1159 return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
1160 }
1161
1162 //check if there is already a BA session setup with this STA/TID while processing AddBaReq
1163 if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
1164 (LIM_ADDBA_REQ == reqType))
1165 {
1166 //There is already BA session setup for STA/TID.
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001167 limLog( pMac, LOGE,
Jeff Johnson295189b2012-06-20 16:38:30 -07001168 FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
1169 pSta->staIndex, baParameterSet.tid);
1170 limPrintMacAddr( pMac, pSta->staAddr, LOGW );
1171
1172 if(pDelBAFlag)
1173 *pDelBAFlag = true;
1174 }
1175 return eSIR_MAC_SUCCESS_STATUS;
1176}
1177
1178/**
1179 * \brief Validate a DELBA Ind from peer with respect
1180 * to our own BA configuration
1181 *
1182 * \sa __limValidateDelBAParameterSet
1183 *
1184 * \param pMac The global tpAniSirGlobal object
1185 *
1186 * \param baParameterSet The DELBA Parameter Set.
1187 *
1188 * \param pSta Runtime, STA-related configuration cached
1189 * in the HashNode object
1190 *
1191 * \return eSIR_SUCCESS if setup completes successfully
1192 * eSIR_FAILURE is some problem is encountered
1193 */
1194static tSirMacStatusCodes
1195__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
1196 tDot11fFfDelBAParameterSet baParameterSet,
1197 tpDphHashNode pSta )
1198{
1199tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
1200
1201 // Validate if a BA is active for the requested TID
1202 if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
1203 pSta->tcCfg[baParameterSet.tid].fUseBARx )
1204 {
1205 statusCode = eSIR_MAC_SUCCESS_STATUS;
1206
1207 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001208 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 }
1210 else
1211 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001212 FL("Received an INVALID DELBA Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 baParameterSet.tid );
1214
1215 return statusCode;
1216}
1217
1218/**
1219 * \brief Process an ADDBA REQ
1220 *
1221 * \sa limProcessAddBAReq
1222 *
1223 * \param pMac The global tpAniSirGlobal object
1224 *
1225 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1226 *
1227 * \return none
1228 *
1229 */
1230static void
1231__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1232{
1233 tDot11fAddBAReq frmAddBAReq;
1234 tpSirMacMgmtHdr pHdr;
1235 tpDphHashNode pSta;
1236 tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
1237 tANI_U16 aid;
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001238 tANI_U32 frameLen, nStatus,val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 tANI_U8 *pBody;
1240 tANI_U8 delBAFlag =0;
1241
1242 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1243 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1244 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001245 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001246
1247 // Unpack the received frame
1248 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1249 if( DOT11F_FAILED( nStatus ))
1250 {
1251 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001252 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 nStatus,
1254 frameLen );
1255
1256 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1257
1258 // Without an unpacked request we cannot respond, so silently ignore the request
1259 return;
1260 }
1261 else if ( DOT11F_WARNED( nStatus ) )
1262 {
1263 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001264 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 nStatus,
1266 frameLen );
1267
1268 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1269 }
1270
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001271 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1272
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1274 if( pSta == NULL )
1275 {
1276 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001277 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001278 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001279
1280 // FIXME - Should we do this?
1281 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1282 goto returnAfterError;
1283 }
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301284 limLog( pMac, LOG1, FL( "ADDBA Req from STA "MAC_ADDRESS_STR " with AID %d"
1285 " tid = %d policy = %d buffsize = %d"
1286 " amsduSupported = %d"), MAC_ADDR_ARRAY(pHdr->sa),
1287 aid, frmAddBAReq.AddBAParameterSet.tid,
1288 frmAddBAReq.AddBAParameterSet.policy,
1289 frmAddBAReq.AddBAParameterSet.bufferSize,
1290 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07001291
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301292 limLog( pMac, LOG1, FL( "ssn = %d fragNumber = %d" ),
1293 frmAddBAReq.BAStartingSequenceControl.ssn,
1294 frmAddBAReq.BAStartingSequenceControl.fragNumber);
1295
Jeff Johnson295189b2012-06-20 16:38:30 -07001296#ifdef WLAN_SOFTAP_VSTA_FEATURE
1297 // we can only do BA on "hard" STAs
1298 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1299 {
1300 status = eSIR_MAC_REQ_DECLINED_STATUS;
1301 goto returnAfterError;
1302 }
1303#endif //WLAN_SOFTAP_VSTA_FEATURE
1304
c_hpothu3ba2a512014-08-06 14:02:54 +05301305 if (wlan_cfgGetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, &val) !=
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001306 eSIR_SUCCESS)
1307 {
1308 limLog(pMac, LOGE,
c_hpothu3ba2a512014-08-06 14:02:54 +05301309 FL("Unable to get WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC"));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001310 val = 0;
1311 }
1312 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1313 val)
1314 {
1315 limLog( pMac, LOGW,
1316 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1317 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1318
1319 status = eSIR_MAC_REQ_DECLINED_STATUS;
1320 goto returnAfterError;
1321 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001322
1323 // Now, validate the ADDBA Req
1324 if( eSIR_MAC_SUCCESS_STATUS !=
1325 (status = __limValidateAddBAParameterSet( pMac, pSta,
1326 frmAddBAReq.AddBAParameterSet,
1327 0, //dialogue token is don't care in request validation.
1328 LIM_ADDBA_REQ, &delBAFlag)))
1329 goto returnAfterError;
1330
1331 //BA already set, so we need to delete it before adding new one.
1332 if(delBAFlag)
1333 {
1334 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1335 pSta,
1336 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1337 eBA_RECIPIENT,psessionEntry))
1338 {
1339 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1340 goto returnAfterError;
1341 }
1342 }
1343
1344 // Check if the ADD BA Declined configuration is Disabled
1345 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001346 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 frmAddBAReq.AddBAParameterSet.tid);
1348 status = eSIR_MAC_REQ_DECLINED_STATUS;
1349 goto returnAfterError;
1350 }
1351
1352 //
1353 // Post WDA_ADDBA_REQ to HAL.
1354 // If HAL/HDD decide to allow this ADDBA Req session,
1355 // then this BA session is termed active
1356 //
1357
1358 // Change the Block Ack state of this STA to wait for
1359 // ADDBA Rsp from HAL
1360 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001361
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001362 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001363 {
1364 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001365 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001366 }
1367
1368
1369 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1370 {
1371 frmAddBAReq.AddBAParameterSet.bufferSize =
1372 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1373 }
1374 else
1375 {
1376 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1377 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001378 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001379 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001380
1381 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1382 pSta,
1383 (tANI_U8) frmAddBAReq.DialogToken.token,
1384 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1385 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1386 frmAddBAReq.AddBAParameterSet.bufferSize,
1387 frmAddBAReq.BATimeout.timeout,
1388 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1389 eBA_RECIPIENT,psessionEntry))
1390 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1391 else
1392 return;
1393
1394returnAfterError:
1395
1396 //
1397 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1398 // status code. MLME will then send an ADDBA RSP
1399 // over the air to the peer MAC entity
1400 //
1401 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1402 pHdr->sa,
1403 status,
1404 frmAddBAReq.DialogToken.token,
1405 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1406 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1407 frmAddBAReq.AddBAParameterSet.bufferSize,
1408 frmAddBAReq.BATimeout.timeout,psessionEntry))
1409 {
1410 limLog( pMac, LOGW,
1411 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1412 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1413 }
1414
1415}
1416
1417/**
1418 * \brief Process an ADDBA RSP
1419 *
1420 * \sa limProcessAddBARsp
1421 *
1422 * \param pMac The global tpAniSirGlobal object
1423 *
1424 * \param pRxPacketInfo Handle to the packet info structure from HDD
1425 *
1426 * \return none
1427 *
1428 */
1429static void
1430__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1431{
1432tDot11fAddBARsp frmAddBARsp;
1433tpSirMacMgmtHdr pHdr;
1434tpDphHashNode pSta;
1435tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1436tANI_U16 aid;
1437tANI_U32 frameLen, nStatus;
1438tANI_U8 *pBody;
1439
1440 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1441 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1442 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1443
1444 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1445 if( pSta == NULL )
1446 {
1447 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001448 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1450 return;
1451 }
1452
1453#ifdef WLAN_SOFTAP_VSTA_FEATURE
1454 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1455 // Request, so we should never be processing a ADDBA Response
1456 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1457 {
1458 return;
1459 }
1460#endif //WLAN_SOFTAP_VSTA_FEATURE
1461
1462 // Unpack the received frame
1463 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1464 if( DOT11F_FAILED( nStatus ))
1465 {
1466 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001467 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 nStatus,
1469 frameLen );
1470
1471 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1472 goto returnAfterError;
1473 }
1474 else if ( DOT11F_WARNED( nStatus ) )
1475 {
1476 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001477 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 nStatus,
1479 frameLen );
1480
1481 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1482 }
1483
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05301484 limLog( pMac, LOG1, FL( "ADDBA Rsp from STA "MAC_ADDRESS_STR " with AID %d "
1485 "tid = %d policy = %d buffsize = %d "
1486 "amsduSupported = %d status = %d"),
1487 MAC_ADDR_ARRAY(pHdr->sa), aid,
1488 frmAddBARsp.AddBAParameterSet.tid,
1489 frmAddBARsp.AddBAParameterSet.policy,
1490 frmAddBARsp.AddBAParameterSet.bufferSize,
1491 frmAddBARsp.AddBAParameterSet.amsduSupported,
1492 frmAddBARsp.Status.status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 //if there is no matchin dialougue token then ignore the response.
1494
1495 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1496 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1497 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001498 PELOGW(limLog(pMac, LOGE, FL("dialogueToken in received addBARsp did not match with outstanding requests"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 return;
1500 }
1501
1502 // Check first if the peer accepted the ADDBA Req
1503 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1504 {
Kaushik, Sushant335328c2014-07-31 19:15:31 +05301505 tANI_U32 val;
1506 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
1507 {
1508 limLog(pMac, LOG1, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
1509 goto returnAfterError;
1510 }
1511 if (0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1512 frmAddBARsp.AddBAParameterSet.bufferSize = val;
1513 else
1514 frmAddBARsp.AddBAParameterSet.bufferSize =
1515 VOS_MIN(val, frmAddBARsp.AddBAParameterSet.bufferSize);
1516 limLog( pMac, LOG1,
1517 FL( "ADDBA RSP Buffsize = %d" ),
1518 frmAddBARsp.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 // Now, validate the ADDBA Rsp
1520 if( eSIR_MAC_SUCCESS_STATUS !=
1521 __limValidateAddBAParameterSet( pMac, pSta,
1522 frmAddBARsp.AddBAParameterSet,
1523 (tANI_U8)frmAddBARsp.DialogToken.token,
1524 LIM_ADDBA_RSP, NULL))
1525 goto returnAfterError;
1526 }
1527 else
1528 goto returnAfterError;
1529
1530 // Change STA state to wait for ADDBA Rsp from HAL
1531 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1532
1533 //
1534 // Post WDA_ADDBA_REQ to HAL.
1535 // If HAL/HDD decide to allow this ADDBA Rsp session,
1536 // then this BA session is termed active
1537 //
1538
1539 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1540 pSta,
1541 (tANI_U8) frmAddBARsp.DialogToken.token,
1542 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1543 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1544 frmAddBARsp.AddBAParameterSet.bufferSize,
1545 frmAddBARsp.BATimeout.timeout,
1546 0,
1547 eBA_INITIATOR,psessionEntry))
1548 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1549 else
1550 return;
1551
1552returnAfterError:
1553
1554 // TODO: Do we need to signal an error status to SME,
1555 // if status != eSIR_MAC_SUCCESS_STATUS
1556
1557 // Restore STA "BA" State
1558 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1559 //
1560 // Need to send a DELBA IND to peer, who
1561 // would have setup a BA session with this STA
1562 //
1563 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1564 {
1565 //
1566 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1567 // status code. MLME will then send a DELBA IND
1568 // over the air to the peer MAC entity
1569 //
1570 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1571 pSta,
1572 eBA_INITIATOR,
1573 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1574 reasonCode, psessionEntry))
1575 {
1576 limLog( pMac, LOGW,
1577 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1578 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1579 }
1580 }
1581}
1582
1583/**
1584 * \brief Process a DELBA Indication
1585 *
1586 * \sa limProcessDelBAInd
1587 *
1588 * \param pMac The global tpAniSirGlobal object
1589 *
1590 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1591 *
1592 * \return none
1593 *
1594 */
1595static void
1596__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1597{
1598tDot11fDelBAInd frmDelBAInd;
1599tpSirMacMgmtHdr pHdr;
1600tpDphHashNode pSta;
1601tANI_U16 aid;
1602tANI_U32 frameLen, nStatus;
1603tANI_U8 *pBody;
1604
1605 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1606 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1607 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1608
1609 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1610 if( pSta == NULL )
1611 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001612 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1614 return;
1615 }
1616
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001617 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
1619 // Unpack the received frame
1620 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1621 if( DOT11F_FAILED( nStatus ))
1622 {
1623 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001624 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 nStatus,
1626 frameLen );
1627
1628 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1629 return;
1630 }
1631 else if ( DOT11F_WARNED( nStatus ) )
1632 {
1633 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001634 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 nStatus,
1636 frameLen );
1637
1638 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1639 }
1640
Abhishek Singh1f6e6532014-06-05 17:35:08 +05301641 limLog( pMac, LOG1,
1642 FL( "Received DELBA from: "MAC_ADDRESS_STR" for TID %d, Reason code %d" ),
1643 MAC_ADDR_ARRAY(pHdr->sa),
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 frmDelBAInd.DelBAParameterSet.tid,
1645 frmDelBAInd.Reason.code );
1646
1647 // Now, validate the DELBA Ind
1648 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1649 frmDelBAInd.DelBAParameterSet,
1650 pSta ))
1651 return;
1652
1653 //
1654 // Post WDA_DELBA_IND to HAL and delete the
1655 // existing BA session
1656 //
1657 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1658 // is kind of confusing...
1659 //
1660 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1661 pSta,
1662 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1663 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1664 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001665 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001666
1667 return;
1668
1669}
1670
1671static void
1672__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1673{
1674
1675#if 0
1676 tpSirMacMgmtHdr pHdr;
1677 tDot11fSMPowerSave frmSMPower;
1678 tSirMacHTMIMOPowerSaveState state;
1679 tpDphHashNode pSta;
1680 tANI_U16 aid;
1681 tANI_U32 frameLen, nStatus;
1682 tANI_U8 *pBody;
1683
1684 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1685 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1686 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1687
1688 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1689 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001690 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1692 return;
1693 }
1694
1695 /**Unpack the received frame */
1696 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1697
1698 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001699 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 nStatus, frameLen );
1701 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1702 return;
1703 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001704 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 nStatus, frameLen );
1706 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1707 }
1708
1709 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1710 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1711 frmSMPower.SMPowerModeSet.Mode);
1712
1713 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1714 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1715 state = eSIR_HT_MIMO_PS_DYNAMIC;
1716 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1717 state = eSIR_HT_MIMO_PS_STATIC;
1718 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1719 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1720 else {
1721 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1722 return;
1723 }
1724
1725 if (state == pSta->htMIMOPSState) {
1726 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1727 return;
1728 }
1729
1730 /** Update in the HAL Station Table for the Update of the Protection Mode */
1731 pSta->htMIMOPSState = state;
1732 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1733
1734#endif
1735
1736}
1737
1738#if defined WLAN_FEATURE_VOWIFI
1739
1740static void
1741__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1742{
1743 tpSirMacMgmtHdr pHdr;
1744 tDot11fRadioMeasurementRequest frm;
1745 tANI_U32 frameLen, nStatus;
1746 tANI_U8 *pBody;
1747
1748 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1749 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1750 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1751
1752 if( psessionEntry == NULL )
1753 {
1754 return;
1755 }
1756
1757 /**Unpack the received frame */
1758 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1759
1760 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001761 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001762 nStatus, frameLen );
1763 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1764 return;
1765 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001766 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 nStatus, frameLen );
1768 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1769 }
1770
1771 // Call rrm function to handle the request.
1772
1773 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1774}
1775
1776static void
1777__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1778{
1779 tpSirMacMgmtHdr pHdr;
1780 tDot11fLinkMeasurementRequest frm;
1781 tANI_U32 frameLen, nStatus;
1782 tANI_U8 *pBody;
1783
1784 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1785 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1786 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1787
1788 if( psessionEntry == NULL )
1789 {
1790 return;
1791 }
1792
1793 /**Unpack the received frame */
1794 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1795
1796 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001797 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 nStatus, frameLen );
1799 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1800 return;
1801 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001802 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 nStatus, frameLen );
1804 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1805 }
1806
1807 // Call rrm function to handle the request.
1808
1809 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1810
1811}
1812
1813static void
1814__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1815{
1816 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001817 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 tANI_U32 frameLen, nStatus;
1819 tANI_U8 *pBody;
1820
1821 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1822 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1823 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1824
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301825 pFrm = vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
1826 if (NULL == pFrm)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001827 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301828 limLog(pMac, LOGE, FL("Unable to allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001829 return;
1830 }
1831
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301832 if(psessionEntry == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301834 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 return;
1836 }
1837
1838 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001839 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07001840
1841 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001842 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 nStatus, frameLen );
1844 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301845 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001846 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001848 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 nStatus, frameLen );
1850 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1851 }
1852
1853 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001854 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
1855
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301856 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001857}
1858
1859#endif
1860
1861#ifdef WLAN_FEATURE_11W
1862/**
Chet Lanctot186b5732013-03-18 10:26:30 -07001863 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07001864 *
1865 *FUNCTION:
1866 * This function is called by limProcessActionFrame() upon
1867 * SA query request Action frame reception.
1868 *
1869 *LOGIC:
1870 *
1871 *ASSUMPTIONS:
1872 *
1873 *NOTE:
1874 *
1875 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07001876 * @param *pRxPacketInfo - Handle to the Rx packet info
1877 * @param psessionEntry - PE session entry
1878 *
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 * @return None
1880 */
Chet Lanctot186b5732013-03-18 10:26:30 -07001881static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001882{
1883 tpSirMacMgmtHdr pHdr;
1884 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07001885 tANI_U8 transId[2];
Jeff Johnson295189b2012-06-20 16:38:30 -07001886
1887 /* Prima --- Below Macro not available in prima
1888 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1889 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1890
1891 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1892 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1893
Chet Lanctot186b5732013-03-18 10:26:30 -07001894 /* If this is an unprotected SA Query Request, then ignore it. */
1895 if (pHdr->fc.wep == 0)
1896 return;
1897
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 /*Extract 11w trsansId from SA query request action frame
1899 In SA query response action frame we will send same transId
1900 In SA query request action frame:
1901 Category : 1 byte
1902 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07001903 Transaction ID : 2 bytes */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301904 vos_mem_copy(&transId[0], &pBody[2], 2);
Jeff Johnson295189b2012-06-20 16:38:30 -07001905
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 //Send 11w SA query response action frame
1907 if (limSendSaQueryResponseFrame(pMac,
1908 transId,
1909 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
1910 {
Chet Lanctot186b5732013-03-18 10:26:30 -07001911 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 return;
1913 }
1914}
1915
Chet Lanctot186b5732013-03-18 10:26:30 -07001916/**
1917 * __limProcessSAQueryResponseActionFrame
1918 *
1919 *FUNCTION:
1920 * This function is called by limProcessActionFrame() upon
1921 * SA query response Action frame reception.
1922 *
1923 *LOGIC:
1924 *
1925 *ASSUMPTIONS:
1926 *
1927 *NOTE:
1928 *
1929 * @param pMac - Pointer to Global MAC structure
1930 * @param *pRxPacketInfo - Handle to the Rx packet info
1931 * @param psessionEntry - PE session entry
1932 * @return None
1933 */
1934static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
1935{
1936 tpSirMacMgmtHdr pHdr;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001937 tANI_U8 *pBody;
1938 tpDphHashNode pSta;
1939 tANI_U16 aid;
1940 tANI_U16 transId;
1941 tANI_U8 retryNum;
Chet Lanctot186b5732013-03-18 10:26:30 -07001942
1943 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Chet Lanctot8cecea22014-02-11 19:09:36 -08001944 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Chet Lanctot186b5732013-03-18 10:26:30 -07001945 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1946 ("SA Query Response received...")) ;
Chet Lanctot186b5732013-03-18 10:26:30 -07001947
Chet Lanctotdd6beeb2014-04-22 11:51:29 -07001948 /* When a station, supplicant handles SA Query Response.
1949 Forward to SME to HDD to wpa_supplicant. */
1950 if (eLIM_STA_ROLE == psessionEntry->limSystemRole)
1951 {
1952 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo, psessionEntry, 0);
1953 return;
1954 }
1955
Chet Lanctot8cecea22014-02-11 19:09:36 -08001956 /* If this is an unprotected SA Query Response, then ignore it. */
1957 if (pHdr->fc.wep == 0)
1958 return;
1959
1960 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
1961 if (NULL == pSta)
1962 return;
1963
1964 limLog(pMac, LOG1,
1965 FL("SA Query Response source addr - %0x:%0x:%0x:%0x:%0x:%0x"),
1966 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
1967 pHdr->sa[4], pHdr->sa[5]);
1968 limLog(pMac, LOG1,
1969 FL("SA Query state for station - %d"), pSta->pmfSaQueryState);
1970
1971 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
1972 return;
1973
1974 /* Extract 11w trsansId from SA query reponse action frame
1975 In SA query response action frame:
1976 Category : 1 byte
1977 Action : 1 byte
1978 Transaction ID : 2 bytes */
1979 vos_mem_copy(&transId, &pBody[2], 2);
1980
1981 /* If SA Query is in progress with the station and the station
1982 responds then the association request that triggered the SA
1983 query is from a rogue station, just go back to initial state. */
1984 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
1985 if (transId == pSta->pmfSaQueryStartTransId + retryNum)
1986 {
1987 limLog(pMac, LOG1,
1988 FL("Found matching SA Query Request - transaction ID %d"), transId);
1989 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
1990 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1991 break;
1992 }
1993}
Jeff Johnson295189b2012-06-20 16:38:30 -07001994#endif
1995
Chet Lanctotf7abfd42014-05-23 12:42:15 -07001996#ifdef WLAN_FEATURE_11W
1997/**
1998 * limDropUnprotectedActionFrame
1999 *
2000 *FUNCTION:
2001 * This function checks if an Action frame should be dropped since it is
2002 * a Robust Managment Frame, it is unprotected, and it is received on a
2003 * connection where PMF is enabled.
2004 *
2005 *LOGIC:
2006 *
2007 *ASSUMPTIONS:
2008 *
2009 *NOTE:
2010 *
2011 * @param pMac - Global MAC structure
2012 * @param psessionEntry - PE session entry
2013 * @param pHdr - Frame header
2014 * @param category - Action frame category
2015 * @return TRUE if frame should be dropped
2016 */
2017
2018static tANI_BOOLEAN
2019limDropUnprotectedActionFrame (tpAniSirGlobal pMac, tpPESession psessionEntry,
2020 tpSirMacMgmtHdr pHdr, tANI_U8 category)
2021{
2022 tANI_U16 aid;
2023 tpDphHashNode pStaDs;
2024 tANI_BOOLEAN rmfConnection = eANI_BOOLEAN_FALSE;
2025
2026 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
2027 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
2028 {
2029 pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
2030 if (pStaDs != NULL)
2031 if (pStaDs->rmfEnabled)
2032 rmfConnection = eANI_BOOLEAN_TRUE;
2033 }
2034 else if (psessionEntry->limRmfEnabled)
2035 rmfConnection = eANI_BOOLEAN_TRUE;
2036
2037 if (rmfConnection && (pHdr->fc.wep == 0))
2038 {
2039 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2040 "since RMF is enabled."), category);)
2041 return eANI_BOOLEAN_TRUE;
2042 }
2043 else
2044 return eANI_BOOLEAN_FALSE;
2045}
2046#endif
2047
Jeff Johnson295189b2012-06-20 16:38:30 -07002048/**
2049 * limProcessActionFrame
2050 *
2051 *FUNCTION:
2052 * This function is called by limProcessMessageQueue() upon
2053 * Action frame reception.
2054 *
2055 *LOGIC:
2056 *
2057 *ASSUMPTIONS:
2058 *
2059 *NOTE:
2060 *
2061 * @param pMac - Pointer to Global MAC structure
2062 * @param *pRxPacketInfo - A pointer to packet info structure
2063 * @return None
2064 */
2065
2066void
2067limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2068{
2069 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2070 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07002071#ifdef WLAN_FEATURE_11W
2072 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2073#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002074
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 switch (pActionHdr->category)
2076 {
2077 case SIR_MAC_ACTION_QOS_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07002078#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002079 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Chet Lanctot186b5732013-03-18 10:26:30 -07002080 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002081#endif
Leela Venkata Kiran Kumar Reddy Chiralac7c4e7e2014-04-29 10:50:16 -07002082 if ( (psessionEntry->limQosEnabled) ||
2083 (pActionHdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 {
2085 switch (pActionHdr->actionID)
2086 {
2087 case SIR_MAC_QOS_ADD_TS_REQ:
2088 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2089 break;
2090
2091 case SIR_MAC_QOS_ADD_TS_RSP:
2092 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2093 break;
2094
2095 case SIR_MAC_QOS_DEL_TS_REQ:
2096 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2097 break;
2098
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002099 case SIR_MAC_QOS_MAP_CONFIGURE:
2100 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2101 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002103 PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 break;
2105 }
2106 break ;
2107 }
2108
2109 break;
2110
2111 case SIR_MAC_ACTION_SPECTRUM_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07002112#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002113 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Chet Lanctot186b5732013-03-18 10:26:30 -07002114 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002115#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 switch (pActionHdr->actionID)
2117 {
2118#ifdef ANI_SUPPORT_11H
2119 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2120 if(psessionEntry->lim11hEnable)
2121 {
2122 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2123 }
2124 break;
2125
2126 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2127 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2128 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2129 {
2130 if(psessionEntry->lim11hEnable)
2131 {
2132 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2133 }
2134 }
2135 break;
2136
2137#endif
2138 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2139 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2140 {
2141 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2142 }
2143 break;
2144 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002145 PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 break;
2147 }
2148 break;
2149
2150 case SIR_MAC_ACTION_WME:
2151 if (! psessionEntry->limWmeEnabled)
2152 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002153 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 pActionHdr->actionID);
2155 break;
2156 }
2157 switch(pActionHdr->actionID)
2158 {
2159 case SIR_MAC_QOS_ADD_TS_REQ:
2160 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2161 break;
2162
2163 case SIR_MAC_QOS_ADD_TS_RSP:
2164 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2165 break;
2166
2167 case SIR_MAC_QOS_DEL_TS_REQ:
2168 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2169 break;
2170
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002171 case SIR_MAC_QOS_MAP_CONFIGURE:
2172 __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2173 break;
2174
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002176 PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 break;
2178 }
2179 break;
2180
2181 case SIR_MAC_ACTION_BLKACK:
2182 // Determine the "type" of BA Action Frame
Chet Lanctot186b5732013-03-18 10:26:30 -07002183#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002184 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Chet Lanctot186b5732013-03-18 10:26:30 -07002185 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002186#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 switch(pActionHdr->actionID)
2188 {
2189 case SIR_MAC_BLKACK_ADD_REQ:
2190 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2191 break;
2192
2193 case SIR_MAC_BLKACK_ADD_RSP:
2194 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2195 break;
2196
2197 case SIR_MAC_BLKACK_DEL:
2198 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2199 break;
2200
2201 default:
2202 break;
2203 }
2204
2205 break;
2206 case SIR_MAC_ACTION_HT:
2207 /** Type of HT Action to be performed*/
2208 switch(pActionHdr->actionID) {
2209 case SIR_MAC_SM_POWER_SAVE:
2210 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2211 break;
2212 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002213 PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 break;
2215 }
2216 break;
2217
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002218 case SIR_MAC_ACTION_WNM:
2219 {
2220#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002221 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002222 break;
Leela Venkata Kiran Kumar Reddy Chiralae8e62c82013-10-29 18:23:26 -07002223#endif
2224 PELOGE(limLog(pMac, LOG1, FL("WNM Action category %d action %d."),
2225 pActionHdr->category, pActionHdr->actionID);)
2226 switch (pActionHdr->actionID)
2227 {
2228 case SIR_MAC_WNM_BSS_TM_QUERY:
2229 case SIR_MAC_WNM_BSS_TM_REQUEST:
2230 case SIR_MAC_WNM_BSS_TM_RESPONSE:
2231 case SIR_MAC_WNM_NOTIF_REQUEST:
2232 case SIR_MAC_WNM_NOTIF_RESPONSE:
2233 {
2234 tpSirMacMgmtHdr pHdr;
2235 tANI_S8 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
2236 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2237 /* Forward to the SME to HDD to wpa_supplicant */
2238 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2239 psessionEntry, rssi);
2240 break;
2241 }
2242 }
2243 break;
2244 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002245#if defined WLAN_FEATURE_VOWIFI
2246 case SIR_MAC_ACTION_RRM:
Chet Lanctot186b5732013-03-18 10:26:30 -07002247#ifdef WLAN_FEATURE_11W
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002248 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
2249 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002250#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 if( pMac->rrm.rrmPEContext.rrmEnable )
2252 {
2253 switch(pActionHdr->actionID) {
2254 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2255 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2256 break;
2257 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2258 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2259 break;
2260 case SIR_MAC_RRM_NEIGHBOR_RPT:
2261 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2262 break;
2263 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002264 PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 break;
2266
2267 }
2268 }
2269 else
2270 {
2271 // Else we will just ignore the RRM messages.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002272 PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 }
2274 break;
2275#endif
Kiet Lam47325522014-03-10 11:50:46 -07002276#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002277 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2278 {
2279 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
2280 tpSirMacMgmtHdr pHdr;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002281 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2282
2283 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002284
2285 //Check if it is a vendor specific action frame.
2286 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302287 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002288 &pHdr->da[0], sizeof(tSirMacAddr))) &&
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002289 IS_WES_MODE_ENABLED(pMac) &&
2290 vos_mem_compare(pVendorSpecific->Oui, Oui, 3))
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002291 {
2292 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2293 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2294 /* Forward to the SME to HDD to wpa_supplicant */
2295 // type is ACTION
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302296 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2297 psessionEntry, 0);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002298 }
2299 else
2300 {
2301 limLog( pMac, LOGE, FL("Dropping the vendor specific action frame because of( "
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002302 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002303 "not received with SelfSta Mac address) system role = %d"),
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002304 IS_WES_MODE_ENABLED(pMac),
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002305 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2306 pVendorSpecific->Oui[2],
2307 psessionEntry->limSystemRole );
2308 }
2309 }
2310 break;
2311#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 case SIR_MAC_ACTION_PUBLIC_USAGE:
2313 switch(pActionHdr->actionID) {
2314 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2315 {
2316 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2318
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302320 if (vos_mem_compare(pPubAction->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 {
2322 /* Forward to the SME to HDD to wpa_supplicant */
2323 // type is ACTION
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302324 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2325 psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 }
2327 else
2328 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002329 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
2331 }
2332 }
2333 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002334#ifdef FEATURE_WLAN_TDLS
2335 case SIR_MAC_TDLS_DIS_RSP:
2336 {
2337#ifdef FEATURE_WLAN_TDLS_INTERNAL
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002338 //LIM_LOG_TDLS(printk("Public Action TDLS Discovery RSP ..")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002339 limProcessTdlsPublicActionFrame(pMac, (tANI_U32*)pRxPacketInfo, psessionEntry) ;
2340#else
Chilam NG571c65a2013-01-19 12:27:36 +05302341 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002342
Chilam NG571c65a2013-01-19 12:27:36 +05302343 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002344 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002345 ("Public Action TDLS Discovery RSP ..")) ;
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302346 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
2347 psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002348#endif
2349 }
2350 break;
2351#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002352
2353 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002354 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 break;
2356 }
2357 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002358
2359#ifdef WLAN_FEATURE_11W
2360 case SIR_MAC_ACTION_SA_QUERY:
2361 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002362 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
Chet Lanctotf7abfd42014-05-23 12:42:15 -07002363 if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
2364 break;
Chet Lanctot186b5732013-03-18 10:26:30 -07002365 switch (pActionHdr->actionID)
2366 {
2367 case SIR_MAC_SA_QUERY_REQ:
2368 /**11w SA query request action frame received**/
2369 /* Respond directly to the incoming request in LIM */
2370 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2371 break;
2372 case SIR_MAC_SA_QUERY_RSP:
2373 /**11w SA query response action frame received**/
Chet Lanctot8cecea22014-02-11 19:09:36 -08002374 /* Handle based on the current SA Query state */
Chet Lanctot186b5732013-03-18 10:26:30 -07002375 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2376 break;
2377 default:
2378 break;
2379 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002380 break;
2381 }
2382#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002383#ifdef WLAN_FEATURE_11AC
2384 case SIR_MAC_ACTION_VHT:
2385 {
2386 if (psessionEntry->vhtCapability)
2387 {
2388 switch (pActionHdr->actionID)
2389 {
2390 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2391 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2392 break;
2393 default:
2394 break;
2395 }
2396 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002397 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002398 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002399#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002400 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002401 PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled"), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 break;
2403 }
2404}
2405
Jeff Johnson295189b2012-06-20 16:38:30 -07002406/**
2407 * limProcessActionFrameNoSession
2408 *
2409 *FUNCTION:
2410 * This function is called by limProcessMessageQueue() upon
2411 * Action frame reception and no session.
2412 * Currently only public action frames can be received from
2413 * a non-associated station.
2414 *
2415 *LOGIC:
2416 *
2417 *ASSUMPTIONS:
2418 *
2419 *NOTE:
2420 *
2421 * @param pMac - Pointer to Global MAC structure
2422 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2423 * @return None
2424 */
2425
2426void
2427limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2428{
2429 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2430 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2431
Mohit Khanna23863762012-09-11 17:40:09 -07002432 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002433
2434 switch ( pActionHdr->category )
2435 {
2436 case SIR_MAC_ACTION_PUBLIC_USAGE:
2437 switch(pActionHdr->actionID) {
2438 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2439 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002440 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2441
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302443 if (vos_mem_compare(pActionHdr->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 {
2445 /* Forward to the SME to HDD to wpa_supplicant */
2446 // type is ACTION
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +05302447 limSendSmeMgmtFrameInd(pMac, 0, pBd, NULL, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 }
2449 else
2450 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002451 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
2453 }
2454 }
2455 break;
2456 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002457 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 break;
2459 }
2460 break;
2461 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002462 PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x "), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 break;
2464
2465 }
2466}