blob: 8d003010dcb8c271bc14f2c238dc7a7f5e1027c5 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080024 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam842dad02014-02-18 18:44:02 -080026 *
Jeff Johnson295189b2012-06-20 16:38:30 -070027 */
Kiet Lam842dad02014-02-18 18:44:02 -080028
29
Jeff Johnson295189b2012-06-20 16:38:30 -070030/*
Jeff Johnson295189b2012-06-20 16:38:30 -070031 * This file limProcessActionFrame.cc contains the code
32 * for processing Action Frame.
33 * Author: Michael Lui
34 * Date: 05/23/03
35 * History:-
36 * Date Modified by Modification Information
37 * --------------------------------------------------------------------
38 *
39 */
40#include "palTypes.h"
41#include "wniApi.h"
42#include "sirApi.h"
43#include "aniGlobal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "schApi.h"
46#include "utilsApi.h"
47#include "limTypes.h"
48#include "limUtils.h"
49#include "limAssocUtils.h"
50#include "limSecurityUtils.h"
51#include "limSerDesUtils.h"
52#include "limSendSmeRspMessages.h"
53#include "parserApi.h"
54#include "limAdmitControl.h"
55#include "wmmApsd.h"
56#include "limSendMessages.h"
57#if defined WLAN_FEATURE_VOWIFI
58#include "rrmApi.h"
59#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070060#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070061
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080062#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
63#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070064#endif
65#include "wlan_qct_wda.h"
66
67
68#define BA_DEFAULT_TX_BUFFER_SIZE 64
69
70typedef enum
71{
72 LIM_ADDBA_RSP = 0,
73 LIM_ADDBA_REQ = 1
74}tLimAddBaValidationReqType;
75
76/* Note: The test passes if the STAUT stops sending any frames, and no further
77 frames are transmitted on this channel by the station when the AP has sent
78 the last 6 beacons, with the channel switch information elements as seen
79 with the sniffer.*/
80#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
81/**-----------------------------------------------------------------
82\fn limStopTxAndSwitchChannel
83\brief Stops the transmission if channel switch mode is silent and
84 starts the channel switch timer.
85
86\param pMac
87\return NONE
88-----------------------------------------------------------------*/
89void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
90{
91 tANI_U8 isFullPowerRequested = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -070092 tpPESession psessionEntry;
93
94 psessionEntry = peFindSessionBySessionId( pMac , sessionId );
95
96 if( NULL == psessionEntry )
97 {
98 limLog(pMac, LOGE, FL("Session %d not active\n "), sessionId);
99 return;
100 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700102 PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700103 psessionEntry->gLimChannelSwitch.switchMode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
Jeff Johnsone7245742012-09-05 17:12:55 -0700105 if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
106 psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 {
108 /* Freeze the transmission */
109 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
110
111 /*Request for Full power only if the device is in powersave*/
112 if(!limIsSystemInActiveState(pMac))
113 {
114 /* Request Full Power */
115 limSendSmePreChannelSwitchInd(pMac);
116 isFullPowerRequested = 1;
117 }
118 }
119 else
120 {
121 /* Resume the transmission */
122 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
123 }
124
Jeff Johnsone7245742012-09-05 17:12:55 -0700125 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 /* change the channel immediatly only if the channel switch count is 0 and the
127 * device is not in powersave
128 * If the device is in powersave channel switch should happen only after the
129 * device comes out of the powersave */
Jeff Johnsone7245742012-09-05 17:12:55 -0700130 if (psessionEntry->gLimChannelSwitch.switchCount == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 {
132 if(limIsSystemInActiveState(pMac))
133 {
134 limProcessChannelSwitchTimeout(pMac);
135 }
136 else if(!isFullPowerRequested)
137 {
138 /* If the Full power is already not requested
139 * Request Full Power so the channel switch happens
140 * after device comes to full power */
141 limSendSmePreChannelSwitchInd(pMac);
142 }
143 return;
144 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -0800145 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700146
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
148 if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
149 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700150 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700151 }
152 return;
153}
154
155/**------------------------------------------------------------
156\fn limStartChannelSwitch
157\brief Switches the channel if switch count == 0, otherwise
158 starts the timer for channel switch and stops BG scan
159 and heartbeat timer tempororily.
160
161\param pMac
162\param psessionEntry
163\return NONE
164------------------------------------------------------------*/
165tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
166{
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700167 PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700168
169 /*If channel switch is already running and it is on a different session, just return*/
170 /*This need to be removed for MCC */
171 if( limIsChanSwitchRunning (pMac) &&
172 psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
173 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700174 limLog(pMac, LOGW, FL("Ignoring channel switch on session %d"), psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700175 return eSIR_SUCCESS;
176 }
177
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 /* Deactivate and change reconfigure the timeout value */
Jeff Johnsone7245742012-09-05 17:12:55 -0700179 //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800180 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnsone7245742012-09-05 17:12:55 -0700181 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
182 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700183 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700184 return eSIR_FAILURE;
185 }
186
187 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
188 psessionEntry->gLimChannelSwitch.switchTimeoutValue,
189 0) != TX_SUCCESS)
190 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700191 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnsone7245742012-09-05 17:12:55 -0700192 return eSIR_FAILURE;
193 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700194
195 /* Follow the channel switch, forget about the previous quiet. */
196 //If quiet is running, chance is there to resume tx on its timeout.
197 //so stop timer for a safer side.
Jeff Johnsone7245742012-09-05 17:12:55 -0700198 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -0700199 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700200 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
202 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700203 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700204 return eSIR_FAILURE;
205 }
206 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700207 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700209 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
211 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700212 limLog(pMac, LOGP, FL("tx_timer_deactivate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700213 return eSIR_FAILURE;
214 }
215 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700216 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700217
218 /* Prepare for 11h channel switch */
219 limPrepareFor11hChannelSwitch(pMac, psessionEntry);
220
221 /** Dont add any more statements here as we posted finish scan request
222 * to HAL, wait till we get the response
223 */
224 return eSIR_SUCCESS;
225}
226
227
228/**
229 * __limProcessChannelSwitchActionFrame
230 *
231 *FUNCTION:
232 *
233 *LOGIC:
234 *
235 *ASSUMPTIONS:
236 *
237 *NOTE:
238 *
239 * @param pMac - Pointer to Global MAC structure
240 * @param *pRxPacketInfo - A pointer to packet info structure
241 * @return None
242 */
243
244static void
245
246__limProcessChannelSwitchActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
247{
248
249 tpSirMacMgmtHdr pHdr;
250 tANI_U8 *pBody;
251 tDot11fChannelSwitch *pChannelSwitchFrame;
252 tANI_U16 beaconPeriod;
253 tANI_U32 val;
254 tANI_U32 frameLen;
255 tANI_U32 nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700256
257 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
258 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
259 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
260
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700261 PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 if (!psessionEntry->lim11hEnable)
263 return;
264
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530265 pChannelSwitchFrame = vos_mem_malloc(sizeof(*pChannelSwitchFrame));
266 if (NULL == pChannelSwitchFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 {
268 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530269 FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 return;
271 }
272
273 /* Unpack channel switch frame */
274 nStatus = dot11fUnpackChannelSwitch(pMac, pBody, frameLen, pChannelSwitchFrame);
275
276 if( DOT11F_FAILED( nStatus ))
277 {
278 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700279 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 nStatus,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700281 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530282 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return;
284 }
285 else if(DOT11F_WARNED( nStatus ))
286 {
287 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700288 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 nStatus,
290 frameLen);
291 }
292
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530293 if (vos_mem_compare((tANI_U8 *) &psessionEntry->bssId,
294 (tANI_U8 *) &pHdr->sa,
295 sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 {
297 #if 0
298 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
299 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530300 vos_mem_free(pChannelSwitchFrame);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700301 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 return;
303 }
304 #endif// TO SUPPORT BT-AMP
305
306 /* copy the beacon interval from psessionEntry*/
307 val = psessionEntry->beaconParams.beaconInterval;
308
309 beaconPeriod = (tANI_U16) val;
310
Jeff Johnsone7245742012-09-05 17:12:55 -0700311 psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
312 psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
313 psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
314 psessionEntry->gLimChannelSwitch.switchCount;
315 psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700316#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700317 if ( pChannelSwitchFrame->WiderBWChanSwitchAnn.present && psessionEntry->vhtCapability)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700318 {
319 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth;
320 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0;
321 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq1;
322 }
323#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700324
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700325 PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -0700326 psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700327
328 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -0700329 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
330 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700331
Jeff Johnsone7245742012-09-05 17:12:55 -0700332 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700334 if ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
335 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700337 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
338 psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700340#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700341 if(psessionEntry->vhtCapability && pChannelSwitchFrame->WiderBWChanSwitchAnn.present)
342 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700343 if (pChannelSwitchFrame->WiderBWChanSwitchAnn.newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
344 {
345 if (pChannelSwitchFrame->ExtChanSwitchAnn.present && ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
346 (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)))
347 {
348 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700349 psessionEntry->gLimChannelSwitch.secondarySubBand =
350 limGet11ACPhyCBState(pMac,
351 psessionEntry->gLimChannelSwitch.primaryChannel,
352 pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset,
353 pChannelSwitchFrame->WiderBWChanSwitchAnn.newCenterChanFreq0,
354 psessionEntry);
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700355 }
356 }
357 }
358#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 }
360
361 }
362 else
363 {
364 PELOG1(limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));)
365 }
366
367 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
368 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700369 PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 }
371
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530372 vos_mem_free(pChannelSwitchFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 return;
374} /*** end limProcessChannelSwitchActionFrame() ***/
375
376
Mohit Khanna4a70d262012-09-11 16:30:12 -0700377#ifdef WLAN_FEATURE_11AC
378static void
379__limProcessOperatingModeActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
380{
381
382 tpSirMacMgmtHdr pHdr;
383 tANI_U8 *pBody;
384 tDot11fOperatingMode *pOperatingModeframe;
385 tANI_U32 frameLen;
386 tANI_U32 nStatus;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700387 tpDphHashNode pSta;
388 tANI_U16 aid;
389 tANI_U8 operMode;
390
391 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
392 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
393 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
394
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700395 PELOG3(limLog(pMac, LOG3, FL("Received Operating Mode action frame"));)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530396 pOperatingModeframe = vos_mem_malloc(sizeof(*pOperatingModeframe));
397 if (NULL == pOperatingModeframe)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700398 {
399 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530400 FL("AllocateMemory failed"));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700401 return;
402 }
403
404 /* Unpack channel switch frame */
405 nStatus = dot11fUnpackOperatingMode(pMac, pBody, frameLen, pOperatingModeframe);
406
407 if( DOT11F_FAILED( nStatus ))
408 {
409 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700410 FL( "Failed to unpack and parse an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700411 nStatus,
412 frameLen);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530413 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700414 return;
415 }
416 else if(DOT11F_WARNED( nStatus ))
417 {
418 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700419 FL( "There were warnings while unpacking an 11h-CHANSW Request (0x%08x, %d bytes):"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700420 nStatus,
421 frameLen);
422 }
423 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
424
425 operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
426 if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
427 {
428 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700429 FL(" received Chanwidth %d, staIdx = %d"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700430 (pOperatingModeframe->OperatingMode.chanWidth ),
431 pSta->staIndex);
432
433 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700434 FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700435 pHdr->sa[0],
436 pHdr->sa[1],
437 pHdr->sa[2],
438 pHdr->sa[3],
439 pHdr->sa[4],
440 pHdr->sa[5]);
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700441
Mohit Khanna4a70d262012-09-11 16:30:12 -0700442 if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
443 {
444 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
445 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
446 }
447 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
448 {
449 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
450 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
451 }
452 else if(pOperatingModeframe->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
453 {
454 pSta->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
455 pSta->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
456 }
457 limCheckVHTOpModeChange( pMac, psessionEntry,
458 (pOperatingModeframe->OperatingMode.chanWidth), pSta->staIndex);\
459 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530460 vos_mem_free(pOperatingModeframe);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700461 return;
462}
463#endif
464
Jeff Johnson295189b2012-06-20 16:38:30 -0700465static void
466__limProcessAddTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
467{
Jeff Johnson295189b2012-06-20 16:38:30 -0700468}
469
470
471static void
472__limProcessAddTsRsp(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
473{
474 tSirAddtsRspInfo addts;
475 tSirRetStatus retval;
476 tpSirMacMgmtHdr pHdr;
477 tpDphHashNode pSta;
478 tANI_U16 aid;
479 tANI_U32 frameLen;
480 tANI_U8 *pBody;
481 tpLimTspecInfo tspecInfo;
482 tANI_U8 ac;
483 tpDphHashNode pStaDs = NULL;
484 tANI_U8 rspReqd = 1;
485 tANI_U32 cfgLen;
486 tSirMacAddr peerMacAddr;
487
488
489 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
490 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
491 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
492
493
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700494 PELOGW(limLog(pMac, LOGW, "Recv AddTs Response");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
496 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700497 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp recvd at AP: ignoring"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 return;
499 }
500
501 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
502 if (pSta == NULL)
503 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700504 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 return;
506 }
507
508 retval = sirConvertAddtsRsp2Struct(pMac, pBody, frameLen, &addts);
509 if (retval != eSIR_SUCCESS)
510 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700511 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 return;
513 }
514
515 // don't have to check for qos/wme capabilities since we wouldn't have this
516 // flag set otherwise
517 if (! pMac->lim.gLimAddtsSent)
518 {
519 // we never sent an addts request!
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700520 PELOGW(limLog(pMac, LOGW, "Recvd AddTsRsp but no request was ever sent - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 return;
522 }
523
524 if (pMac->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken)
525 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700526 limLog(pMac, LOGW, "AddTsRsp: token mismatch (got %d, exp %d) - ignoring",
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 addts.dialogToken, pMac->lim.gLimAddtsReq.req.dialogToken);
528 return;
529 }
530
531 /*
532 * for successful addts reponse, try to add the classifier.
533 * if this fails for any reason, we should send a delts request to the ap
534 * for now, its ok not to send a delts since we are going to add support for
535 * multiple tclas soon and until then we won't send any addts requests with
536 * multiple tclas elements anyway.
537 * In case of addClassifier failure, we just let the addts timer run out
538 */
539 if (((addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
540 (addts.tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) &&
541 (addts.status == eSIR_MAC_SUCCESS_STATUS))
542 {
543 // add the classifier - this should always succeed
544 if (addts.numTclas > 1) // currently no support for multiple tclas elements
545 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700546 limLog(pMac, LOGE, FL("Sta %d: Too many Tclas (%d), only 1 supported"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 aid, addts.numTclas);
548 return;
549 }
550 else if (addts.numTclas == 1)
551 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700552 limLog(pMac, LOGW, "AddTs Response from STA %d: tsid %d, UP %d, OK!", aid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio);
554 }
555 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700556 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
558 addts.status);
559
560 // deactivate the response timer
561 limDeactivateAndChangeTimer(pMac, eLIM_ADDTS_RSP_TIMER);
562
563 if (addts.status != eSIR_MAC_SUCCESS_STATUS)
564 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700565 limLog(pMac, LOGW, "Recv AddTsRsp: tsid %d, UP %d, status %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 addts.tspec.tsinfo.traffic.tsid, addts.tspec.tsinfo.traffic.userPrio,
567 addts.status);
568 limSendSmeAddtsRsp(pMac, true, addts.status, psessionEntry, addts.tspec,
569 psessionEntry->smeSessionId, psessionEntry->transactionId);
570
571 // clear the addts flag
572 pMac->lim.gLimAddtsSent = false;
573
574 return;
575 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800576#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 if (addts.tsmPresent)
578 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700579 limLog(pMac, LOGW, "TSM IE Present");
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800580 psessionEntry->eseContext.tsm.tid = addts.tspec.tsinfo.traffic.userPrio;
581 vos_mem_copy(&psessionEntry->eseContext.tsm.tsmInfo,
582 &addts.tsmIE,sizeof(tSirMacESETSMIE));
583#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700584 limSendSmeTsmIEInd(pMac, psessionEntry, addts.tsmIE.tsid,
585 addts.tsmIE.state, addts.tsmIE.msmt_interval);
586#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 limActivateTSMStatsTimer(pMac, psessionEntry);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800588#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 }
590#endif
591 /* Since AddTS response was successful, check for the PSB flag
592 * and directional flag inside the TS Info field.
593 * An AC is trigger enabled AC if the PSB subfield is set to 1
594 * in the uplink direction.
595 * An AC is delivery enabled AC if the PSB subfield is set to 1
596 * in the downlink direction.
597 * An AC is trigger and delivery enabled AC if the PSB subfield
598 * is set to 1 in the bi-direction field.
599 */
600 if (addts.tspec.tsinfo.traffic.psb == 1)
601 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, SET_UAPSD_MASK);
602 else
603 limSetTspecUapsdMask(pMac, &addts.tspec.tsinfo, CLEAR_UAPSD_MASK);
604
605
606 /* ADDTS success, so AC is now admitted. We shall now use the default
607 * EDCA parameters as advertised by AP and send the updated EDCA params
608 * to HAL.
609 */
610 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
611 if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
612 {
613 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
614 }
615 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
616 {
617 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
618 }
619 else if(addts.tspec.tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
620 {
621 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
622 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
623 }
624
625 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
626
627 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
628 if (pStaDs != NULL)
629 {
630 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
631 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
632 else
633 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
634 }
635 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700636 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700637
638
639 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
640
641 //if schedule is not present then add TSPEC with svcInterval as 0.
642 if(!addts.schedulePresent)
643 addts.schedule.svcInterval = 0;
644 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, &addts.tspec, addts.schedule.svcInterval, &tspecInfo))
645 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700646 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
648 psessionEntry);
649 pMac->lim.gLimAddtsSent = false;
650 return; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
651 }
652 if((addts.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA) ||
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +0530653 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 {
655 retval = limSendHalMsgAddTs(pMac, pSta->staIndex, tspecInfo->idx, addts.tspec, psessionEntry->peSessionId);
656 if(eSIR_SUCCESS != retval)
657 {
658 limAdmitControlDeleteTS(pMac, pSta->assocId, &addts.tspec.tsinfo, NULL, &tspecInfo->idx);
659
660 // Send DELTS action frame to AP
661 cfgLen = sizeof(tSirMacAddr);
662 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd, &addts.tspec.tsinfo, &addts.tspec,
663 psessionEntry);
664 limSendSmeAddtsRsp(pMac, true, retval, psessionEntry, addts.tspec,
665 psessionEntry->smeSessionId, psessionEntry->transactionId);
666 pMac->lim.gLimAddtsSent = false;
667 return;
668 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700669 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
671 }
672 else
673 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700674 PELOGW(limLog(pMac, LOGW, FL("AddTsRsp received successfully(UP %d, TSID %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 addts.tspec.tsinfo.traffic.userPrio, addts.tspec.tsinfo.traffic.tsid);)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700676 PELOGW(limLog(pMac, LOGW, FL("no ACM: Bypass sending WDA_ADD_TS_REQ to HAL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 // Use the smesessionId and smetransactionId from the PE session context
678 limSendSmeAddtsRsp(pMac, true, eSIR_SME_SUCCESS, psessionEntry, addts.tspec,
679 psessionEntry->smeSessionId, psessionEntry->transactionId);
680 }
681
682 // clear the addts flag
683 pMac->lim.gLimAddtsSent = false;
684 return;
685}
686
687
688static void
689__limProcessDelTsReq(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
690{
691 tSirRetStatus retval;
692 tSirDeltsReqInfo delts;
693 tpSirMacMgmtHdr pHdr;
694 tpDphHashNode pSta;
695 tANI_U32 frameLen;
696 tANI_U16 aid;
697 tANI_U8 *pBody;
698 tANI_U8 tsStatus;
699 tSirMacTSInfo *tsinfo;
700 tANI_U8 tspecIdx;
701 tANI_U8 ac;
702 tpDphHashNode pStaDs = NULL;
703
704
705 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
706 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
707 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
708
709 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
710 if (pSta == NULL)
711 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700712 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring DelTs"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 return;
714 }
715
716 // parse the delts request
717 retval = sirConvertDeltsReq2Struct(pMac, pBody, frameLen, &delts);
718 if (retval != eSIR_SUCCESS)
719 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700720 PELOGW(limLog(pMac, LOGW, FL("DelTs parsing failed (error %d)"), retval);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 return;
722 }
723
724 if (delts.wmeTspecPresent)
725 {
726 if ((!psessionEntry->limWmeEnabled) || (! pSta->wmeEnabled))
727 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700728 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 return;
730 }
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700731 PELOG2(limLog(pMac, LOG2, FL("WME Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 }
733 else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
734 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700735 PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 }
737 else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
738 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700739 PELOG2(limLog(pMac, LOG2, FL("WSM Delts received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 }
741 else
742 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700743 PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: qos not enabled/capable"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 return;
745 }
746
747 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
748
749 // if no Admit Control, ignore the request
750 if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA))
751 {
752
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530753 if (upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC)
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700755 limLog(pMac, LOGW, FL("DelTs with UP %d has no AC - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 tsinfo->traffic.userPrio);
757 return;
758 }
759 }
760
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530761 if ((psessionEntry->limSystemRole != eLIM_AP_ROLE) &&
762 (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE))
763 limSendSmeDeltsInd(pMac, &delts, aid,psessionEntry);
764
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 // try to delete the TS
766 if (eSIR_SUCCESS != limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx))
767 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700768 PELOGW(limLog(pMac, LOGW, FL("Unable to Delete TS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 return;
770 }
771
772 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
773 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
774 {
775 //Edca only for now.
776 }
777 else
778 {
779 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +0530780 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
781 pSta->staIndex,
782 tspecIdx,
783 delts,
784 psessionEntry->peSessionId,
785 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700787 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 tsinfo->traffic.userPrio);
789 return;
790 }
791 }
792
793 /* We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
794 * The AC for this TSPEC is no longer trigger enabled if this Tspec
795 * was set-up in uplink direction only.
796 * The AC for this TSPEC is no longer delivery enabled if this Tspec
797 * was set-up in downlink direction only.
798 * The AC for this TSPEC is no longer triiger enabled and delivery
799 * enabled if this Tspec was a bidirectional TSPEC.
800 */
801 limSetTspecUapsdMask(pMac, tsinfo, CLEAR_UAPSD_MASK);
802
803
804 /* We're deleting the TSPEC.
805 * The AC for this TSPEC is no longer admitted in uplink/downlink direction
806 * if this TSPEC was set-up in uplink/downlink direction only.
807 * The AC for this TSPEC is no longer admitted in both uplink and downlink
808 * directions if this TSPEC was a bi-directional TSPEC.
809 * If ACM is set for this AC and this AC is admitted only in downlink
810 * direction, PE needs to downgrade the EDCA parameter
811 * (for the AC for which TS is being deleted) to the
812 * next best AC for which ACM is not enabled, and send the
813 * updated values to HAL.
814 */
815 ac = upToAc(tsinfo->traffic.userPrio);
816
817 if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
818 {
819 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
820 }
821 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
822 {
823 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
824 }
825 else if(tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
826 {
827 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
828 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
829 }
830
831 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
832
833 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
834 if (pStaDs != NULL)
835 {
836 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
837 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
838 else
839 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
840 }
841 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700842 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700843
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700844 PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700845
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800846#ifdef FEATURE_WLAN_ESE
847#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700848 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
849#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800851#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700852#endif
853
854}
855
856
857#ifdef ANI_SUPPORT_11H
858/**
859 * limProcessBasicMeasReq
860 *
861 *FUNCTION:
862 * This function is called by limProcessMeasurementRequestFrame()
863 * when it received a Basic measurement Request action frame.
864 * Station/BP receiving this should perform basic measurements
865 * and then send Basic Measurement Report. AP should not perform
866 * any measurements, and send report indicating refusal.
867 *
868 *LOGIC:
869 *
870 *ASSUMPTIONS:
871 *
872 *NOTE:
873 *
874 * @param pMac - Pointer to Global MAC structure
875 * @param pMeasReqFrame - A pointer to Basic Meas. Req structure
876 * @return None
877 */
878static void
879__limProcessBasicMeasReq(tpAniSirGlobal pMac,
880 tpSirMacMeasReqActionFrame pMeasReqFrame,
881 tSirMacAddr peerMacAddr)
882{
883 // TBD - Station shall perform basic measurements
884
885 if (limSendMeasReportFrame(pMac,
886 pMeasReqFrame,
887 peerMacAddr) != eSIR_SUCCESS)
888 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700889 PELOGE(limLog(pMac, LOGE, FL("fail to send Basic Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 return;
891 }
892}
893
894
895/**
896 * limProcessCcaMeasReq
897 *
898 *FUNCTION:
899 * This function is called by limProcessMeasurementRequestFrame()
900 * when it received a CCA measurement Request action frame.
901 * Station/BP receiving this should perform CCA measurements
902 * and then send CCA Measurement Report. AP should not perform
903 * any measurements, and send report indicating refusal.
904 *
905 *LOGIC:
906 *
907 *ASSUMPTIONS:
908 *
909 *NOTE:
910 *
911 * @param pMac - Pointer to Global MAC structure
912 * @param pMeasReqFrame - A pointer to CCA Meas. Req structure
913 * @return None
914 */
915static void
916__limProcessCcaMeasReq(tpAniSirGlobal pMac,
917 tpSirMacMeasReqActionFrame pMeasReqFrame,
918 tSirMacAddr peerMacAddr)
919{
920 // TBD - Station shall perform cca measurements
921
922 if (limSendMeasReportFrame(pMac,
923 pMeasReqFrame,
924 peerMacAddr) != eSIR_SUCCESS)
925 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700926 PELOGE(limLog(pMac, LOGE, FL("fail to send CCA Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 return;
928 }
929}
930
931
932/**
933 * __limProcessRpiMeasReq
934 *
935 *FUNCTION:
936 * This function is called by limProcessMeasurementRequestFrame()
937 * when it received a RPI measurement Request action frame.
938 * Station/BP/AP receiving this shall not perform any measurements,
939 * and send report indicating refusal.
940 *
941 *LOGIC:
942 *
943 *ASSUMPTIONS:
944 *
945 *NOTE:
946 *
947 * @param pMac - Pointer to Global MAC structure
948 * @param pMeasReqFrame - A pointer to RPI Meas. Req structure
949 * @return None
950 */
951static void
952__limProcessRpiMeasReq(tpAniSirGlobal pMac,
953 tpSirMacMeasReqActionFrame pMeasReqFrame,
954 tSirMacAddr peerMacAddr)
955{
956 if (limSendMeasReportFrame(pMac,
957 pMeasReqFrame,
958 peerMacAddr) != eSIR_SUCCESS)
959 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700960 PELOGE(limLog(pMac, LOGE, FL("fail to send RPI Meas report "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 return;
962 }
963}
964
965
966/**
967 * __limProcessMeasurementRequestFrame
968 *
969 *FUNCTION:
970 *
971 *LOGIC:
972 *
973 *ASSUMPTIONS:
974 *
975 *NOTE:
976 *
977 * @param pMac - Pointer to Global MAC structure
978 * @param *pRxPacketInfo - A pointer to packet info structure
979 * @return None
980 */
981
982static void
983__limProcessMeasurementRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
984{
985 tpSirMacMgmtHdr pHdr;
986 tANI_U8 *pBody;
987 tpSirMacMeasReqActionFrame pMeasReqFrame;
988 tANI_U32 frameLen;
989
990 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
991 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
992 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
993
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530994 pMeasReqFrame = vos_mem_malloc(sizeof( tSirMacMeasReqActionFrame ));
995 if (NULL == pMeasReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 {
997 limLog(pMac, LOGE,
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530998 FL("limProcessMeasurementRequestFrame: AllocateMemory failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 return;
1000 }
1001
1002 if (sirConvertMeasReqFrame2Struct(pMac, pBody, pMeasReqFrame, frameLen) !=
1003 eSIR_SUCCESS)
1004 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001005 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid Measurement Request Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 return;
1007 }
1008
1009
1010 switch(pMeasReqFrame->measReqIE.measType)
1011 {
1012 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
1013 __limProcessBasicMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1014 break;
1015
1016 case SIR_MAC_CCA_MEASUREMENT_TYPE:
1017 __limProcessCcaMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1018 break;
1019
1020 case SIR_MAC_RPI_MEASUREMENT_TYPE:
1021 __limProcessRpiMeasReq(pMac, pMeasReqFrame, pHdr->sa);
1022 break;
1023
1024 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001025 PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 pMeasReqFrame->measReqIE.measType);)
1027 break;
1028 }
1029
1030} /*** end limProcessMeasurementRequestFrame ***/
1031
1032
1033/**
1034 * limProcessTpcRequestFrame
1035 *
1036 *FUNCTION:
1037 * This function is called upon receiving Tpc Request frame.
1038 *
1039 *NOTE:
1040 *
1041 * @param pMac - Pointer to Global MAC structure
1042 * @param *pRxPacketInfo - A pointer to packet info structure
1043 * @return None
1044 */
1045
1046static void
1047__limProcessTpcRequestFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
1048{
1049 tpSirMacMgmtHdr pHdr;
1050 tANI_U8 *pBody;
1051 tpSirMacTpcReqActionFrame pTpcReqFrame;
1052 tANI_U32 frameLen;
1053
1054 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1055 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1056 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1057
1058 PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
1059
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301060 pTpcReqFrame = vos_mem_malloc(sizeof( tSirMacTpcReqActionFrame ));
1061 if (NULL == pTpcReqFrame)
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301063 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 return;
1065 }
1066
1067 if (sirConvertTpcReqFrame2Struct(pMac, pBody, pTpcReqFrame, frameLen) !=
1068 eSIR_SUCCESS)
1069 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001070 PELOGW(limLog(pMac, LOGW, FL("Rcv invalid TPC Req Action Frame "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 return;
1072 }
1073
1074 if (limSendTpcReportFrame(pMac,
1075 pTpcReqFrame,
1076 pHdr->sa) != eSIR_SUCCESS)
1077 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001078 PELOGE(limLog(pMac, LOGE, FL("fail to send TPC Report Frame. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 return;
1080 }
1081}
1082#endif
1083
1084
1085/**
1086 * \brief Validate an ADDBA Req from peer with respect
1087 * to our own BA configuration
1088 *
1089 * \sa __limValidateAddBAParameterSet
1090 *
1091 * \param pMac The global tpAniSirGlobal object
1092 *
1093 * \param baParameterSet The ADDBA Parameter Set.
1094 *
1095 * \param pDelBAFlag this parameter is NULL except for call from processAddBAReq
1096 * delBAFlag is set when entry already exists.
1097 *
1098 * \param reqType ADDBA Req v/s ADDBA Rsp
1099 * 1 - ADDBA Req
1100 * 0 - ADDBA Rsp
1101 *
1102 * \return eSIR_SUCCESS if setup completes successfully
1103 * eSIR_FAILURE is some problem is encountered
1104 */
1105
1106static tSirMacStatusCodes
1107__limValidateAddBAParameterSet( tpAniSirGlobal pMac,
1108 tpDphHashNode pSta,
1109 tDot11fFfAddBAParameterSet baParameterSet,
1110 tANI_U8 dialogueToken,
1111 tLimAddBaValidationReqType reqType ,
1112 tANI_U8* pDelBAFlag /*this parameter is NULL except for call from processAddBAReq*/)
1113{
1114 if(baParameterSet.tid >= STACFG_MAX_TC)
1115 {
1116 return eSIR_MAC_WME_INVALID_PARAMS_STATUS;
1117 }
1118
1119 //check if there is already a BA session setup with this STA/TID while processing AddBaReq
1120 if((true == pSta->tcCfg[baParameterSet.tid].fUseBARx) &&
1121 (LIM_ADDBA_REQ == reqType))
1122 {
1123 //There is already BA session setup for STA/TID.
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001124 limLog( pMac, LOGE,
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 FL( "AddBAReq rcvd when there is already a session for this StaId = %d, tid = %d\n " ),
1126 pSta->staIndex, baParameterSet.tid);
1127 limPrintMacAddr( pMac, pSta->staAddr, LOGW );
1128
1129 if(pDelBAFlag)
1130 *pDelBAFlag = true;
1131 }
1132 return eSIR_MAC_SUCCESS_STATUS;
1133}
1134
1135/**
1136 * \brief Validate a DELBA Ind from peer with respect
1137 * to our own BA configuration
1138 *
1139 * \sa __limValidateDelBAParameterSet
1140 *
1141 * \param pMac The global tpAniSirGlobal object
1142 *
1143 * \param baParameterSet The DELBA Parameter Set.
1144 *
1145 * \param pSta Runtime, STA-related configuration cached
1146 * in the HashNode object
1147 *
1148 * \return eSIR_SUCCESS if setup completes successfully
1149 * eSIR_FAILURE is some problem is encountered
1150 */
1151static tSirMacStatusCodes
1152__limValidateDelBAParameterSet( tpAniSirGlobal pMac,
1153 tDot11fFfDelBAParameterSet baParameterSet,
1154 tpDphHashNode pSta )
1155{
1156tSirMacStatusCodes statusCode = eSIR_MAC_STA_BLK_ACK_NOT_SUPPORTED_STATUS;
1157
1158 // Validate if a BA is active for the requested TID
1159 if( pSta->tcCfg[baParameterSet.tid].fUseBATx ||
1160 pSta->tcCfg[baParameterSet.tid].fUseBARx )
1161 {
1162 statusCode = eSIR_MAC_SUCCESS_STATUS;
1163
1164 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001165 FL("Valid DELBA Ind received. Time to send WDA_DELBA_IND to HAL..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 }
1167 else
1168 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001169 FL("Received an INVALID DELBA Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 baParameterSet.tid );
1171
1172 return statusCode;
1173}
1174
1175/**
1176 * \brief Process an ADDBA REQ
1177 *
1178 * \sa limProcessAddBAReq
1179 *
1180 * \param pMac The global tpAniSirGlobal object
1181 *
1182 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1183 *
1184 * \return none
1185 *
1186 */
1187static void
1188__limProcessAddBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1189{
1190 tDot11fAddBAReq frmAddBAReq;
1191 tpSirMacMgmtHdr pHdr;
1192 tpDphHashNode pSta;
1193 tSirMacStatusCodes status = eSIR_MAC_SUCCESS_STATUS;
1194 tANI_U16 aid;
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001195 tANI_U32 frameLen, nStatus,val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 tANI_U8 *pBody;
1197 tANI_U8 delBAFlag =0;
1198
1199 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1200 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1201 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001202 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001203
1204 // Unpack the received frame
1205 nStatus = dot11fUnpackAddBAReq( pMac, pBody, frameLen, &frmAddBAReq );
1206 if( DOT11F_FAILED( nStatus ))
1207 {
1208 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001209 FL("Failed to unpack and parse an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 nStatus,
1211 frameLen );
1212
1213 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1214
1215 // Without an unpacked request we cannot respond, so silently ignore the request
1216 return;
1217 }
1218 else if ( DOT11F_WARNED( nStatus ) )
1219 {
1220 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001221 FL( "There were warnings while unpacking an ADDBA Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 nStatus,
1223 frameLen );
1224
1225 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1226 }
1227
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07001228 psessionEntry->amsduSupportedInBA = frmAddBAReq.AddBAParameterSet.amsduSupported;
1229
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1231 if( pSta == NULL )
1232 {
1233 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001234 FL( "STA context not found - ignoring ADDBA from " ));
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001235 limPrintMacAddr( pMac, pHdr->sa, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07001236
1237 // FIXME - Should we do this?
1238 status = eSIR_MAC_INABLITY_TO_CONFIRM_ASSOC_STATUS;
1239 goto returnAfterError;
1240 }
1241
1242 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001243 FL( "ADDBA Req from STA with AID %d, tid = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 aid, frmAddBAReq.AddBAParameterSet.tid);
1245
1246#ifdef WLAN_SOFTAP_VSTA_FEATURE
1247 // we can only do BA on "hard" STAs
1248 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1249 {
1250 status = eSIR_MAC_REQ_DECLINED_STATUS;
1251 goto returnAfterError;
1252 }
1253#endif //WLAN_SOFTAP_VSTA_FEATURE
1254
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001255 if (wlan_cfgGetInt(pMac, WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC, &val) !=
1256 eSIR_SUCCESS)
1257 {
1258 limLog(pMac, LOGE,
1259 FL("Unable to get WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC"));
1260 val = 0;
1261 }
1262 if ((SIR_BAND_2_4_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) &&
1263 val)
1264 {
1265 limLog( pMac, LOGW,
1266 FL( "BTC disabled aggregation - ignoring ADDBA from " ));
1267 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1268
1269 status = eSIR_MAC_REQ_DECLINED_STATUS;
1270 goto returnAfterError;
1271 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
1273 // Now, validate the ADDBA Req
1274 if( eSIR_MAC_SUCCESS_STATUS !=
1275 (status = __limValidateAddBAParameterSet( pMac, pSta,
1276 frmAddBAReq.AddBAParameterSet,
1277 0, //dialogue token is don't care in request validation.
1278 LIM_ADDBA_REQ, &delBAFlag)))
1279 goto returnAfterError;
1280
1281 //BA already set, so we need to delete it before adding new one.
1282 if(delBAFlag)
1283 {
1284 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1285 pSta,
1286 (tANI_U8)frmAddBAReq.AddBAParameterSet.tid,
1287 eBA_RECIPIENT,psessionEntry))
1288 {
1289 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1290 goto returnAfterError;
1291 }
1292 }
1293
1294 // Check if the ADD BA Declined configuration is Disabled
1295 if ((pMac->lim.gAddBA_Declined & ( 1 << frmAddBAReq.AddBAParameterSet.tid ) )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001296 limLog( pMac, LOGE, FL( "Declined the ADDBA Req for the TID %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 frmAddBAReq.AddBAParameterSet.tid);
1298 status = eSIR_MAC_REQ_DECLINED_STATUS;
1299 goto returnAfterError;
1300 }
1301
1302 //
1303 // Post WDA_ADDBA_REQ to HAL.
1304 // If HAL/HDD decide to allow this ADDBA Req session,
1305 // then this BA session is termed active
1306 //
1307
1308 // Change the Block Ack state of this STA to wait for
1309 // ADDBA Rsp from HAL
1310 LIM_SET_STA_BA_STATE(pSta, frmAddBAReq.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001311
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001312 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001313 {
1314 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001315 return ;
Kiran Kumar Lokere495c6142013-04-01 20:52:41 -07001316 }
1317
1318
1319 if (frmAddBAReq.AddBAParameterSet.bufferSize)
1320 {
1321 frmAddBAReq.AddBAParameterSet.bufferSize =
1322 VOS_MIN(val, frmAddBAReq.AddBAParameterSet.bufferSize);
1323 }
1324 else
1325 {
1326 frmAddBAReq.AddBAParameterSet.bufferSize = val;
1327 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001328 limLog( pMac, LOG1, FL( "ADDBAREQ NUMBUFF %d" ),
Madan Mohan Koyyalamudidd11eaf2012-11-02 16:04:21 -07001329 frmAddBAReq.AddBAParameterSet.bufferSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
1331 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1332 pSta,
1333 (tANI_U8) frmAddBAReq.DialogToken.token,
1334 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1335 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1336 frmAddBAReq.AddBAParameterSet.bufferSize,
1337 frmAddBAReq.BATimeout.timeout,
1338 (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
1339 eBA_RECIPIENT,psessionEntry))
1340 status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
1341 else
1342 return;
1343
1344returnAfterError:
1345
1346 //
1347 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
1348 // status code. MLME will then send an ADDBA RSP
1349 // over the air to the peer MAC entity
1350 //
1351 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
1352 pHdr->sa,
1353 status,
1354 frmAddBAReq.DialogToken.token,
1355 (tANI_U8) frmAddBAReq.AddBAParameterSet.tid,
1356 (tANI_U8) frmAddBAReq.AddBAParameterSet.policy,
1357 frmAddBAReq.AddBAParameterSet.bufferSize,
1358 frmAddBAReq.BATimeout.timeout,psessionEntry))
1359 {
1360 limLog( pMac, LOGW,
1361 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
1362 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1363 }
1364
1365}
1366
1367/**
1368 * \brief Process an ADDBA RSP
1369 *
1370 * \sa limProcessAddBARsp
1371 *
1372 * \param pMac The global tpAniSirGlobal object
1373 *
1374 * \param pRxPacketInfo Handle to the packet info structure from HDD
1375 *
1376 * \return none
1377 *
1378 */
1379static void
1380__limProcessAddBARsp( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1381{
1382tDot11fAddBARsp frmAddBARsp;
1383tpSirMacMgmtHdr pHdr;
1384tpDphHashNode pSta;
1385tSirMacReasonCodes reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1386tANI_U16 aid;
1387tANI_U32 frameLen, nStatus;
1388tANI_U8 *pBody;
1389
1390 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1391 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1392 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1393
1394 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1395 if( pSta == NULL )
1396 {
1397 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001398 FL( "STA context not found - ignoring ADDBA from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1400 return;
1401 }
1402
1403#ifdef WLAN_SOFTAP_VSTA_FEATURE
1404 // We can only do BA on "hard" STAs. We should not have issued an ADDBA
1405 // Request, so we should never be processing a ADDBA Response
1406 if (!(IS_HWSTA_IDX(pSta->staIndex)))
1407 {
1408 return;
1409 }
1410#endif //WLAN_SOFTAP_VSTA_FEATURE
1411
1412 // Unpack the received frame
1413 nStatus = dot11fUnpackAddBARsp( pMac, pBody, frameLen, &frmAddBARsp );
1414 if( DOT11F_FAILED( nStatus ))
1415 {
1416 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001417 FL( "Failed to unpack and parse an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 nStatus,
1419 frameLen );
1420
1421 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1422 goto returnAfterError;
1423 }
1424 else if ( DOT11F_WARNED( nStatus ) )
1425 {
1426 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001427 FL( "There were warnings while unpacking an ADDBA Response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001428 nStatus,
1429 frameLen );
1430
1431 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1432 }
1433
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001434 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001435 FL( "ADDBA Rsp from STA with AID %d, tid = %d, status = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 aid, frmAddBARsp.AddBAParameterSet.tid, frmAddBARsp.Status.status);
1437
1438 //if there is no matchin dialougue token then ignore the response.
1439
1440 if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
1441 pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
1442 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07001443 PELOGW(limLog(pMac, LOGE, FL("dialogueToken in received addBARsp did not match with outstanding requests"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 return;
1445 }
1446
1447 // Check first if the peer accepted the ADDBA Req
1448 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1449 {
1450 //if peer responded with buffer size 0 then we should pick the default.
1451 if(0 == frmAddBARsp.AddBAParameterSet.bufferSize)
1452 frmAddBARsp.AddBAParameterSet.bufferSize = BA_DEFAULT_TX_BUFFER_SIZE;
1453
1454 // Now, validate the ADDBA Rsp
1455 if( eSIR_MAC_SUCCESS_STATUS !=
1456 __limValidateAddBAParameterSet( pMac, pSta,
1457 frmAddBARsp.AddBAParameterSet,
1458 (tANI_U8)frmAddBARsp.DialogToken.token,
1459 LIM_ADDBA_RSP, NULL))
1460 goto returnAfterError;
1461 }
1462 else
1463 goto returnAfterError;
1464
1465 // Change STA state to wait for ADDBA Rsp from HAL
1466 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
1467
1468 //
1469 // Post WDA_ADDBA_REQ to HAL.
1470 // If HAL/HDD decide to allow this ADDBA Rsp session,
1471 // then this BA session is termed active
1472 //
1473
1474 if( eSIR_SUCCESS != limPostMsgAddBAReq( pMac,
1475 pSta,
1476 (tANI_U8) frmAddBARsp.DialogToken.token,
1477 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1478 (tANI_U8) frmAddBARsp.AddBAParameterSet.policy,
1479 frmAddBARsp.AddBAParameterSet.bufferSize,
1480 frmAddBARsp.BATimeout.timeout,
1481 0,
1482 eBA_INITIATOR,psessionEntry))
1483 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1484 else
1485 return;
1486
1487returnAfterError:
1488
1489 // TODO: Do we need to signal an error status to SME,
1490 // if status != eSIR_MAC_SUCCESS_STATUS
1491
1492 // Restore STA "BA" State
1493 LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_IDLE);
1494 //
1495 // Need to send a DELBA IND to peer, who
1496 // would have setup a BA session with this STA
1497 //
1498 if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
1499 {
1500 //
1501 // Package LIM_MLM_DELBA_REQ to MLME, with proper
1502 // status code. MLME will then send a DELBA IND
1503 // over the air to the peer MAC entity
1504 //
1505 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
1506 pSta,
1507 eBA_INITIATOR,
1508 (tANI_U8) frmAddBARsp.AddBAParameterSet.tid,
1509 reasonCode, psessionEntry))
1510 {
1511 limLog( pMac, LOGW,
1512 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
1513 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1514 }
1515 }
1516}
1517
1518/**
1519 * \brief Process a DELBA Indication
1520 *
1521 * \sa limProcessDelBAInd
1522 *
1523 * \param pMac The global tpAniSirGlobal object
1524 *
1525 * \param pRxPacketInfo Handle to the Rx packet info from HDD
1526 *
1527 * \return none
1528 *
1529 */
1530static void
1531__limProcessDelBAReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1532{
1533tDot11fDelBAInd frmDelBAInd;
1534tpSirMacMgmtHdr pHdr;
1535tpDphHashNode pSta;
1536tANI_U16 aid;
1537tANI_U32 frameLen, nStatus;
1538tANI_U8 *pBody;
1539
1540 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1541 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1542 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1543
1544 pSta = dphLookupHashEntry( pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1545 if( pSta == NULL )
1546 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001547 limLog( pMac, LOGE, FL( "STA context not found - ignoring DELBA from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1549 return;
1550 }
1551
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001552 limLog( pMac, LOG1, FL( "DELBA Ind from STA with AID %d" ), aid );
Jeff Johnson295189b2012-06-20 16:38:30 -07001553
1554 // Unpack the received frame
1555 nStatus = dot11fUnpackDelBAInd( pMac, pBody, frameLen, &frmDelBAInd );
1556 if( DOT11F_FAILED( nStatus ))
1557 {
1558 limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001559 FL( "Failed to unpack and parse a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 nStatus,
1561 frameLen );
1562
1563 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1564 return;
1565 }
1566 else if ( DOT11F_WARNED( nStatus ) )
1567 {
1568 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001569 FL( "There were warnings while unpacking a DELBA Indication (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 nStatus,
1571 frameLen );
1572
1573 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1574 }
1575
1576 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001577 FL( "Received DELBA for TID %d, Reason code %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 frmDelBAInd.DelBAParameterSet.tid,
1579 frmDelBAInd.Reason.code );
1580
1581 // Now, validate the DELBA Ind
1582 if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
1583 frmDelBAInd.DelBAParameterSet,
1584 pSta ))
1585 return;
1586
1587 //
1588 // Post WDA_DELBA_IND to HAL and delete the
1589 // existing BA session
1590 //
1591 // NOTE - IEEE 802.11-REVma-D8.0, Section 7.3.1.16
1592 // is kind of confusing...
1593 //
1594 if( eSIR_SUCCESS != limPostMsgDelBAInd( pMac,
1595 pSta,
1596 (tANI_U8) frmDelBAInd.DelBAParameterSet.tid,
1597 (eBA_RECIPIENT == frmDelBAInd.DelBAParameterSet.initiator)?
1598 eBA_INITIATOR: eBA_RECIPIENT,psessionEntry))
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001599 limLog( pMac, LOGE, FL( "Posting WDA_DELBA_IND to HAL failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001600
1601 return;
1602
1603}
1604
1605static void
1606__limProcessSMPowerSaveUpdate(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry)
1607{
1608
1609#if 0
1610 tpSirMacMgmtHdr pHdr;
1611 tDot11fSMPowerSave frmSMPower;
1612 tSirMacHTMIMOPowerSaveState state;
1613 tpDphHashNode pSta;
1614 tANI_U16 aid;
1615 tANI_U32 frameLen, nStatus;
1616 tANI_U8 *pBody;
1617
1618 pHdr = SIR_MAC_BD_TO_MPDUHEADER( pBd );
1619 pBody = SIR_MAC_BD_TO_MPDUDATA( pBd );
1620 frameLen = SIR_MAC_BD_TO_PAYLOAD_LEN( pBd );
1621
1622 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable );
1623 if( pSta == NULL ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001624 limLog( pMac, LOGE,FL( "STA context not found - ignoring UpdateSM PSave Mode from " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 limPrintMacAddr( pMac, pHdr->sa, LOGW );
1626 return;
1627 }
1628
1629 /**Unpack the received frame */
1630 nStatus = dot11fUnpackSMPowerSave( pMac, pBody, frameLen, &frmSMPower);
1631
1632 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001633 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 nStatus, frameLen );
1635 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1636 return;
1637 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001638 limLog(pMac, LOGW, FL( "There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 nStatus, frameLen );
1640 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1641 }
1642
1643 limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with PS_Enable:%d"
1644 "PS Mode: %d"), frmSMPower.SMPowerModeSet.PowerSave_En,
1645 frmSMPower.SMPowerModeSet.Mode);
1646
1647 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1648 if (frmSMPower.SMPowerModeSet.PowerSave_En && frmSMPower.SMPowerModeSet.Mode)
1649 state = eSIR_HT_MIMO_PS_DYNAMIC;
1650 else if ((frmSMPower.SMPowerModeSet.PowerSave_En) && (frmSMPower.SMPowerModeSet.Mode ==0))
1651 state = eSIR_HT_MIMO_PS_STATIC;
1652 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0) && (frmSMPower.SMPowerModeSet.Mode == 0))
1653 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1654 else {
1655 PELOGW(limLog(pMac, LOGW, FL("Received SM Power save Mode update Frame with invalid mode"));)
1656 return;
1657 }
1658
1659 if (state == pSta->htMIMOPSState) {
1660 PELOGE(limLog(pMac, LOGE, FL("The PEER is already set in the same mode"));)
1661 return;
1662 }
1663
1664 /** Update in the HAL Station Table for the Update of the Protection Mode */
1665 pSta->htMIMOPSState = state;
1666 limPostSMStateUpdate(pMac,pSta->staIndex, pSta->htMIMOPSState);
1667
1668#endif
1669
1670}
1671
1672#if defined WLAN_FEATURE_VOWIFI
1673
1674static void
1675__limProcessRadioMeasureRequest( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1676{
1677 tpSirMacMgmtHdr pHdr;
1678 tDot11fRadioMeasurementRequest frm;
1679 tANI_U32 frameLen, nStatus;
1680 tANI_U8 *pBody;
1681
1682 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1683 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1684 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1685
1686 if( psessionEntry == NULL )
1687 {
1688 return;
1689 }
1690
1691 /**Unpack the received frame */
1692 nStatus = dot11fUnpackRadioMeasurementRequest( pMac, pBody, frameLen, &frm );
1693
1694 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001695 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001696 nStatus, frameLen );
1697 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1698 return;
1699 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001700 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 nStatus, frameLen );
1702 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1703 }
1704
1705 // Call rrm function to handle the request.
1706
1707 rrmProcessRadioMeasurementRequest( pMac, pHdr->sa, &frm, psessionEntry );
1708}
1709
1710static void
1711__limProcessLinkMeasurementReq( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1712{
1713 tpSirMacMgmtHdr pHdr;
1714 tDot11fLinkMeasurementRequest frm;
1715 tANI_U32 frameLen, nStatus;
1716 tANI_U8 *pBody;
1717
1718 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1719 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1720 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1721
1722 if( psessionEntry == NULL )
1723 {
1724 return;
1725 }
1726
1727 /**Unpack the received frame */
1728 nStatus = dot11fUnpackLinkMeasurementRequest( pMac, pBody, frameLen, &frm );
1729
1730 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001731 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 nStatus, frameLen );
1733 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1734 return;
1735 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001736 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 nStatus, frameLen );
1738 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1739 }
1740
1741 // Call rrm function to handle the request.
1742
1743 rrmProcessLinkMeasurementRequest( pMac, pRxPacketInfo, &frm, psessionEntry );
1744
1745}
1746
1747static void
1748__limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
1749{
1750 tpSirMacMgmtHdr pHdr;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001751 tDot11fNeighborReportResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 tANI_U32 frameLen, nStatus;
1753 tANI_U8 *pBody;
1754
1755 pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
1756 pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
1757 frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
1758
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301759 pFrm = vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
1760 if (NULL == pFrm)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001761 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301762 limLog(pMac, LOGE, FL("Unable to allocate memory in __limProcessNeighborReport") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001763 return;
1764 }
1765
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301766 if(psessionEntry == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301768 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001769 return;
1770 }
1771
1772 /**Unpack the received frame */
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001773 nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
Jeff Johnson295189b2012-06-20 16:38:30 -07001774
1775 if( DOT11F_FAILED( nStatus )) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001776 limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 nStatus, frameLen );
1778 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301779 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001780 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001781 }else if ( DOT11F_WARNED( nStatus ) ) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001782 limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001783 nStatus, frameLen );
1784 PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
1785 }
1786
1787 //Call rrm function to handle the request.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001788 rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry );
1789
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301790 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001791}
1792
1793#endif
1794
1795#ifdef WLAN_FEATURE_11W
1796/**
Chet Lanctot186b5732013-03-18 10:26:30 -07001797 * limProcessSAQueryRequestActionFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 *
1799 *FUNCTION:
1800 * This function is called by limProcessActionFrame() upon
1801 * SA query request Action frame reception.
1802 *
1803 *LOGIC:
1804 *
1805 *ASSUMPTIONS:
1806 *
1807 *NOTE:
1808 *
1809 * @param pMac - Pointer to Global MAC structure
Chet Lanctot186b5732013-03-18 10:26:30 -07001810 * @param *pRxPacketInfo - Handle to the Rx packet info
1811 * @param psessionEntry - PE session entry
1812 *
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 * @return None
1814 */
Chet Lanctot186b5732013-03-18 10:26:30 -07001815static void __limProcessSAQueryRequestActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001816{
1817 tpSirMacMgmtHdr pHdr;
1818 tANI_U8 *pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07001819 tANI_U8 transId[2];
Jeff Johnson295189b2012-06-20 16:38:30 -07001820
1821 /* Prima --- Below Macro not available in prima
1822 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1823 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1824
1825 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1826 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1827
Chet Lanctot186b5732013-03-18 10:26:30 -07001828 /* If this is an unprotected SA Query Request, then ignore it. */
1829 if (pHdr->fc.wep == 0)
1830 return;
1831
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 /*Extract 11w trsansId from SA query request action frame
1833 In SA query response action frame we will send same transId
1834 In SA query request action frame:
1835 Category : 1 byte
1836 Action : 1 byte
Chet Lanctot186b5732013-03-18 10:26:30 -07001837 Transaction ID : 2 bytes */
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05301838 vos_mem_copy(&transId[0], &pBody[2], 2);
Jeff Johnson295189b2012-06-20 16:38:30 -07001839
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 //Send 11w SA query response action frame
1841 if (limSendSaQueryResponseFrame(pMac,
1842 transId,
1843 pHdr->sa,psessionEntry) != eSIR_SUCCESS)
1844 {
Chet Lanctot186b5732013-03-18 10:26:30 -07001845 PELOGE(limLog(pMac, LOGE, FL("fail to send SA query response action frame."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 return;
1847 }
1848}
1849
Chet Lanctot186b5732013-03-18 10:26:30 -07001850/**
1851 * __limProcessSAQueryResponseActionFrame
1852 *
1853 *FUNCTION:
1854 * This function is called by limProcessActionFrame() upon
1855 * SA query response Action frame reception.
1856 *
1857 *LOGIC:
1858 *
1859 *ASSUMPTIONS:
1860 *
1861 *NOTE:
1862 *
1863 * @param pMac - Pointer to Global MAC structure
1864 * @param *pRxPacketInfo - Handle to the Rx packet info
1865 * @param psessionEntry - PE session entry
1866 * @return None
1867 */
1868static void __limProcessSAQueryResponseActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tpPESession psessionEntry)
1869{
1870 tpSirMacMgmtHdr pHdr;
1871 tANI_U32 frameLen;
Chet Lanctot8cecea22014-02-11 19:09:36 -08001872 tANI_U8 *pBody;
1873 tpDphHashNode pSta;
1874 tANI_U16 aid;
1875 tANI_U16 transId;
1876 tANI_U8 retryNum;
Chet Lanctot186b5732013-03-18 10:26:30 -07001877
1878 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1879 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Chet Lanctot8cecea22014-02-11 19:09:36 -08001880 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Chet Lanctot186b5732013-03-18 10:26:30 -07001881 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1882 ("SA Query Response received...")) ;
Chet Lanctot186b5732013-03-18 10:26:30 -07001883
Chet Lanctot8cecea22014-02-11 19:09:36 -08001884 /* If this is an unprotected SA Query Response, then ignore it. */
1885 if (pHdr->fc.wep == 0)
1886 return;
1887
1888 pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
1889 if (NULL == pSta)
1890 return;
1891
1892 limLog(pMac, LOG1,
1893 FL("SA Query Response source addr - %0x:%0x:%0x:%0x:%0x:%0x"),
1894 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
1895 pHdr->sa[4], pHdr->sa[5]);
1896 limLog(pMac, LOG1,
1897 FL("SA Query state for station - %d"), pSta->pmfSaQueryState);
1898
1899 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
1900 return;
1901
1902 /* Extract 11w trsansId from SA query reponse action frame
1903 In SA query response action frame:
1904 Category : 1 byte
1905 Action : 1 byte
1906 Transaction ID : 2 bytes */
1907 vos_mem_copy(&transId, &pBody[2], 2);
1908
1909 /* If SA Query is in progress with the station and the station
1910 responds then the association request that triggered the SA
1911 query is from a rogue station, just go back to initial state. */
1912 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
1913 if (transId == pSta->pmfSaQueryStartTransId + retryNum)
1914 {
1915 limLog(pMac, LOG1,
1916 FL("Found matching SA Query Request - transaction ID %d"), transId);
1917 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
1918 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1919 break;
1920 }
1921}
Jeff Johnson295189b2012-06-20 16:38:30 -07001922#endif
1923
1924/**
1925 * limProcessActionFrame
1926 *
1927 *FUNCTION:
1928 * This function is called by limProcessMessageQueue() upon
1929 * Action frame reception.
1930 *
1931 *LOGIC:
1932 *
1933 *ASSUMPTIONS:
1934 *
1935 *NOTE:
1936 *
1937 * @param pMac - Pointer to Global MAC structure
1938 * @param *pRxPacketInfo - A pointer to packet info structure
1939 * @return None
1940 */
1941
1942void
1943limProcessActionFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1944{
1945 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1946 tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
Chet Lanctot186b5732013-03-18 10:26:30 -07001947#ifdef WLAN_FEATURE_11W
1948 tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1949#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001950
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 switch (pActionHdr->category)
1952 {
1953 case SIR_MAC_ACTION_QOS_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07001954#ifdef WLAN_FEATURE_11W
1955 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
1956 {
1957 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
1958 "since RMF is enabled."), pActionHdr->category);)
1959 break;
1960 }
1961#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 if (psessionEntry->limQosEnabled)
1963 {
1964 switch (pActionHdr->actionID)
1965 {
1966 case SIR_MAC_QOS_ADD_TS_REQ:
1967 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1968 break;
1969
1970 case SIR_MAC_QOS_ADD_TS_RSP:
1971 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1972 break;
1973
1974 case SIR_MAC_QOS_DEL_TS_REQ:
1975 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
1976 break;
1977
1978 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001979 PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 break;
1981 }
1982 break ;
1983 }
1984
1985 break;
1986
1987 case SIR_MAC_ACTION_SPECTRUM_MGMT:
Chet Lanctot186b5732013-03-18 10:26:30 -07001988#ifdef WLAN_FEATURE_11W
1989 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
1990 {
1991 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
1992 "since RMF is enabled."), pActionHdr->category);)
1993 break;
1994 }
1995#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 switch (pActionHdr->actionID)
1997 {
1998#ifdef ANI_SUPPORT_11H
1999 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
2000 if(psessionEntry->lim11hEnable)
2001 {
2002 __limProcessMeasurementRequestFrame(pMac, pRxPacketInfo);
2003 }
2004 break;
2005
2006 case SIR_MAC_ACTION_TPC_REQUEST_ID:
2007 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
2008 (pessionEntry->limSystemRole == eLIM_AP_ROLE))
2009 {
2010 if(psessionEntry->lim11hEnable)
2011 {
2012 __limProcessTpcRequestFrame(pMac, pRxPacketInfo);
2013 }
2014 }
2015 break;
2016
2017#endif
2018 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
2019 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
2020 {
2021 __limProcessChannelSwitchActionFrame(pMac, pRxPacketInfo,psessionEntry);
2022 }
2023 break;
2024 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002025 PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002026 break;
2027 }
2028 break;
2029
2030 case SIR_MAC_ACTION_WME:
2031 if (! psessionEntry->limWmeEnabled)
2032 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002033 limLog(pMac, LOGW, FL("WME mode disabled - dropping action frame %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 pActionHdr->actionID);
2035 break;
2036 }
2037 switch(pActionHdr->actionID)
2038 {
2039 case SIR_MAC_QOS_ADD_TS_REQ:
2040 __limProcessAddTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2041 break;
2042
2043 case SIR_MAC_QOS_ADD_TS_RSP:
2044 __limProcessAddTsRsp(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2045 break;
2046
2047 case SIR_MAC_QOS_DEL_TS_REQ:
2048 __limProcessDelTsReq(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2049 break;
2050
2051 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002052 PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 break;
2054 }
2055 break;
2056
2057 case SIR_MAC_ACTION_BLKACK:
2058 // Determine the "type" of BA Action Frame
Chet Lanctot186b5732013-03-18 10:26:30 -07002059#ifdef WLAN_FEATURE_11W
2060 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
2061 {
2062 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2063 "since RMF is enabled."), pActionHdr->category);)
2064 break;
2065 }
2066#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 switch(pActionHdr->actionID)
2068 {
2069 case SIR_MAC_BLKACK_ADD_REQ:
2070 __limProcessAddBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2071 break;
2072
2073 case SIR_MAC_BLKACK_ADD_RSP:
2074 __limProcessAddBARsp( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2075 break;
2076
2077 case SIR_MAC_BLKACK_DEL:
2078 __limProcessDelBAReq( pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2079 break;
2080
2081 default:
2082 break;
2083 }
2084
2085 break;
2086 case SIR_MAC_ACTION_HT:
2087 /** Type of HT Action to be performed*/
2088 switch(pActionHdr->actionID) {
2089 case SIR_MAC_SM_POWER_SAVE:
2090 __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
2091 break;
2092 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002093 PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 break;
2095 }
2096 break;
2097
2098#if defined WLAN_FEATURE_VOWIFI
2099 case SIR_MAC_ACTION_RRM:
Chet Lanctot186b5732013-03-18 10:26:30 -07002100#ifdef WLAN_FEATURE_11W
2101 if ((psessionEntry->limRmfEnabled) && (pHdr->fc.wep == 0))
2102 {
2103 PELOGE(limLog(pMac, LOGE, FL("Dropping unprotected Action category %d frame "
2104 "since RMF is enabled."), pActionHdr->category);)
2105 break;
2106 }
2107#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 if( pMac->rrm.rrmPEContext.rrmEnable )
2109 {
2110 switch(pActionHdr->actionID) {
2111 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
2112 __limProcessRadioMeasureRequest( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2113 break;
2114 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
2115 __limProcessLinkMeasurementReq( pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry );
2116 break;
2117 case SIR_MAC_RRM_NEIGHBOR_RPT:
2118 __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
2119 break;
2120 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002121 PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM"), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 break;
2123
2124 }
2125 }
2126 else
2127 {
2128 // Else we will just ignore the RRM messages.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002129 PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 }
2131 break;
2132#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002133#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) \
2134 || defined (WLAN_FEATURE_RELIABLE_MCAST)
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002135 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
2136 {
2137 tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
2138 tpSirMacMgmtHdr pHdr;
2139 tANI_U32 frameLen;
2140 tANI_U8 Oui[] = { 0x00, 0x00, 0xf0 };
2141
2142 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2143 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2144
2145 //Check if it is a vendor specific action frame.
2146 if ((eLIM_STA_ROLE == psessionEntry->limSystemRole) &&
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302147 (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002148 &pHdr->da[0], sizeof(tSirMacAddr))) &&
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002149 IS_WES_MODE_ENABLED(pMac) &&
2150 vos_mem_compare(pVendorSpecific->Oui, Oui, 3))
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002151 {
2152 PELOGE( limLog( pMac, LOGW, FL("Received Vendor specific action frame, OUI %x %x %x"),
2153 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
2154 /* Forward to the SME to HDD to wpa_supplicant */
2155 // type is ACTION
2156 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2157 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
2158 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, 0);
2159 }
2160 else
2161 {
2162 limLog( pMac, LOGE, FL("Dropping the vendor specific action frame because of( "
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002163 "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002164 "not received with SelfSta Mac address) system role = %d"),
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07002165 IS_WES_MODE_ENABLED(pMac),
Srinivas Girigowda100eb322013-03-15 16:48:20 -07002166 pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
2167 pVendorSpecific->Oui[2],
2168 psessionEntry->limSystemRole );
2169 }
2170 }
2171 break;
2172#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 case SIR_MAC_ACTION_PUBLIC_USAGE:
2174 switch(pActionHdr->actionID) {
2175 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2176 {
2177 tpSirMacVendorSpecificPublicActionFrameHdr pPubAction = (tpSirMacVendorSpecificPublicActionFrameHdr) pActionHdr;
2178 tpSirMacMgmtHdr pHdr;
2179 tANI_U32 frameLen;
2180 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2181
2182 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2183 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2184
2185 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302186 if (vos_mem_compare(pPubAction->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 {
2188 /* Forward to the SME to HDD to wpa_supplicant */
2189 // type is ACTION
2190 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2191 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302192 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 }
2194 else
2195 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002196 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
2198 }
2199 }
2200 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002201#ifdef FEATURE_WLAN_TDLS
2202 case SIR_MAC_TDLS_DIS_RSP:
2203 {
2204#ifdef FEATURE_WLAN_TDLS_INTERNAL
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002205 //LIM_LOG_TDLS(printk("Public Action TDLS Discovery RSP ..")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002206 limProcessTdlsPublicActionFrame(pMac, (tANI_U32*)pRxPacketInfo, psessionEntry) ;
2207#else
2208 tpSirMacMgmtHdr pHdr;
2209 tANI_U32 frameLen;
Chilam NG571c65a2013-01-19 12:27:36 +05302210 tANI_S8 rssi;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002211
2212 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2213 frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Chilam NG571c65a2013-01-19 12:27:36 +05302214 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002215 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002216 ("Public Action TDLS Discovery RSP ..")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002217 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2218 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302219 WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry, rssi);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002220#endif
2221 }
2222 break;
2223#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002224
2225 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002226 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 break;
2228 }
2229 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002230
2231#ifdef WLAN_FEATURE_11W
2232 case SIR_MAC_ACTION_SA_QUERY:
2233 {
Chet Lanctot186b5732013-03-18 10:26:30 -07002234 PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
2235 switch (pActionHdr->actionID)
2236 {
2237 case SIR_MAC_SA_QUERY_REQ:
2238 /**11w SA query request action frame received**/
2239 /* Respond directly to the incoming request in LIM */
2240 __limProcessSAQueryRequestActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2241 break;
2242 case SIR_MAC_SA_QUERY_RSP:
2243 /**11w SA query response action frame received**/
Chet Lanctot8cecea22014-02-11 19:09:36 -08002244 /* Handle based on the current SA Query state */
Chet Lanctot186b5732013-03-18 10:26:30 -07002245 __limProcessSAQueryResponseActionFrame(pMac,(tANI_U8*) pRxPacketInfo, psessionEntry );
2246 break;
2247 default:
2248 break;
2249 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 break;
2251 }
2252#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -07002253#ifdef WLAN_FEATURE_11AC
2254 case SIR_MAC_ACTION_VHT:
2255 {
2256 if (psessionEntry->vhtCapability)
2257 {
2258 switch (pActionHdr->actionID)
2259 {
2260 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2261 __limProcessOperatingModeActionFrame(pMac,pRxPacketInfo,psessionEntry);
2262 break;
2263 default:
2264 break;
2265 }
2266 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002267 break;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002268 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07002269#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002271 PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled"), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 break;
2273 }
2274}
2275
Jeff Johnson295189b2012-06-20 16:38:30 -07002276/**
2277 * limProcessActionFrameNoSession
2278 *
2279 *FUNCTION:
2280 * This function is called by limProcessMessageQueue() upon
2281 * Action frame reception and no session.
2282 * Currently only public action frames can be received from
2283 * a non-associated station.
2284 *
2285 *LOGIC:
2286 *
2287 *ASSUMPTIONS:
2288 *
2289 *NOTE:
2290 *
2291 * @param pMac - Pointer to Global MAC structure
2292 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2293 * @return None
2294 */
2295
2296void
2297limProcessActionFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pBd)
2298{
2299 tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
2300 tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
2301
Mohit Khanna23863762012-09-11 17:40:09 -07002302 limLog( pMac, LOG1, "Received a Action frame -- no session");
Jeff Johnson295189b2012-06-20 16:38:30 -07002303
2304 switch ( pActionHdr->category )
2305 {
2306 case SIR_MAC_ACTION_PUBLIC_USAGE:
2307 switch(pActionHdr->actionID) {
2308 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2309 {
2310 tpSirMacMgmtHdr pHdr;
2311 tANI_U32 frameLen;
2312 tANI_U8 P2POui[] = { 0x50, 0x6F, 0x9A, 0x09 };
2313
2314 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
2315 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd);
2316
2317 //Check if it is a P2P public action frame.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +05302318 if (vos_mem_compare(pActionHdr->Oui, P2POui, 4))
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 {
2320 /* Forward to the SME to HDD to wpa_supplicant */
2321 // type is ACTION
2322 limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType,
2323 (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
Chilam NG571c65a2013-01-19 12:27:36 +05302324 WDA_GET_RX_CH( pBd ), NULL, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 }
2326 else
2327 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002328 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
2330 }
2331 }
2332 break;
2333 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002334 PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 break;
2336 }
2337 break;
2338 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002339 PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x "), pActionHdr->category);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 break;
2341
2342 }
2343}