Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 23 | * Copyright (c) 2012-2014 Qualcomm Atheros, Inc. |
| 24 | * All Rights Reserved. |
| 25 | * Qualcomm Atheros Confidential and Proprietary. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 26 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | /** |
| 31 | * \file limSendManagementFrames.c |
| 32 | * |
| 33 | * \brief Code for preparing and sending 802.11 Management frames |
| 34 | * |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 35 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 36 | * |
| 37 | */ |
| 38 | |
| 39 | #include "sirApi.h" |
| 40 | #include "aniGlobal.h" |
| 41 | #include "sirMacProtDef.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | #include "cfgApi.h" |
| 43 | #include "utilsApi.h" |
| 44 | #include "limTypes.h" |
| 45 | #include "limUtils.h" |
| 46 | #include "limSecurityUtils.h" |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 47 | #include "limPropExtsUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 48 | #include "dot11f.h" |
| 49 | #include "limStaHashApi.h" |
| 50 | #include "schApi.h" |
| 51 | #include "limSendMessages.h" |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 52 | #include "limAssocUtils.h" |
| 53 | #include "limFT.h" |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 54 | #ifdef WLAN_FEATURE_11W |
| 55 | #include "wniCfgAp.h" |
| 56 | #endif |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 57 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | #if defined WLAN_FEATURE_VOWIFI |
| 59 | #include "rrmApi.h" |
| 60 | #endif |
| 61 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 63 | |
| 64 | |
| 65 | //////////////////////////////////////////////////////////////////////// |
| 66 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 67 | tSirRetStatus limStripOffExtCapIE(tpAniSirGlobal pMac, |
| 68 | tANI_U8 *addIE, |
| 69 | tANI_U16 *addnIELen, |
| 70 | tANI_U8 *pExtractedExtCapIEBuf ) |
| 71 | { |
| 72 | tANI_U8* tempbuf = NULL; |
| 73 | tANI_U16 tempLen = 0; |
| 74 | int left = *addnIELen; |
| 75 | tANI_U8 *ptr = addIE; |
| 76 | tANI_U8 elem_id, elem_len; |
| 77 | |
| 78 | if (NULL == addIE) |
| 79 | { |
| 80 | PELOGE(limLog(pMac, LOG1, FL("NULL addIE pointer"));) |
| 81 | return eSIR_IGNORE_IE ; |
| 82 | } |
| 83 | |
| 84 | tempbuf = vos_mem_malloc(left); |
| 85 | if ( NULL == tempbuf ) |
| 86 | { |
| 87 | PELOGE(limLog(pMac, LOGE, |
| 88 | FL("Unable to allocate memory to store addn IE"));) |
| 89 | return eSIR_MEM_ALLOC_FAILED; |
| 90 | } |
| 91 | |
| 92 | while(left >= 2) |
| 93 | { |
| 94 | elem_id = ptr[0]; |
| 95 | elem_len = ptr[1]; |
| 96 | left -= 2; |
| 97 | if (elem_len > left) |
| 98 | { |
| 99 | limLog( pMac, LOGE, |
| 100 | FL("Invalid IEs eid = %d elem_len=%d left=%d"), |
| 101 | elem_id,elem_len,left); |
| 102 | vos_mem_free(tempbuf); |
| 103 | return eSIR_FAILURE; |
| 104 | } |
| 105 | if ( !(DOT11F_EID_EXTCAP == elem_id) ) |
| 106 | { |
| 107 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
| 108 | tempLen += (elem_len + 2); |
| 109 | } |
| 110 | else |
| 111 | { /*Est Cap present size is 8 + 2 byte at present*/ |
| 112 | if ( NULL != pExtractedExtCapIEBuf ) |
| 113 | { |
| 114 | vos_mem_set(pExtractedExtCapIEBuf, |
| 115 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 116 | if (elem_len <= DOT11F_IE_EXTCAP_MAX_LEN ) |
| 117 | { |
| 118 | vos_mem_copy (pExtractedExtCapIEBuf, &ptr[0], |
| 119 | elem_len + 2); |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | left -= elem_len; |
| 124 | ptr += (elem_len + 2); |
| 125 | } |
| 126 | vos_mem_copy (addIE, tempbuf, tempLen); |
| 127 | *addnIELen = tempLen; |
| 128 | vos_mem_free(tempbuf); |
| 129 | return eSIR_SUCCESS; |
| 130 | } |
| 131 | |
| 132 | void limUpdateExtCapIEtoStruct(tpAniSirGlobal pMac, |
| 133 | tANI_U8 *pBuf, |
| 134 | tDot11fIEExtCap *pDst) |
| 135 | { |
| 136 | tANI_U8 pOut[DOT11F_IE_EXTCAP_MAX_LEN]; |
| 137 | |
| 138 | if ( NULL == pBuf ) |
| 139 | { |
| 140 | limLog( pMac, LOGE, |
| 141 | FL("Invalid Buffer Address")); |
| 142 | return; |
| 143 | } |
| 144 | if(NULL == pDst) |
| 145 | { |
| 146 | PELOGE(limLog(pMac, LOGE, |
| 147 | FL("NULL pDst pointer"));) |
| 148 | return ; |
| 149 | } |
| 150 | |
| 151 | if ( DOT11F_EID_EXTCAP != pBuf[0] || |
| 152 | pBuf[1] > DOT11F_IE_EXTCAP_MAX_LEN ) |
| 153 | { |
| 154 | limLog( pMac, LOGE, |
| 155 | FL("Invalid IEs eid = %d elem_len=%d "), |
| 156 | pBuf[0],pBuf[1]); |
| 157 | return; |
| 158 | } |
| 159 | vos_mem_set(( tANI_U8* )&pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, 0); |
| 160 | /* conversion should follow 4, 2, 2 byte order */ |
| 161 | limUtilsframeshtonl(pMac, &pOut[0],*((tANI_U32*)&pBuf[2]),0); |
| 162 | limUtilsframeshtons(pMac, &pOut[4],*((tANI_U16*)&pBuf[6]),0); |
| 163 | limUtilsframeshtons(pMac, &pOut[6],*((tANI_U16*)&pBuf[8]),0); |
| 164 | |
| 165 | if ( DOT11F_PARSE_SUCCESS != dot11fUnpackIeExtCap( pMac, |
| 166 | &pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, pDst) ) |
| 167 | { |
| 168 | limLog( pMac, LOGE, |
| 169 | FL("dot11fUnpackIeExtCap Parse Error ")); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | tSirRetStatus limStripOffExtCapIEAndUpdateStruct(tpAniSirGlobal pMac, |
| 174 | tANI_U8* addIE, |
| 175 | tANI_U16 *addnIELen, |
| 176 | tDot11fIEExtCap * pDst ) |
| 177 | { |
| 178 | tANI_U8 pExtractedExtCapIEBuf[DOT11F_IE_EXTCAP_MAX_LEN + 2]; |
| 179 | tSirRetStatus nSirStatus; |
| 180 | |
| 181 | vos_mem_set(( tANI_U8* )&pExtractedExtCapIEBuf[0], |
| 182 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 183 | nSirStatus = limStripOffExtCapIE(pMac, addIE, addnIELen, |
| 184 | pExtractedExtCapIEBuf); |
| 185 | if ( eSIR_SUCCESS != nSirStatus ) |
| 186 | { |
| 187 | limLog( pMac, LOG1, FL("Failed to strip off in" |
| 188 | "limStripOffExtCapIE status = (%d)."), |
| 189 | nSirStatus ); |
| 190 | return nSirStatus; |
| 191 | } |
| 192 | /* update the extracted ExtCap to struct*/ |
| 193 | limUpdateExtCapIEtoStruct(pMac, pExtractedExtCapIEBuf, pDst); |
| 194 | return nSirStatus; |
| 195 | } |
| 196 | |
| 197 | void limMergeExtCapIEStruct(tDot11fIEExtCap *pDst, |
| 198 | tDot11fIEExtCap *pSrc) |
| 199 | { |
| 200 | tANI_U8 *tempDst = (tANI_U8 *)pDst; |
| 201 | tANI_U8 *tempSrc = (tANI_U8 *)pSrc; |
| 202 | tANI_U8 structlen = sizeof(tDot11fIEExtCap); |
| 203 | |
| 204 | while(tempDst && tempSrc && structlen--) |
| 205 | { |
| 206 | *tempDst |= *tempSrc; |
| 207 | tempDst++; |
| 208 | tempSrc++; |
| 209 | } |
| 210 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 211 | |
| 212 | /** |
| 213 | * |
| 214 | * \brief This function is called by various LIM modules to prepare the |
| 215 | * 802.11 frame MAC header |
| 216 | * |
| 217 | * |
| 218 | * \param pMac Pointer to Global MAC structure |
| 219 | * |
| 220 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 221 | * |
| 222 | * \param type Type of the frame |
| 223 | * |
| 224 | * \param subType Subtype of the frame |
| 225 | * |
| 226 | * \return eHalStatus |
| 227 | * |
| 228 | * |
| 229 | * The pFrameBuf argument points to the beginning of the frame buffer to |
| 230 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 231 | * will be the MGMT frame payload The payload itself is populated by the |
| 232 | * caller API |
| 233 | * |
| 234 | * |
| 235 | */ |
| 236 | |
| 237 | tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac, |
| 238 | tANI_U8* pBD, |
| 239 | tANI_U8 type, |
| 240 | tANI_U8 subType, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 241 | tSirMacAddr peerAddr, tSirMacAddr selfMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 242 | { |
| 243 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 244 | tpSirMacMgmtHdr pMacHdr; |
| 245 | |
| 246 | /// Prepare MAC management header |
| 247 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 248 | |
| 249 | // Prepare FC |
| 250 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 251 | pMacHdr->fc.type = type; |
| 252 | pMacHdr->fc.subType = subType; |
| 253 | |
| 254 | // Prepare Address 1 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 255 | vos_mem_copy( (tANI_U8 *) pMacHdr->da, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 256 | (tANI_U8 *) peerAddr, |
| 257 | sizeof( tSirMacAddr )); |
| 258 | |
| 259 | // Prepare Address 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 260 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 261 | |
| 262 | // Prepare Address 3 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 263 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 264 | (tANI_U8 *) peerAddr, |
| 265 | sizeof( tSirMacAddr )); |
| 266 | return statusCode; |
| 267 | } /*** end limPopulateMacHeader() ***/ |
| 268 | |
| 269 | /** |
| 270 | * \brief limSendProbeReqMgmtFrame |
| 271 | * |
| 272 | * |
| 273 | * \param pMac Pointer to Global MAC structure |
| 274 | * |
| 275 | * \param pSsid SSID to be sent in Probe Request frame |
| 276 | * |
| 277 | * \param bssid BSSID to be sent in Probe Request frame |
| 278 | * |
| 279 | * \param nProbeDelay probe delay to be used before sending Probe Request |
| 280 | * frame |
| 281 | * |
| 282 | * \param nChannelNum Channel # on which the Probe Request is going out |
| 283 | * |
| 284 | * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame |
| 285 | * |
| 286 | * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame |
| 287 | * |
| 288 | * This function is called by various LIM modules to send Probe Request frame |
| 289 | * during active scan/learn phase. |
| 290 | * Probe request is sent out in the following scenarios: |
| 291 | * --heartbeat failure: session needed |
| 292 | * --join req: session needed |
| 293 | * --foreground scan: no session |
| 294 | * --background scan: no session |
| 295 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 296 | * |
| 297 | * |
| 298 | */ |
| 299 | tSirRetStatus |
| 300 | limSendProbeReqMgmtFrame(tpAniSirGlobal pMac, |
| 301 | tSirMacSSid *pSsid, |
| 302 | tSirMacAddr bssid, |
| 303 | tANI_U8 nChannelNum, |
| 304 | tSirMacAddr SelfMacAddr, |
| 305 | tANI_U32 dot11mode, |
| 306 | tANI_U32 nAdditionalIELen, |
| 307 | tANI_U8 *pAdditionalIE) |
| 308 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 309 | tDot11fProbeRequest pr; |
| 310 | tANI_U32 nStatus, nBytes, nPayload; |
| 311 | tSirRetStatus nSirStatus; |
| 312 | tANI_U8 *pFrame; |
| 313 | void *pPacket; |
| 314 | eHalStatus halstatus; |
| 315 | tpPESession psessionEntry; |
| 316 | tANI_U8 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 317 | tANI_U8 *p2pIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 318 | tANI_U32 txFlag = 0; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 319 | tANI_U32 chanbond24G = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | |
| 321 | #ifndef GEN4_SCAN |
| 322 | return eSIR_FAILURE; |
| 323 | #endif |
| 324 | |
| 325 | #if defined ( ANI_DVT_DEBUG ) |
| 326 | return eSIR_FAILURE; |
| 327 | #endif |
| 328 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame] | 329 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 330 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 331 | * is false and dot11mode is 11ac set it to 11n. |
| 332 | */ |
| 333 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 334 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 335 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 336 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 337 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | /* |
| 339 | * session context may or may not be present, when probe request needs to be sent out. |
| 340 | * following cases exist: |
| 341 | * --heartbeat failure: session needed |
| 342 | * --join req: session needed |
| 343 | * --foreground scan: no session |
| 344 | * --background scan: no session |
| 345 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 346 | * If session context does not exist, some IEs will be populated from CFGs, |
| 347 | * e.g. Supported and Extended rate set IEs |
| 348 | */ |
| 349 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 350 | |
| 351 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 352 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 353 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 354 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | |
| 356 | // & delegating to assorted helpers: |
| 357 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | if( nAdditionalIELen && pAdditionalIE ) |
| 360 | { |
| 361 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 362 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 363 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 364 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 365 | ( p2pIe != NULL ) && |
| 366 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 367 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 368 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 369 | ( ( psessionEntry != NULL ) && |
| 370 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 371 | ) |
| 372 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 373 | { |
| 374 | /* In the below API pass channel number > 14, do that it fills only |
| 375 | * 11a rates in supported rates */ |
| 376 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 377 | } |
| 378 | else |
| 379 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 381 | &pr.SuppRates,psessionEntry); |
| 382 | |
| 383 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 384 | { |
| 385 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 386 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | |
| 389 | #if defined WLAN_FEATURE_VOWIFI |
| 390 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 391 | //DS params "can" be present in RRM is disabled and "is" present if |
| 392 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 393 | //RRM is not enabled. |
| 394 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 395 | //Call RRM module to get the tx power for management used. |
| 396 | { |
| 397 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 398 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 399 | } |
| 400 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | |
| 402 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 403 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 405 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 407 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 408 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 409 | } else { //psessionEntry == NULL |
| 410 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 411 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 412 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | } |
| 414 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 415 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 416 | /* Get HT40 capability for 2.4GHz band */ |
| 417 | wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G); |
| 418 | if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 419 | { |
| 420 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 421 | pr.HTCaps.shortGI40MHz = 0; |
| 422 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 423 | #ifdef WLAN_FEATURE_11AC |
| 424 | if (psessionEntry != NULL ) { |
| 425 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 426 | //Include HT Capability IE |
| 427 | if (psessionEntry->vhtCapability) |
| 428 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 429 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 430 | } |
| 431 | } else { |
| 432 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 433 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 434 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 435 | } |
| 436 | } |
| 437 | #endif |
| 438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 439 | |
| 440 | // That's it-- now we pack it. First, how much space are we going to |
| 441 | // need? |
| 442 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 443 | if ( DOT11F_FAILED( nStatus ) ) |
| 444 | { |
| 445 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 446 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 447 | // We'll fall back on the worst case scenario: |
| 448 | nPayload = sizeof( tDot11fProbeRequest ); |
| 449 | } |
| 450 | else if ( DOT11F_WARNED( nStatus ) ) |
| 451 | { |
| 452 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 453 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 454 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 458 | |
| 459 | // Ok-- try to allocate some memory: |
| 460 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 461 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 462 | ( void** ) &pPacket ); |
| 463 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 464 | { |
| 465 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 466 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | return eSIR_MEM_ALLOC_FAILED; |
| 468 | } |
| 469 | |
| 470 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 471 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | |
| 473 | // Next, we fill out the buffer descriptor: |
| 474 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 475 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | if ( eSIR_SUCCESS != nSirStatus ) |
| 477 | { |
| 478 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 479 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 480 | nSirStatus ); |
| 481 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 482 | ( void* ) pFrame, ( void* ) pPacket ); |
| 483 | return nSirStatus; // allocated! |
| 484 | } |
| 485 | |
| 486 | // That done, pack the Probe Request: |
| 487 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 488 | sizeof( tSirMacMgmtHdr ), |
| 489 | nPayload, &nPayload ); |
| 490 | if ( DOT11F_FAILED( nStatus ) ) |
| 491 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 492 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | nStatus ); |
| 494 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 495 | return eSIR_FAILURE; // allocated! |
| 496 | } |
| 497 | else if ( DOT11F_WARNED( nStatus ) ) |
| 498 | { |
| 499 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 500 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | // Append any AddIE if present. |
| 504 | if( nAdditionalIELen ) |
| 505 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 506 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 507 | pAdditionalIE, nAdditionalIELen ); |
| 508 | nPayload += nAdditionalIELen; |
| 509 | } |
| 510 | |
| 511 | /* If this probe request is sent during P2P Search State, then we need |
| 512 | * to send it at OFDM rate. |
| 513 | */ |
| 514 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 515 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 516 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 517 | /* For unicast probe req mgmt from Join function |
| 518 | we don't set above variables. So we need to add |
| 519 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 520 | || ( ( psessionEntry != NULL ) && |
| 521 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 522 | ) |
| 523 | { |
| 524 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 525 | } |
| 526 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 527 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 528 | HAL_TXRX_FRM_802_11_MGMT, |
| 529 | ANI_TXDIR_TODS, |
| 530 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 531 | limTxComplete, pFrame, txFlag ); |
| 532 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 533 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 534 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | //Pkt will be freed up by the callback |
| 536 | return eSIR_FAILURE; |
| 537 | } |
| 538 | |
| 539 | return eSIR_SUCCESS; |
| 540 | } // End limSendProbeReqMgmtFrame. |
| 541 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 543 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 544 | tANI_U8 probeReqP2pIe) |
| 545 | { |
| 546 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 547 | from additional IE */ |
| 548 | if(!probeReqP2pIe) |
| 549 | { |
| 550 | tANI_U8* tempbuf = NULL; |
| 551 | tANI_U16 tempLen = 0; |
| 552 | int left = *addnIELen; |
| 553 | v_U8_t *ptr = addIE; |
| 554 | v_U8_t elem_id, elem_len; |
| 555 | |
| 556 | if(NULL == addIE) |
| 557 | { |
| 558 | PELOGE(limLog(pMac, LOGE, |
| 559 | FL(" NULL addIE pointer"));) |
| 560 | return eSIR_FAILURE; |
| 561 | } |
| 562 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 563 | tempbuf = vos_mem_malloc(left); |
| 564 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 565 | { |
| 566 | PELOGE(limLog(pMac, LOGE, |
| 567 | FL("Unable to allocate memory to store addn IE"));) |
| 568 | return eSIR_MEM_ALLOC_FAILED; |
| 569 | } |
| 570 | |
| 571 | while(left >= 2) |
| 572 | { |
| 573 | elem_id = ptr[0]; |
| 574 | elem_len = ptr[1]; |
| 575 | left -= 2; |
| 576 | if(elem_len > left) |
| 577 | { |
| 578 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 579 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 580 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 581 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 582 | return eSIR_FAILURE; |
| 583 | } |
| 584 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 585 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 586 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 587 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 588 | tempLen += (elem_len + 2); |
| 589 | } |
| 590 | left -= elem_len; |
| 591 | ptr += (elem_len + 2); |
| 592 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 593 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 594 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 595 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 596 | } |
| 597 | return eSIR_SUCCESS; |
| 598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 599 | |
| 600 | void |
| 601 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 602 | tSirMacAddr peerMacAddr, |
| 603 | tpAniSSID pSsid, |
| 604 | short nStaId, |
| 605 | tANI_U8 nKeepAlive, |
| 606 | tpPESession psessionEntry, |
| 607 | tANI_U8 probeReqP2pIe) |
| 608 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 609 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 610 | tSirRetStatus nSirStatus; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 611 | tANI_U32 cfg, nPayload, nStatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 612 | tpSirMacMgmtHdr pMacHdr; |
| 613 | tANI_U8 *pFrame; |
| 614 | void *pPacket; |
| 615 | eHalStatus halstatus; |
| 616 | tANI_U32 addnIEPresent; |
| 617 | tANI_U32 addnIE1Len=0; |
| 618 | tANI_U32 addnIE2Len=0; |
| 619 | tANI_U32 addnIE3Len=0; |
| 620 | tANI_U16 totalAddnIeLen = 0; |
| 621 | tANI_U32 wpsApEnable=0, tmp; |
| 622 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 623 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 624 | tANI_U8 *pP2pIe = NULL; |
| 625 | tANI_U8 noaLen = 0; |
| 626 | tANI_U8 total_noaLen = 0; |
| 627 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 628 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 629 | tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 630 | tDot11fIEExtCap extractedExtCap; |
| 631 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 632 | tANI_U32 nBytes = 0; |
| 633 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 634 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 635 | { |
| 636 | return; // in this case. |
| 637 | } |
| 638 | |
| 639 | if(NULL == psessionEntry) |
| 640 | { |
| 641 | return; |
| 642 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 643 | |
| 644 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 645 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 646 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 647 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 648 | return; |
| 649 | } |
| 650 | |
Girish Gowli | 0e82679 | 2014-05-17 17:56:44 +0530 | [diff] [blame] | 651 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 653 | // Fill out 'frm', after which we'll just hand the struct off to |
| 654 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 655 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 656 | |
| 657 | // Timestamp to be updated by TFP, below. |
| 658 | |
| 659 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 661 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 662 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 663 | } |
| 664 | else |
| 665 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 666 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 667 | if (eSIR_SUCCESS != nSirStatus) |
| 668 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 669 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BEACON_INTERVAL from CFG (%d)."), |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 670 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 671 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 672 | return; |
| 673 | } |
| 674 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 676 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 677 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 678 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 679 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 680 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 681 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 682 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 683 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 686 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 687 | { |
| 688 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 689 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 690 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | } |
| 692 | } |
| 693 | else |
| 694 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 695 | if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 696 | limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 697 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 698 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 700 | if (wpsApEnable) |
| 701 | { |
| 702 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 703 | } |
| 704 | |
| 705 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 706 | { |
| 707 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 708 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 709 | } |
| 710 | |
| 711 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 712 | { |
| 713 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 714 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 715 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 718 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 719 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 721 | |
| 722 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 723 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 724 | |
| 725 | |
| 726 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 727 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 728 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 729 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 730 | |
| 731 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 732 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 733 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 734 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 735 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 736 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 737 | #ifdef WLAN_FEATURE_11AC |
| 738 | if(psessionEntry->vhtCapability) |
| 739 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 740 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 741 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
| 742 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 743 | // we do not support multi users yet |
| 744 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 745 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 746 | } |
| 747 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 748 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 749 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 750 | if ( psessionEntry->pLimStartBssReq ) |
| 751 | { |
| 752 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 753 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 754 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 755 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 756 | } |
| 757 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 758 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 759 | |
| 760 | #if defined(FEATURE_WLAN_WAPI) |
| 761 | if( psessionEntry->pLimStartBssReq ) |
| 762 | { |
| 763 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 764 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | } |
| 766 | |
| 767 | #endif // defined(FEATURE_WLAN_WAPI) |
| 768 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 769 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 770 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 771 | { |
| 772 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 773 | } |
| 774 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 775 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 776 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 777 | { |
| 778 | |
| 779 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 780 | &addnIEPresent) != eSIR_SUCCESS) |
| 781 | { |
| 782 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 783 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 784 | return; |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | if (addnIEPresent) |
| 789 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 790 | |
| 791 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 792 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 793 | { |
| 794 | PELOGE(limLog(pMac, LOGE, |
| 795 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 796 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | return; |
| 798 | } |
| 799 | |
| 800 | //Probe rsp IE available |
| 801 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 802 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 803 | { |
| 804 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 805 | vos_mem_free(addIE); |
| 806 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 807 | return; |
| 808 | } |
| 809 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 810 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 811 | { |
| 812 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 813 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 814 | &addnIE1Len) ) |
| 815 | { |
| 816 | limLog(pMac, LOGP, |
| 817 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 818 | vos_mem_free(addIE); |
| 819 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | return; |
| 821 | } |
| 822 | } |
| 823 | |
| 824 | //Probe rsp IE available |
| 825 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 826 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 827 | { |
| 828 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 829 | vos_mem_free(addIE); |
| 830 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | return; |
| 832 | } |
| 833 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 834 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 835 | { |
| 836 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 837 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 838 | &addnIE2Len) ) |
| 839 | { |
| 840 | limLog(pMac, LOGP, |
| 841 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 842 | vos_mem_free(addIE); |
| 843 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | return; |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | //Probe rsp IE available |
| 849 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 850 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 851 | { |
| 852 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 853 | vos_mem_free(addIE); |
| 854 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 855 | return; |
| 856 | } |
| 857 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 858 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 859 | { |
| 860 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 861 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 862 | &addIE[addnIE1Len + addnIE2Len], |
| 863 | &addnIE3Len) ) |
| 864 | { |
| 865 | limLog(pMac, LOGP, |
| 866 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 867 | vos_mem_free(addIE); |
| 868 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 869 | return; |
| 870 | } |
| 871 | } |
| 872 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 874 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 875 | { |
| 876 | limLog(pMac, LOGP, |
| 877 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 878 | vos_mem_free(addIE); |
| 879 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 880 | return; |
| 881 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 882 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 883 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 884 | addIE, |
| 885 | &totalAddnIeLen, |
| 886 | &extractedExtCap ); |
| 887 | if(eSIR_SUCCESS != nSirStatus ) |
| 888 | { |
| 889 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 890 | limLog(pMac, LOG1, |
| 891 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 892 | } |
| 893 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | nBytes = nBytes + totalAddnIeLen; |
| 895 | |
| 896 | if (probeReqP2pIe) |
| 897 | { |
| 898 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 899 | if (pP2pIe != NULL) |
| 900 | { |
| 901 | //get NoA attribute stream P2P IE |
| 902 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 903 | if (noaLen != 0) |
| 904 | { |
| 905 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 906 | &noaStream[0], noaLen); |
| 907 | nBytes = nBytes + total_noaLen; |
| 908 | } |
| 909 | } |
| 910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 911 | } |
| 912 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 913 | /*merge ExtCap IE*/ |
| 914 | if (extractedExtCapFlag && extractedExtCap.present) |
| 915 | { |
| 916 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 917 | } |
| 918 | |
| 919 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 920 | if ( DOT11F_FAILED( nStatus ) ) |
| 921 | { |
| 922 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 923 | "or a Probe Response (0x%08x)."), |
| 924 | nStatus ); |
| 925 | // We'll fall back on the worst case scenario: |
| 926 | nPayload = sizeof( tDot11fProbeResponse ); |
| 927 | } |
| 928 | else if ( DOT11F_WARNED( nStatus ) ) |
| 929 | { |
| 930 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 931 | "the packed size for a Probe Response " |
| 932 | "(0x%08x)."), nStatus ); |
| 933 | } |
| 934 | |
| 935 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 937 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 938 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 939 | ( void** ) &pPacket ); |
| 940 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 941 | { |
| 942 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 943 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 944 | if ( addIE != NULL ) |
| 945 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 946 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 947 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 948 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 949 | return; |
| 950 | } |
| 951 | |
| 952 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 953 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | |
| 955 | // Next, we fill out the buffer descriptor: |
| 956 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 957 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 958 | if ( eSIR_SUCCESS != nSirStatus ) |
| 959 | { |
| 960 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 961 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 962 | nSirStatus ); |
| 963 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 964 | ( void* ) pFrame, ( void* ) pPacket ); |
| 965 | if ( addIE != NULL ) |
| 966 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 967 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 968 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 969 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 970 | return; |
| 971 | } |
| 972 | |
| 973 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 974 | |
| 975 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 976 | |
| 977 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 978 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | nPayload, &nPayload ); |
| 980 | if ( DOT11F_FAILED( nStatus ) ) |
| 981 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 982 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | nStatus ); |
| 984 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 985 | if ( addIE != NULL ) |
| 986 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 987 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 988 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 989 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | return; // allocated! |
| 991 | } |
| 992 | else if ( DOT11F_WARNED( nStatus ) ) |
| 993 | { |
| 994 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 995 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 996 | } |
| 997 | |
| 998 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 999 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1000 | |
| 1001 | pMac->sys.probeRespond++; |
| 1002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1003 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1004 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1005 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1006 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1007 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1008 | |
| 1009 | if ( addnIEPresent ) |
| 1010 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1011 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1013 | if (noaLen != 0) |
| 1014 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1015 | if (total_noaLen > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1016 | { |
| 1017 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1018 | FL("Not able to insert NoA because of length constraint." |
| 1019 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1020 | vos_mem_free(addIE); |
| 1021 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1022 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1023 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1024 | return; |
| 1025 | } |
| 1026 | else |
| 1027 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1028 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1029 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | } |
| 1031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | |
| 1033 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1035 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | ) |
| 1037 | { |
| 1038 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1039 | } |
| 1040 | |
| 1041 | // Queue Probe Response frame in high priority WQ |
| 1042 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1043 | ( tANI_U16 ) nBytes, |
| 1044 | HAL_TXRX_FRM_802_11_MGMT, |
| 1045 | ANI_TXDIR_TODS, |
| 1046 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1047 | limTxComplete, pFrame, txFlag ); |
| 1048 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1049 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1050 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | //Pkt will be freed up by the callback |
| 1052 | } |
| 1053 | |
| 1054 | if ( addIE != NULL ) |
| 1055 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1056 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1057 | } |
| 1058 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1059 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1060 | return; |
| 1061 | |
| 1062 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | } // End limSendProbeRspMgmtFrame. |
| 1064 | |
| 1065 | void |
| 1066 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1067 | tSirMacAddr peerMacAddr, |
| 1068 | tSirAddtsReqInfo *pAddTS, |
| 1069 | tpPESession psessionEntry) |
| 1070 | { |
| 1071 | tANI_U16 i; |
| 1072 | tANI_U8 *pFrame; |
| 1073 | tSirRetStatus nSirStatus; |
| 1074 | tDot11fAddTSRequest AddTSReq; |
| 1075 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1076 | tANI_U32 nPayload, nBytes, nStatus; |
| 1077 | tpSirMacMgmtHdr pMacHdr; |
| 1078 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1079 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1080 | tANI_U32 phyMode; |
| 1081 | #endif |
| 1082 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1083 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1084 | |
| 1085 | if(NULL == psessionEntry) |
| 1086 | { |
| 1087 | return; |
| 1088 | } |
| 1089 | |
| 1090 | if ( ! pAddTS->wmeTspecPresent ) |
| 1091 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1092 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1093 | |
| 1094 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1095 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1096 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1097 | if ( pAddTS->lleTspecPresent ) |
| 1098 | { |
| 1099 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1100 | } |
| 1101 | else |
| 1102 | { |
| 1103 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1104 | } |
| 1105 | |
| 1106 | if ( pAddTS->lleTspecPresent ) |
| 1107 | { |
| 1108 | AddTSReq.num_WMMTCLAS = 0; |
| 1109 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1110 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1111 | { |
| 1112 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1113 | &AddTSReq.TCLAS[i] ); |
| 1114 | } |
| 1115 | } |
| 1116 | else |
| 1117 | { |
| 1118 | AddTSReq.num_TCLAS = 0; |
| 1119 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1120 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1121 | { |
| 1122 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1123 | &AddTSReq.WMMTCLAS[i] ); |
| 1124 | } |
| 1125 | } |
| 1126 | |
| 1127 | if ( pAddTS->tclasProcPresent ) |
| 1128 | { |
| 1129 | if ( pAddTS->lleTspecPresent ) |
| 1130 | { |
| 1131 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1132 | AddTSReq.TCLASSPROC.present = 1; |
| 1133 | } |
| 1134 | else |
| 1135 | { |
| 1136 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1137 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1138 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1139 | } |
| 1140 | } |
| 1141 | |
| 1142 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1143 | if ( DOT11F_FAILED( nStatus ) ) |
| 1144 | { |
| 1145 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1146 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1147 | nStatus ); |
| 1148 | // We'll fall back on the worst case scenario: |
| 1149 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1150 | } |
| 1151 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1152 | { |
| 1153 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1154 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1155 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1156 | } |
| 1157 | } |
| 1158 | else |
| 1159 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1160 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1161 | |
| 1162 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1163 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1164 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1165 | |
| 1166 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1167 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1168 | |
| 1169 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1170 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1171 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1172 | |
| 1173 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1174 | { |
| 1175 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1176 | } |
| 1177 | else |
| 1178 | { |
| 1179 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1180 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1181 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | #endif |
| 1183 | // fillWmeTspecIE |
| 1184 | |
| 1185 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1186 | if ( DOT11F_FAILED( nStatus ) ) |
| 1187 | { |
| 1188 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1189 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1190 | nStatus ); |
| 1191 | // We'll fall back on the worst case scenario: |
| 1192 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1193 | } |
| 1194 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1195 | { |
| 1196 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1197 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1198 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1199 | } |
| 1200 | } |
| 1201 | |
| 1202 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1203 | |
| 1204 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1205 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1206 | ( void** ) &pPacket ); |
| 1207 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1208 | { |
| 1209 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1210 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1211 | return; |
| 1212 | } |
| 1213 | |
| 1214 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1215 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1216 | |
| 1217 | // Next, we fill out the buffer descriptor: |
| 1218 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1219 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1220 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1221 | { |
| 1222 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1223 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1224 | nSirStatus ); |
| 1225 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1226 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1227 | return; |
| 1228 | } |
| 1229 | |
| 1230 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1231 | |
| 1232 | #if 0 |
| 1233 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1234 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1235 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1236 | { |
| 1237 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1238 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1240 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1241 | return; |
| 1242 | } |
| 1243 | #endif //TO SUPPORT BT-AMP |
| 1244 | |
| 1245 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1246 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1247 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1248 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1249 | #endif |
| 1250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1251 | // That done, pack the struct: |
| 1252 | if ( ! pAddTS->wmeTspecPresent ) |
| 1253 | { |
| 1254 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1255 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1256 | nPayload, &nPayload ); |
| 1257 | if ( DOT11F_FAILED( nStatus ) ) |
| 1258 | { |
| 1259 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1260 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1261 | nStatus ); |
| 1262 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1263 | return; // allocated! |
| 1264 | } |
| 1265 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1266 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1267 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1268 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1269 | } |
| 1270 | } |
| 1271 | else |
| 1272 | { |
| 1273 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1274 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1275 | nPayload, &nPayload ); |
| 1276 | if ( DOT11F_FAILED( nStatus ) ) |
| 1277 | { |
| 1278 | limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1279 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | nStatus ); |
| 1281 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1282 | return; // allocated! |
| 1283 | } |
| 1284 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1285 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1286 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1287 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") ); |
| 1292 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1293 | |
| 1294 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1295 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1296 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1297 | ) |
| 1298 | { |
| 1299 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1300 | } |
| 1301 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1302 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1303 | psessionEntry->peSessionId, |
| 1304 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1305 | // Queue Addts Response frame in high priority WQ |
| 1306 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1307 | HAL_TXRX_FRM_802_11_MGMT, |
| 1308 | ANI_TXDIR_TODS, |
| 1309 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1310 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1311 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1312 | psessionEntry->peSessionId, |
| 1313 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1314 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1315 | { |
| 1316 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1317 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1318 | //Pkt will be freed up by the callback |
| 1319 | } |
| 1320 | |
| 1321 | } // End limSendAddtsReqActionFrame. |
| 1322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | |
| 1324 | |
| 1325 | void |
| 1326 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1327 | tANI_U16 statusCode, |
| 1328 | tANI_U16 aid, |
| 1329 | tSirMacAddr peerMacAddr, |
| 1330 | tANI_U8 subType, |
| 1331 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1332 | { |
| 1333 | static tDot11fAssocResponse frm; |
| 1334 | tANI_U8 *pFrame, *macAddr; |
| 1335 | tpSirMacMgmtHdr pMacHdr; |
| 1336 | tSirRetStatus nSirStatus; |
| 1337 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1338 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1339 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1340 | void *pPacket; |
| 1341 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1342 | tUpdateBeaconParams beaconParams; |
| 1343 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1344 | tANI_U32 addnIEPresent = false; |
| 1345 | tANI_U32 addnIELen=0; |
| 1346 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1347 | tpSirAssocReq pAssocReq = NULL; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1348 | tANI_U16 addStripoffIELen = 0; |
| 1349 | tDot11fIEExtCap extractedExtCap; |
| 1350 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1351 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1352 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1353 | #ifdef WLAN_FEATURE_11W |
| 1354 | tANI_U32 retryInterval; |
| 1355 | tANI_U32 maxRetries; |
| 1356 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1357 | |
| 1358 | if(NULL == psessionEntry) |
| 1359 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1360 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1361 | return; |
| 1362 | } |
| 1363 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1364 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1365 | |
| 1366 | limGetQosMode(psessionEntry, &qosMode); |
| 1367 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1368 | |
| 1369 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1370 | // STA sent a traffic spec. |
| 1371 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1372 | |
| 1373 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1374 | |
| 1375 | frm.Status.status = statusCode; |
| 1376 | |
| 1377 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1378 | |
| 1379 | if ( NULL == pSta ) |
| 1380 | { |
| 1381 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1382 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1383 | } |
| 1384 | else |
| 1385 | { |
| 1386 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1387 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1388 | } |
| 1389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1390 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1391 | { |
| 1392 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1393 | { |
| 1394 | pAssocReq = |
| 1395 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1397 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1398 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1399 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1400 | } |
| 1401 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1402 | |
| 1403 | if ( NULL != pSta ) |
| 1404 | { |
| 1405 | if ( eHAL_SET == qosMode ) |
| 1406 | { |
| 1407 | if ( pSta->lleEnabled ) |
| 1408 | { |
| 1409 | lleMode = 1; |
| 1410 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1411 | { |
| 1412 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1413 | |
| 1414 | // FramesToDo:... |
| 1415 | // if ( fAddTS ) |
| 1416 | // { |
| 1417 | // tANI_U8 *pAf = pBody; |
| 1418 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1419 | // tANI_U32 tlen; |
| 1420 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1421 | // &tlen, bufLen - frameLen); |
| 1422 | // } // End if on Add TS. |
| 1423 | } |
| 1424 | } // End if on .11e enabled in 'pSta'. |
| 1425 | } // End if on QOS Mode on. |
| 1426 | |
| 1427 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1428 | { |
| 1429 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1430 | { |
| 1431 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1432 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1433 | |
| 1434 | if ( pSta->wsmEnabled ) |
| 1435 | { |
| 1436 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1437 | } |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | if ( pSta->aniPeer ) |
| 1442 | { |
| 1443 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1444 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1445 | { |
| 1446 | edcaInclude = 1; |
| 1447 | } |
| 1448 | |
| 1449 | } // End if on Airgo peer. |
| 1450 | |
| 1451 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1452 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1453 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1454 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1456 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1457 | |
| 1458 | #ifdef WLAN_FEATURE_11AC |
| 1459 | if( pSta->mlmStaContext.vhtCapability && |
| 1460 | psessionEntry->vhtCapability ) |
| 1461 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1462 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1463 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
| 1464 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1465 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1466 | } |
| 1467 | #endif |
| 1468 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1469 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1470 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1471 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1472 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1473 | &maxRetries ) != eSIR_SUCCESS ) |
| 1474 | limLog( pMac, LOGE, |
| 1475 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1476 | else |
| 1477 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1478 | &retryInterval ) != eSIR_SUCCESS) |
| 1479 | limLog( pMac, LOGE, |
| 1480 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1481 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1482 | PopulateDot11fTimeoutInterval( |
| 1483 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1484 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1485 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1486 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1487 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1488 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1489 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1491 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1492 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1493 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1495 | |
| 1496 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1497 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1498 | |
| 1499 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1500 | |
| 1501 | //Send message to HAL about beacon parameter change. |
| 1502 | if(beaconParams.paramChangeBitmap) |
| 1503 | { |
| 1504 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1505 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1506 | } |
| 1507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1508 | if ( pAssocReq != NULL ) |
| 1509 | { |
| 1510 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1511 | &addnIEPresent) != eSIR_SUCCESS) |
| 1512 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1513 | limLog(pMac, LOGP, FL("Unable to get " |
| 1514 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1515 | return; |
| 1516 | } |
| 1517 | |
| 1518 | if (addnIEPresent) |
| 1519 | { |
| 1520 | //Assoc rsp IE available |
| 1521 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1522 | &addnIELen) != eSIR_SUCCESS) |
| 1523 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1524 | limLog(pMac, LOGP, FL("Unable to get " |
| 1525 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1526 | return; |
| 1527 | } |
| 1528 | |
| 1529 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1530 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1531 | { |
| 1532 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1533 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1534 | { |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1535 | |
| 1536 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1537 | sizeof( tDot11fIEExtCap ), 0); |
| 1538 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1539 | &addIE[0], |
| 1540 | &addStripoffIELen, |
| 1541 | &extractedExtCap ); |
| 1542 | if(eSIR_SUCCESS != nSirStatus) |
| 1543 | { |
| 1544 | limLog(pMac, LOG1, |
| 1545 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1546 | } |
| 1547 | else |
| 1548 | { |
| 1549 | addnIELen = addStripoffIELen; |
| 1550 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1551 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1552 | nBytes = nBytes + addnIELen; |
| 1553 | } |
| 1554 | } |
| 1555 | } |
| 1556 | } |
| 1557 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1558 | /* merge the ExtCap struct*/ |
| 1559 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1560 | { |
| 1561 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap); |
| 1562 | } |
| 1563 | |
| 1564 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1565 | if ( DOT11F_FAILED( nStatus ) ) |
| 1566 | { |
| 1567 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1568 | "or an Association Response (0x%08x)."), |
| 1569 | nStatus ); |
| 1570 | return; |
| 1571 | } |
| 1572 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1573 | { |
| 1574 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1575 | "the packed size for an Association Re" |
| 1576 | "sponse (0x%08x)."), nStatus ); |
| 1577 | } |
| 1578 | |
| 1579 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1580 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1581 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1582 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1583 | ( void** ) &pPacket ); |
| 1584 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1585 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1586 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1587 | return; |
| 1588 | } |
| 1589 | |
| 1590 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1591 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1592 | |
| 1593 | // Next, we fill out the buffer descriptor: |
| 1594 | nSirStatus = limPopulateMacHeader( pMac, |
| 1595 | pFrame, |
| 1596 | SIR_MAC_MGMT_FRAME, |
| 1597 | ( LIM_ASSOC == subType ) ? |
| 1598 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1599 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1600 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1601 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1602 | { |
| 1603 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1604 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1605 | nSirStatus ); |
| 1606 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1607 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1608 | return; |
| 1609 | } |
| 1610 | |
| 1611 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1612 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1613 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1614 | |
| 1615 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1616 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1617 | nPayload, &nPayload ); |
| 1618 | if ( DOT11F_FAILED( nStatus ) ) |
| 1619 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1620 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1621 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1622 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1623 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1624 | return; // allocated! |
| 1625 | } |
| 1626 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1627 | { |
| 1628 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1629 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1630 | } |
| 1631 | |
| 1632 | macAddr = pMacHdr->da; |
| 1633 | |
| 1634 | if (subType == LIM_ASSOC) |
| 1635 | { |
| 1636 | PELOG1(limLog(pMac, LOG1, |
| 1637 | FL("*** Sending Assoc Resp status %d aid %d to "), |
| 1638 | statusCode, aid);) |
| 1639 | } |
| 1640 | else{ |
| 1641 | PELOG1(limLog(pMac, LOG1, |
| 1642 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
| 1643 | statusCode, aid);) |
| 1644 | } |
| 1645 | PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1646 | |
| 1647 | if ( addnIEPresent ) |
| 1648 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1649 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1650 | } |
| 1651 | |
| 1652 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1653 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1654 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1655 | ) |
| 1656 | { |
| 1657 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1658 | } |
| 1659 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1660 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1661 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1662 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1663 | |
| 1664 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1665 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1666 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1667 | psessionEntry->peSessionId, |
| 1668 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | /// Queue Association Response frame in high priority WQ |
| 1670 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1671 | HAL_TXRX_FRM_802_11_MGMT, |
| 1672 | ANI_TXDIR_TODS, |
| 1673 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1674 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1675 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1676 | psessionEntry->peSessionId, |
| 1677 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1678 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1679 | { |
| 1680 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1681 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1682 | nSirStatus); |
| 1683 | |
| 1684 | //Pkt will be freed up by the callback |
| 1685 | } |
| 1686 | |
| 1687 | // update the ANI peer station count |
| 1688 | //FIXME_PROTECTION : take care of different type of station |
| 1689 | // counter inside this function. |
| 1690 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1691 | |
| 1692 | } // End limSendAssocRspMgmtFrame. |
| 1693 | |
| 1694 | |
| 1695 | |
| 1696 | void |
| 1697 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1698 | tSirMacAddr peer, |
| 1699 | tANI_U16 nStatusCode, |
| 1700 | tSirAddtsReqInfo *pAddTS, |
| 1701 | tSirMacScheduleIE *pSchedule, |
| 1702 | tpPESession psessionEntry) |
| 1703 | { |
| 1704 | tANI_U8 *pFrame; |
| 1705 | tpSirMacMgmtHdr pMacHdr; |
| 1706 | tDot11fAddTSResponse AddTSRsp; |
| 1707 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1708 | tSirRetStatus nSirStatus; |
| 1709 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1710 | void *pPacket; |
| 1711 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1712 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1713 | |
| 1714 | if(NULL == psessionEntry) |
| 1715 | { |
| 1716 | return; |
| 1717 | } |
| 1718 | |
| 1719 | if ( ! pAddTS->wmeTspecPresent ) |
| 1720 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1721 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | |
| 1723 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1724 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1725 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1726 | AddTSRsp.Status.status = nStatusCode; |
| 1727 | |
| 1728 | // The TsDelay information element is only filled in for a specific |
| 1729 | // status code: |
| 1730 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1731 | { |
| 1732 | if ( pAddTS->wsmTspecPresent ) |
| 1733 | { |
| 1734 | AddTSRsp.WMMTSDelay.version = 1; |
| 1735 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1736 | AddTSRsp.WMMTSDelay.present = 1; |
| 1737 | } |
| 1738 | else |
| 1739 | { |
| 1740 | AddTSRsp.TSDelay.delay = 10; |
| 1741 | AddTSRsp.TSDelay.present = 1; |
| 1742 | } |
| 1743 | } |
| 1744 | |
| 1745 | if ( pAddTS->wsmTspecPresent ) |
| 1746 | { |
| 1747 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1748 | } |
| 1749 | else |
| 1750 | { |
| 1751 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1752 | } |
| 1753 | |
| 1754 | if ( pAddTS->wsmTspecPresent ) |
| 1755 | { |
| 1756 | AddTSRsp.num_WMMTCLAS = 0; |
| 1757 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1758 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1759 | { |
| 1760 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1761 | &AddTSRsp.TCLAS[i] ); |
| 1762 | } |
| 1763 | } |
| 1764 | else |
| 1765 | { |
| 1766 | AddTSRsp.num_TCLAS = 0; |
| 1767 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1768 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1769 | { |
| 1770 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1771 | &AddTSRsp.WMMTCLAS[i] ); |
| 1772 | } |
| 1773 | } |
| 1774 | |
| 1775 | if ( pAddTS->tclasProcPresent ) |
| 1776 | { |
| 1777 | if ( pAddTS->wsmTspecPresent ) |
| 1778 | { |
| 1779 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1780 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1781 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1782 | } |
| 1783 | else |
| 1784 | { |
| 1785 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1786 | AddTSRsp.TCLASSPROC.present = 1; |
| 1787 | } |
| 1788 | } |
| 1789 | |
| 1790 | // schedule element is included only if requested in the tspec and we are |
| 1791 | // using hcca (or both edca and hcca) |
| 1792 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1793 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1794 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1795 | // sta figure it out |
| 1796 | if ((pSchedule != NULL) && |
| 1797 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1798 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1799 | { |
| 1800 | if ( pAddTS->wsmTspecPresent ) |
| 1801 | { |
| 1802 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1803 | } |
| 1804 | else |
| 1805 | { |
| 1806 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1807 | } |
| 1808 | } |
| 1809 | |
| 1810 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1811 | if ( DOT11F_FAILED( nStatus ) ) |
| 1812 | { |
| 1813 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1814 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1815 | nStatus ); |
| 1816 | // We'll fall back on the worst case scenario: |
| 1817 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1818 | } |
| 1819 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1820 | { |
| 1821 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1822 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1823 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1824 | } |
| 1825 | } |
| 1826 | else |
| 1827 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1828 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1829 | |
| 1830 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1831 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1832 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1833 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1834 | |
| 1835 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1836 | |
| 1837 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1838 | if ( DOT11F_FAILED( nStatus ) ) |
| 1839 | { |
| 1840 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1841 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1842 | nStatus ); |
| 1843 | // We'll fall back on the worst case scenario: |
| 1844 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1845 | } |
| 1846 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1847 | { |
| 1848 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1849 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1850 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1851 | } |
| 1852 | } |
| 1853 | |
| 1854 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1855 | |
| 1856 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1857 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1858 | { |
| 1859 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1860 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | return; |
| 1862 | } |
| 1863 | |
| 1864 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1865 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | |
| 1867 | // Next, we fill out the buffer descriptor: |
| 1868 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1869 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1870 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1871 | { |
| 1872 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1873 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1874 | nSirStatus ); |
| 1875 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1876 | return; // allocated! |
| 1877 | } |
| 1878 | |
| 1879 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1880 | |
| 1881 | |
| 1882 | #if 0 |
| 1883 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1884 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1885 | { |
| 1886 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1887 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1888 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1889 | return; // allocated! |
| 1890 | } |
| 1891 | #endif //TO SUPPORT BT-AMP |
| 1892 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1893 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1894 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1895 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1896 | #endif |
| 1897 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1898 | // That done, pack the struct: |
| 1899 | if ( ! pAddTS->wmeTspecPresent ) |
| 1900 | { |
| 1901 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1902 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1903 | nPayload, &nPayload ); |
| 1904 | if ( DOT11F_FAILED( nStatus ) ) |
| 1905 | { |
| 1906 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1907 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1908 | nStatus ); |
| 1909 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1910 | return; |
| 1911 | } |
| 1912 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1913 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1914 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1915 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1916 | } |
| 1917 | } |
| 1918 | else |
| 1919 | { |
| 1920 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1921 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1922 | nPayload, &nPayload ); |
| 1923 | if ( DOT11F_FAILED( nStatus ) ) |
| 1924 | { |
| 1925 | limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1926 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1927 | nStatus ); |
| 1928 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1929 | return; |
| 1930 | } |
| 1931 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1932 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1933 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1934 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1935 | } |
| 1936 | } |
| 1937 | |
| 1938 | PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
| 1939 | nStatusCode ); |
| 1940 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 1941 | |
| 1942 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1944 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1945 | ) |
| 1946 | { |
| 1947 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1948 | } |
| 1949 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1950 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1951 | psessionEntry->peSessionId, |
| 1952 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1953 | // Queue the frame in high priority WQ: |
| 1954 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1955 | HAL_TXRX_FRM_802_11_MGMT, |
| 1956 | ANI_TXDIR_TODS, |
| 1957 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1958 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1959 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1960 | psessionEntry->peSessionId, |
| 1961 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1962 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1963 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1964 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | nSirStatus ); |
| 1966 | //Pkt will be freed up by the callback |
| 1967 | } |
| 1968 | |
| 1969 | } // End limSendAddtsRspActionFrame. |
| 1970 | |
| 1971 | void |
| 1972 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 1973 | tSirMacAddr peer, |
| 1974 | tANI_U8 wmmTspecPresent, |
| 1975 | tSirMacTSInfo *pTsinfo, |
| 1976 | tSirMacTspecIE *pTspecIe, |
| 1977 | tpPESession psessionEntry) |
| 1978 | { |
| 1979 | tANI_U8 *pFrame; |
| 1980 | tpSirMacMgmtHdr pMacHdr; |
| 1981 | tDot11fDelTS DelTS; |
| 1982 | tDot11fWMMDelTS WMMDelTS; |
| 1983 | tSirRetStatus nSirStatus; |
| 1984 | tANI_U32 nBytes, nPayload, nStatus; |
| 1985 | void *pPacket; |
| 1986 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1987 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1988 | |
| 1989 | if(NULL == psessionEntry) |
| 1990 | { |
| 1991 | return; |
| 1992 | } |
| 1993 | |
| 1994 | if ( ! wmmTspecPresent ) |
| 1995 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1996 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1997 | |
| 1998 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1999 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2000 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2001 | |
| 2002 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2003 | if ( DOT11F_FAILED( nStatus ) ) |
| 2004 | { |
| 2005 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2006 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | nStatus ); |
| 2008 | // We'll fall back on the worst case scenario: |
| 2009 | nPayload = sizeof( tDot11fDelTS ); |
| 2010 | } |
| 2011 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2012 | { |
| 2013 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2014 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2015 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2016 | } |
| 2017 | } |
| 2018 | else |
| 2019 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2020 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | |
| 2022 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2023 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2024 | WMMDelTS.DialogToken.token = 0; |
| 2025 | WMMDelTS.StatusCode.statusCode = 0; |
| 2026 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2027 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2028 | if ( DOT11F_FAILED( nStatus ) ) |
| 2029 | { |
| 2030 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2031 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2032 | nStatus ); |
| 2033 | // We'll fall back on the worst case scenario: |
| 2034 | nPayload = sizeof( tDot11fDelTS ); |
| 2035 | } |
| 2036 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2037 | { |
| 2038 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2039 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2040 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2041 | } |
| 2042 | } |
| 2043 | |
| 2044 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2045 | |
| 2046 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2047 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2048 | { |
| 2049 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2050 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2051 | return; |
| 2052 | } |
| 2053 | |
| 2054 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2055 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2056 | |
| 2057 | // Next, we fill out the buffer descriptor: |
| 2058 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2059 | SIR_MAC_MGMT_ACTION, peer, |
| 2060 | psessionEntry->selfMacAddr); |
| 2061 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2062 | { |
| 2063 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2064 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2065 | nSirStatus ); |
| 2066 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2067 | return; // allocated! |
| 2068 | } |
| 2069 | |
| 2070 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2071 | |
| 2072 | #if 0 |
| 2073 | |
| 2074 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2075 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2076 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2077 | { |
| 2078 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2079 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2080 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2081 | return; // allocated! |
| 2082 | } |
| 2083 | #endif //TO SUPPORT BT-AMP |
| 2084 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2085 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2086 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2087 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2088 | #endif |
| 2089 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2090 | // That done, pack the struct: |
| 2091 | if ( !wmmTspecPresent ) |
| 2092 | { |
| 2093 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2094 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2095 | nPayload, &nPayload ); |
| 2096 | if ( DOT11F_FAILED( nStatus ) ) |
| 2097 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2098 | limLog( pMac, LOGE, FL("Failed to pack a Del TS frame (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | nStatus ); |
| 2100 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2101 | return; // allocated! |
| 2102 | } |
| 2103 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2104 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2105 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2106 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2107 | } |
| 2108 | } |
| 2109 | else |
| 2110 | { |
| 2111 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2112 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2113 | nPayload, &nPayload ); |
| 2114 | if ( DOT11F_FAILED( nStatus ) ) |
| 2115 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2116 | limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2117 | nStatus ); |
| 2118 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2119 | return; // allocated! |
| 2120 | } |
| 2121 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2122 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2123 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2124 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2125 | } |
| 2126 | } |
| 2127 | |
| 2128 | PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2129 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 2130 | |
| 2131 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2132 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2133 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2134 | ) |
| 2135 | { |
| 2136 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2137 | } |
| 2138 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2139 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2140 | psessionEntry->peSessionId, |
| 2141 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2142 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2143 | HAL_TXRX_FRM_802_11_MGMT, |
| 2144 | ANI_TXDIR_TODS, |
| 2145 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2146 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2147 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2148 | psessionEntry->peSessionId, |
| 2149 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2150 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2151 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2152 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2153 | nSirStatus ); |
| 2154 | //Pkt will be freed up by the callback |
| 2155 | } |
| 2156 | |
| 2157 | } // End limSendDeltsReqActionFrame. |
| 2158 | |
| 2159 | void |
| 2160 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2161 | tLimMlmAssocReq *pMlmAssocReq, |
| 2162 | tpPESession psessionEntry) |
| 2163 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2164 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2165 | tANI_U16 caps; |
| 2166 | tANI_U8 *pFrame; |
| 2167 | tSirRetStatus nSirStatus; |
| 2168 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2169 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2170 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2171 | void *pPacket; |
| 2172 | eHalStatus halstatus; |
| 2173 | tANI_U16 nAddIELen; |
| 2174 | tANI_U8 *pAddIE; |
| 2175 | tANI_U8 *wpsIe = NULL; |
| 2176 | #if defined WLAN_FEATURE_VOWIFI |
| 2177 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2178 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2179 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2180 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2181 | tDot11fIEExtCap extractedExtCap; |
| 2182 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2183 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2184 | |
| 2185 | if(NULL == psessionEntry) |
| 2186 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2187 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | return; |
| 2189 | } |
| 2190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2191 | /* check this early to avoid unncessary operation */ |
| 2192 | if(NULL == psessionEntry->pLimJoinReq) |
| 2193 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2194 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2195 | return; |
| 2196 | } |
| 2197 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2198 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2199 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2200 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2201 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2202 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2203 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2204 | return; |
| 2205 | } |
| 2206 | |
| 2207 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2208 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2210 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 2211 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
| 2212 | &nAddIELen, |
| 2213 | &extractedExtCap ); |
| 2214 | if(eSIR_SUCCESS != nSirStatus ) |
| 2215 | { |
| 2216 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2217 | limLog(pMac, LOG1, |
| 2218 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2219 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2220 | /* TODO:remove this code once driver provides the call back function |
| 2221 | * to supplicant for set_qos_map |
| 2222 | */ |
| 2223 | else |
| 2224 | { |
| 2225 | if(extractedExtCap.interworkingService) |
| 2226 | { |
| 2227 | extractedExtCap.qosMap = 1; |
| 2228 | } |
| 2229 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2231 | caps = pMlmAssocReq->capabilityInfo; |
| 2232 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2233 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2234 | #if defined(FEATURE_WLAN_WAPI) |
| 2235 | /* CR: 262463 : |
| 2236 | According to WAPI standard: |
| 2237 | 7.3.1.4 Capability Information field |
| 2238 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2239 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2240 | Reassociation management frames. */ |
| 2241 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2242 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2243 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2244 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2245 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2246 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2247 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2249 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2250 | |
| 2251 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2252 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2253 | |
| 2254 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2255 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2256 | |
| 2257 | // We prefer .11e asociations: |
| 2258 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2259 | |
| 2260 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2261 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2262 | |
| 2263 | if ( psessionEntry->lim11hEnable && |
| 2264 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2265 | { |
| 2266 | #if defined WLAN_FEATURE_VOWIFI |
| 2267 | PowerCapsPopulated = TRUE; |
| 2268 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2269 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2270 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2271 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | |
| 2273 | } |
| 2274 | |
| 2275 | #if defined WLAN_FEATURE_VOWIFI |
| 2276 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2277 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2278 | { |
| 2279 | if (PowerCapsPopulated == FALSE) |
| 2280 | { |
| 2281 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2282 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2283 | } |
| 2284 | } |
| 2285 | #endif |
| 2286 | |
| 2287 | if ( fQosEnabled && |
| 2288 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2289 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2290 | |
| 2291 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2292 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2293 | |
| 2294 | #if defined WLAN_FEATURE_VOWIFI |
| 2295 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2296 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2297 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2298 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2299 | } |
| 2300 | #endif |
| 2301 | // The join request *should* contain zero or one of the WPA and RSN |
| 2302 | // IEs. The payload send along with the request is a |
| 2303 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2304 | |
| 2305 | // typedef struct sSirRSNie |
| 2306 | // { |
| 2307 | // tANI_U16 length; |
| 2308 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2309 | // } tSirRSNie, *tpSirRSNie; |
| 2310 | |
| 2311 | // So, we should be able to make the following two calls harmlessly, |
| 2312 | // since they do nothing if they don't find the given IE in the |
| 2313 | // bytestream with which they're provided. |
| 2314 | |
| 2315 | // The net effect of this will be to faithfully transmit whatever |
| 2316 | // security IE is in the join request. |
| 2317 | |
| 2318 | // *However*, if we're associating for the purpose of WPS |
| 2319 | // enrollment, and we've been configured to indicate that by |
| 2320 | // eliding the WPA or RSN IE, we just skip this: |
| 2321 | if( nAddIELen && pAddIE ) |
| 2322 | { |
| 2323 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2324 | } |
| 2325 | if ( NULL == wpsIe ) |
| 2326 | { |
| 2327 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2328 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2329 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2330 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2331 | #if defined(FEATURE_WLAN_WAPI) |
| 2332 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2333 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2335 | } |
| 2336 | |
| 2337 | // include WME EDCA IE as well |
| 2338 | if ( fWmeEnabled ) |
| 2339 | { |
| 2340 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2341 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2342 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2343 | } |
| 2344 | |
| 2345 | if ( fWsmEnabled && |
| 2346 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2347 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2348 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2349 | } |
| 2350 | } |
| 2351 | |
| 2352 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2353 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2354 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2355 | pMac->lim.htCapabilityPresentInBeacon) |
| 2356 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2357 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2358 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2359 | |
| 2360 | /* |
| 2361 | * To resolve the interop problem with Broadcom AP, |
| 2362 | * where TQ STA could not pass traffic with GF enabled, |
| 2363 | * TQ STA will do Greenfield only with TQ AP, for |
| 2364 | * everybody else it will be turned off. |
| 2365 | */ |
| 2366 | |
| 2367 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2368 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2369 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2370 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2371 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2372 | } |
| 2373 | #endif |
| 2374 | |
| 2375 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2376 | #ifdef WLAN_FEATURE_11AC |
| 2377 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2378 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2379 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2380 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2381 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2382 | } |
| 2383 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2384 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2385 | |
| 2386 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2387 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2388 | { |
| 2389 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2390 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2391 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2392 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2393 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2394 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2395 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2396 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2397 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2398 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2399 | { |
| 2400 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2401 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2402 | } |
| 2403 | #endif |
| 2404 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2405 | #ifdef FEATURE_WLAN_ESE |
| 2406 | /* For ESE Associations fill the ESE IEs */ |
| 2407 | if (psessionEntry->isESEconnection && |
| 2408 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2409 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2410 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2411 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2412 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2413 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2414 | } |
| 2415 | #endif |
| 2416 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2417 | /* merge the ExtCap struct*/ |
| 2418 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2419 | { |
| 2420 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 2421 | } |
| 2422 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2423 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2424 | if ( DOT11F_FAILED( nStatus ) ) |
| 2425 | { |
| 2426 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2427 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2428 | nStatus ); |
| 2429 | // We'll fall back on the worst case scenario: |
| 2430 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2431 | } |
| 2432 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2433 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2434 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2435 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2436 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2437 | } |
| 2438 | |
| 2439 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2440 | |
| 2441 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2442 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2443 | ( void** ) &pPacket ); |
| 2444 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2445 | { |
| 2446 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2447 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2448 | |
| 2449 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2450 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2451 | |
| 2452 | |
| 2453 | /* Update PE session id*/ |
| 2454 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2455 | |
| 2456 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2457 | |
| 2458 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2459 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2460 | |
| 2461 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2462 | ( tANI_U32* ) &mlmAssocCnf); |
| 2463 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2464 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | return; |
| 2466 | } |
| 2467 | |
| 2468 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2469 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2470 | |
| 2471 | // Next, we fill out the buffer descriptor: |
| 2472 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2473 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2474 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2475 | { |
| 2476 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2477 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2478 | nSirStatus ); |
| 2479 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2480 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2481 | return; |
| 2482 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2483 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2484 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2485 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | sizeof(tSirMacMgmtHdr), |
| 2487 | nPayload, &nPayload ); |
| 2488 | if ( DOT11F_FAILED( nStatus ) ) |
| 2489 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2490 | limLog( pMac, LOGE, FL("Failed to pack a Assoc Request (0x%0" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2491 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2492 | nStatus ); |
| 2493 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2494 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2495 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2496 | return; |
| 2497 | } |
| 2498 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2499 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2500 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2501 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2502 | } |
| 2503 | |
| 2504 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2505 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2506 | nBytes );) |
| 2507 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2508 | |
| 2509 | if( psessionEntry->assocReq != NULL ) |
| 2510 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2511 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | psessionEntry->assocReq = NULL; |
| 2513 | } |
| 2514 | |
| 2515 | if( nAddIELen ) |
| 2516 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2517 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2518 | pAddIE, |
| 2519 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2520 | nPayload += nAddIELen; |
| 2521 | } |
| 2522 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2523 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2524 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2525 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2526 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2527 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2528 | } |
| 2529 | else |
| 2530 | { |
| 2531 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2532 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2533 | psessionEntry->assocReqLen = nPayload; |
| 2534 | } |
| 2535 | |
| 2536 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2537 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2538 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2539 | ) |
| 2540 | { |
| 2541 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2542 | } |
| 2543 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2544 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2545 | { |
| 2546 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2547 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2548 | |
| 2549 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2550 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2551 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2552 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2553 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2554 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2555 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2556 | psessionEntry->peSessionId, |
| 2557 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame^] | 2558 | |
| 2559 | // enable caching |
| 2560 | WLANTL_EnableCaching(psessionEntry->staId); |
| 2561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2562 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2563 | HAL_TXRX_FRM_802_11_MGMT, |
| 2564 | ANI_TXDIR_TODS, |
| 2565 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2566 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2567 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2568 | psessionEntry->peSessionId, |
| 2569 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2570 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2571 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2572 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | halstatus ); |
| 2574 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2575 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2576 | return; |
| 2577 | } |
| 2578 | |
| 2579 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2580 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2581 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2582 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2583 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2584 | } // End limSendAssocReqMgmtFrame |
| 2585 | |
| 2586 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2587 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2588 | /*------------------------------------------------------------------------------------ |
| 2589 | * |
| 2590 | * Send Reassoc Req with FTIEs. |
| 2591 | * |
| 2592 | *----------------------------------------------------------------------------------- |
| 2593 | */ |
| 2594 | void |
| 2595 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2596 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2597 | { |
| 2598 | static tDot11fReAssocRequest frm; |
| 2599 | tANI_U16 caps; |
| 2600 | tANI_U8 *pFrame; |
| 2601 | tSirRetStatus nSirStatus; |
| 2602 | tANI_U32 nBytes, nPayload, nStatus; |
| 2603 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2604 | void *pPacket; |
| 2605 | eHalStatus halstatus; |
| 2606 | #if defined WLAN_FEATURE_VOWIFI |
| 2607 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2608 | #endif |
| 2609 | tANI_U16 ft_ies_length = 0; |
| 2610 | tANI_U8 *pBody; |
| 2611 | tANI_U16 nAddIELen; |
| 2612 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2613 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2614 | tANI_U8 *wpsIe = NULL; |
| 2615 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2616 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2617 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2618 | |
| 2619 | if (NULL == psessionEntry) |
| 2620 | { |
| 2621 | return; |
| 2622 | } |
| 2623 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2624 | /* check this early to avoid unncessary operation */ |
| 2625 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2626 | { |
| 2627 | return; |
| 2628 | } |
| 2629 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2630 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2631 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2632 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2633 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2634 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2635 | |
| 2636 | caps = pMlmReassocReq->capabilityInfo; |
| 2637 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2638 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2639 | #if defined(FEATURE_WLAN_WAPI) |
| 2640 | /* CR: 262463 : |
| 2641 | According to WAPI standard: |
| 2642 | 7.3.1.4 Capability Information field |
| 2643 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2644 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2645 | Reassociation management frames. */ |
| 2646 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2647 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2648 | #endif |
| 2649 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2650 | |
| 2651 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2652 | |
| 2653 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2654 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2656 | |
| 2657 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2658 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2659 | &frm.SuppRates,psessionEntry); |
| 2660 | |
| 2661 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2662 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2663 | |
| 2664 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2665 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2666 | |
| 2667 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2668 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2669 | |
| 2670 | if ( psessionEntry->lim11hEnable && |
| 2671 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2672 | { |
| 2673 | #if defined WLAN_FEATURE_VOWIFI |
| 2674 | PowerCapsPopulated = TRUE; |
| 2675 | |
| 2676 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2677 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2678 | #endif |
| 2679 | } |
| 2680 | |
| 2681 | #if defined WLAN_FEATURE_VOWIFI |
| 2682 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2683 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2684 | { |
| 2685 | if (PowerCapsPopulated == FALSE) |
| 2686 | { |
| 2687 | PowerCapsPopulated = TRUE; |
| 2688 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2689 | } |
| 2690 | } |
| 2691 | #endif |
| 2692 | |
| 2693 | if ( fQosEnabled && |
| 2694 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2695 | { |
| 2696 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2697 | } |
| 2698 | |
| 2699 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2700 | &frm.ExtSuppRates, psessionEntry ); |
| 2701 | |
| 2702 | #if defined WLAN_FEATURE_VOWIFI |
| 2703 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2704 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2705 | { |
| 2706 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2707 | } |
| 2708 | #endif |
| 2709 | |
| 2710 | // Ideally this should be enabled for 11r also. But 11r does |
| 2711 | // not follow the usual norm of using the Opaque object |
| 2712 | // for rsnie and fties. Instead we just add |
| 2713 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2714 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2715 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | // |
| 2717 | // The join request *should* contain zero or one of the WPA and RSN |
| 2718 | // IEs. The payload send along with the request is a |
| 2719 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2720 | |
| 2721 | // typedef struct sSirRSNie |
| 2722 | // { |
| 2723 | // tANI_U16 length; |
| 2724 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2725 | // } tSirRSNie, *tpSirRSNie; |
| 2726 | |
| 2727 | // So, we should be able to make the following two calls harmlessly, |
| 2728 | // since they do nothing if they don't find the given IE in the |
| 2729 | // bytestream with which they're provided. |
| 2730 | |
| 2731 | // The net effect of this will be to faithfully transmit whatever |
| 2732 | // security IE is in the join request. |
| 2733 | |
| 2734 | // *However*, if we're associating for the purpose of WPS |
| 2735 | // enrollment, and we've been configured to indicate that by |
| 2736 | // eliding the WPA or RSN IE, we just skip this: |
| 2737 | if (!psessionEntry->is11Rconnection) |
| 2738 | { |
| 2739 | if( nAddIELen && pAddIE ) |
| 2740 | { |
| 2741 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2742 | } |
| 2743 | if ( NULL == wpsIe ) |
| 2744 | { |
| 2745 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2746 | &frm.RSNOpaque ); |
| 2747 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2748 | &frm.WPAOpaque ); |
| 2749 | } |
| 2750 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2751 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2752 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2753 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2754 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2755 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2756 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2757 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2758 | } |
| 2759 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2760 | #ifdef FEATURE_WLAN_ESE |
| 2761 | // For ESE Associations fill the ESE IEs |
| 2762 | if (psessionEntry->isESEconnection && |
| 2763 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2765 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2766 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2767 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2768 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2769 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2770 | #endif //FEATURE_WLAN_ESE |
| 2771 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2772 | |
| 2773 | // include WME EDCA IE as well |
| 2774 | if ( fWmeEnabled ) |
| 2775 | { |
| 2776 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2777 | { |
| 2778 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2779 | } |
| 2780 | |
| 2781 | if ( fWsmEnabled && |
| 2782 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2783 | { |
| 2784 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2785 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2786 | #ifdef FEATURE_WLAN_ESE |
| 2787 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2788 | { |
| 2789 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2790 | |
| 2791 | // Populate the TSRS IE if TSPEC is included in the reassoc request |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2792 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2793 | { |
| 2794 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2795 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2797 | |
| 2798 | tsrsIE.tsid = 0; |
| 2799 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2800 | { |
| 2801 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2802 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2803 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2804 | { |
| 2805 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2806 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2807 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2808 | } |
| 2809 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2810 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2811 | } |
| 2812 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2813 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2814 | pMac->lim.htCapabilityPresentInBeacon) |
| 2815 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2816 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2817 | } |
| 2818 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2819 | #if defined WLAN_FEATURE_VOWIFI_11R |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 2820 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && |
| 2821 | (pMac->ft.ftSmeContext.addMDIE == TRUE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2822 | #if defined FEATURE_WLAN_ESE |
| 2823 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2824 | #endif |
| 2825 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2826 | { |
| 2827 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2828 | } |
| 2829 | #endif |
| 2830 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2831 | #ifdef WLAN_FEATURE_11AC |
| 2832 | if ( psessionEntry->vhtCapability && |
| 2833 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2834 | { |
| 2835 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
| 2836 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2837 | } |
| 2838 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2839 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2840 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2841 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2842 | if ( DOT11F_FAILED( nStatus ) ) |
| 2843 | { |
| 2844 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2845 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2846 | nStatus ); |
| 2847 | // We'll fall back on the worst case scenario: |
| 2848 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2849 | } |
| 2850 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2851 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2852 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2853 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2854 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2855 | } |
| 2856 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2857 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2858 | |
| 2859 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2860 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2861 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2862 | #endif |
| 2863 | |
| 2864 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2865 | if (psessionEntry->is11Rconnection) |
| 2866 | { |
| 2867 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2868 | } |
| 2869 | #endif |
| 2870 | |
| 2871 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2872 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2873 | ( void** ) &pPacket ); |
| 2874 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2875 | { |
| 2876 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2877 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2878 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2879 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | goto end; |
| 2881 | } |
| 2882 | |
| 2883 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2884 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2885 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2886 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2887 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2888 | #endif |
| 2889 | // Next, we fill out the buffer descriptor: |
| 2890 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2891 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2892 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2893 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2894 | { |
| 2895 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2896 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2897 | nSirStatus ); |
| 2898 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2899 | goto end; |
| 2900 | } |
| 2901 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2902 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2903 | // That done, pack the ReAssoc Request: |
| 2904 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2905 | sizeof(tSirMacMgmtHdr), |
| 2906 | nPayload, &nPayload ); |
| 2907 | if ( DOT11F_FAILED( nStatus ) ) |
| 2908 | { |
| 2909 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2910 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2911 | nStatus ); |
| 2912 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2913 | goto end; |
| 2914 | } |
| 2915 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2916 | { |
| 2917 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2918 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2919 | } |
| 2920 | |
| 2921 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2922 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2923 | nBytes, nPayload );) |
| 2924 | if( psessionEntry->assocReq != NULL ) |
| 2925 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2926 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2927 | psessionEntry->assocReq = NULL; |
| 2928 | } |
| 2929 | |
| 2930 | if( nAddIELen ) |
| 2931 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2932 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2933 | pAddIE, |
| 2934 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2935 | nPayload += nAddIELen; |
| 2936 | } |
| 2937 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2938 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2939 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2940 | { |
| 2941 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2942 | } |
| 2943 | else |
| 2944 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2945 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2946 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2947 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2948 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2949 | |
| 2950 | if (psessionEntry->is11Rconnection) |
| 2951 | { |
| 2952 | { |
| 2953 | int i = 0; |
| 2954 | |
| 2955 | pBody = pFrame + nBytes; |
| 2956 | for (i=0; i<ft_ies_length; i++) |
| 2957 | { |
| 2958 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2959 | pBody++; |
| 2960 | } |
| 2961 | } |
| 2962 | } |
| 2963 | |
| 2964 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2965 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2966 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2967 | (tANI_U8 *)pFrame, |
| 2968 | (nBytes + ft_ies_length));) |
| 2969 | #endif |
| 2970 | |
| 2971 | |
| 2972 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2973 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2974 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2975 | ) |
| 2976 | { |
| 2977 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2978 | } |
| 2979 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2980 | if( NULL != psessionEntry->assocReq ) |
| 2981 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2982 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2983 | psessionEntry->assocReq = NULL; |
| 2984 | } |
| 2985 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2986 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 2987 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2988 | { |
| 2989 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2990 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2991 | } |
| 2992 | else |
| 2993 | { |
| 2994 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2995 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 2996 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2997 | psessionEntry->assocReqLen = (ft_ies_length); |
| 2998 | } |
| 2999 | |
| 3000 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3001 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3002 | psessionEntry->peSessionId, |
| 3003 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3004 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3005 | HAL_TXRX_FRM_802_11_MGMT, |
| 3006 | ANI_TXDIR_TODS, |
| 3007 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3008 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3009 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3010 | psessionEntry->peSessionId, |
| 3011 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3012 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3013 | { |
| 3014 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3015 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3016 | nSirStatus ); |
| 3017 | //Pkt will be freed up by the callback |
| 3018 | goto end; |
| 3019 | } |
| 3020 | |
| 3021 | end: |
| 3022 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3023 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3024 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3025 | |
| 3026 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3027 | |
| 3028 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3029 | tLimMlmReassocReq *pMlmReassocReq, |
| 3030 | tpPESession psessionEntry) |
| 3031 | { |
| 3032 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3033 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 3034 | if(NULL == pTmpMlmReassocReq) |
| 3035 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3036 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3037 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3038 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3039 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3040 | } |
| 3041 | |
| 3042 | // Prepare and send Reassociation request frame |
| 3043 | // start reassoc timer. |
| 3044 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3045 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3046 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3047 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3048 | != TX_SUCCESS) |
| 3049 | { |
| 3050 | // Could not start reassoc failure timer. |
| 3051 | // Log error |
| 3052 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3053 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3054 | // Return Reassoc confirm with |
| 3055 | // Resources Unavailable |
| 3056 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3057 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3058 | goto end; |
| 3059 | } |
| 3060 | |
| 3061 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3062 | return; |
| 3063 | |
| 3064 | end: |
| 3065 | // Free up buffer allocated for reassocReq |
| 3066 | if (pMlmReassocReq != NULL) |
| 3067 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3068 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3069 | pMlmReassocReq = NULL; |
| 3070 | } |
| 3071 | if (pTmpMlmReassocReq != NULL) |
| 3072 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3073 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3074 | pTmpMlmReassocReq = NULL; |
| 3075 | } |
| 3076 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3077 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3078 | /* Update PE sessio Id*/ |
| 3079 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3080 | |
| 3081 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3082 | } |
| 3083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3084 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3085 | |
| 3086 | |
| 3087 | void |
| 3088 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3089 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3090 | { |
| 3091 | static tDot11fReAssocRequest frm; |
| 3092 | tANI_U16 caps; |
| 3093 | tANI_U8 *pFrame; |
| 3094 | tSirRetStatus nSirStatus; |
| 3095 | tANI_U32 nBytes, nPayload, nStatus; |
| 3096 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3097 | void *pPacket; |
| 3098 | eHalStatus halstatus; |
| 3099 | tANI_U16 nAddIELen; |
| 3100 | tANI_U8 *pAddIE; |
| 3101 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3102 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3103 | #if defined WLAN_FEATURE_VOWIFI |
| 3104 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3105 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3106 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3107 | |
| 3108 | if(NULL == psessionEntry) |
| 3109 | { |
| 3110 | return; |
| 3111 | } |
| 3112 | |
| 3113 | /* check this early to avoid unncessary operation */ |
| 3114 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3115 | { |
| 3116 | return; |
| 3117 | } |
| 3118 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3119 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3120 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3121 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3122 | |
| 3123 | caps = pMlmReassocReq->capabilityInfo; |
| 3124 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3125 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3126 | #if defined(FEATURE_WLAN_WAPI) |
| 3127 | /* CR: 262463 : |
| 3128 | According to WAPI standard: |
| 3129 | 7.3.1.4 Capability Information field |
| 3130 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3131 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3132 | Reassociation management frames. */ |
| 3133 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3134 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3135 | #endif |
| 3136 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3137 | |
| 3138 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3139 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3140 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3141 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3142 | |
| 3143 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3144 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3145 | &frm.SuppRates,psessionEntry); |
| 3146 | |
| 3147 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3148 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3149 | |
| 3150 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3151 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3152 | |
| 3153 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3154 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3155 | |
| 3156 | |
| 3157 | if ( psessionEntry->lim11hEnable && |
| 3158 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3159 | { |
| 3160 | #if defined WLAN_FEATURE_VOWIFI |
| 3161 | PowerCapsPopulated = TRUE; |
| 3162 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3163 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3164 | #endif |
| 3165 | } |
| 3166 | |
| 3167 | #if defined WLAN_FEATURE_VOWIFI |
| 3168 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3169 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3170 | { |
| 3171 | if (PowerCapsPopulated == FALSE) |
| 3172 | { |
| 3173 | PowerCapsPopulated = TRUE; |
| 3174 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3175 | } |
| 3176 | } |
| 3177 | #endif |
| 3178 | |
| 3179 | if ( fQosEnabled && |
| 3180 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3181 | { |
| 3182 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3183 | } |
| 3184 | |
| 3185 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3186 | &frm.ExtSuppRates, psessionEntry ); |
| 3187 | |
| 3188 | #if defined WLAN_FEATURE_VOWIFI |
| 3189 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3190 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3191 | { |
| 3192 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3193 | } |
| 3194 | #endif |
| 3195 | // The join request *should* contain zero or one of the WPA and RSN |
| 3196 | // IEs. The payload send along with the request is a |
| 3197 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3198 | |
| 3199 | // typedef struct sSirRSNie |
| 3200 | // { |
| 3201 | // tANI_U16 length; |
| 3202 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3203 | // } tSirRSNie, *tpSirRSNie; |
| 3204 | |
| 3205 | // So, we should be able to make the following two calls harmlessly, |
| 3206 | // since they do nothing if they don't find the given IE in the |
| 3207 | // bytestream with which they're provided. |
| 3208 | |
| 3209 | // The net effect of this will be to faithfully transmit whatever |
| 3210 | // security IE is in the join request. |
| 3211 | |
| 3212 | // *However*, if we're associating for the purpose of WPS |
| 3213 | // enrollment, and we've been configured to indicate that by |
| 3214 | // eliding the WPA or RSN IE, we just skip this: |
| 3215 | if( nAddIELen && pAddIE ) |
| 3216 | { |
| 3217 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3218 | } |
| 3219 | if ( NULL == wpsIe ) |
| 3220 | { |
| 3221 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3222 | &frm.RSNOpaque ); |
| 3223 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3224 | &frm.WPAOpaque ); |
| 3225 | #if defined(FEATURE_WLAN_WAPI) |
| 3226 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3227 | &frm.WAPIOpaque ); |
| 3228 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3229 | } |
| 3230 | |
| 3231 | // include WME EDCA IE as well |
| 3232 | if ( fWmeEnabled ) |
| 3233 | { |
| 3234 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3235 | { |
| 3236 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3237 | } |
| 3238 | |
| 3239 | if ( fWsmEnabled && |
| 3240 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3241 | { |
| 3242 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3243 | } |
| 3244 | } |
| 3245 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3246 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3247 | pMac->lim.htCapabilityPresentInBeacon) |
| 3248 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3249 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3250 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3251 | #ifdef WLAN_FEATURE_11AC |
| 3252 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3253 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3254 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3255 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3256 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3257 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3258 | } |
| 3259 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3260 | |
| 3261 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3262 | if ( DOT11F_FAILED( nStatus ) ) |
| 3263 | { |
| 3264 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3265 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | nStatus ); |
| 3267 | // We'll fall back on the worst case scenario: |
| 3268 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3269 | } |
| 3270 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3271 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3272 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3273 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3274 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3275 | } |
| 3276 | |
| 3277 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3278 | |
| 3279 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3280 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3281 | ( void** ) &pPacket ); |
| 3282 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3283 | { |
| 3284 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3285 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3286 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3287 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | goto end; |
| 3289 | } |
| 3290 | |
| 3291 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3292 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3293 | |
| 3294 | // Next, we fill out the buffer descriptor: |
| 3295 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3296 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3297 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3298 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3299 | { |
| 3300 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3301 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | nSirStatus ); |
| 3303 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3304 | goto end; |
| 3305 | } |
| 3306 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3307 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3308 | // That done, pack the Probe Request: |
| 3309 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3310 | sizeof(tSirMacMgmtHdr), |
| 3311 | nPayload, &nPayload ); |
| 3312 | if ( DOT11F_FAILED( nStatus ) ) |
| 3313 | { |
| 3314 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3315 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3316 | nStatus ); |
| 3317 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3318 | goto end; |
| 3319 | } |
| 3320 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3321 | { |
| 3322 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3323 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3324 | } |
| 3325 | |
| 3326 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3327 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3328 | nBytes );) |
| 3329 | |
| 3330 | if( psessionEntry->assocReq != NULL ) |
| 3331 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3332 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3333 | psessionEntry->assocReq = NULL; |
| 3334 | } |
| 3335 | |
| 3336 | if( nAddIELen ) |
| 3337 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3338 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3339 | pAddIE, |
| 3340 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3341 | nPayload += nAddIELen; |
| 3342 | } |
| 3343 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3344 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3345 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3346 | { |
| 3347 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3348 | } |
| 3349 | else |
| 3350 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3351 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3352 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3353 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3355 | |
| 3356 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3357 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3358 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3359 | ) |
| 3360 | { |
| 3361 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3362 | } |
| 3363 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3364 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3365 | { |
| 3366 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3367 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3368 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3369 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3370 | psessionEntry->peSessionId, |
| 3371 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame^] | 3372 | |
| 3373 | // enable caching |
| 3374 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3376 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3377 | HAL_TXRX_FRM_802_11_MGMT, |
| 3378 | ANI_TXDIR_TODS, |
| 3379 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3380 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3381 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3382 | psessionEntry->peSessionId, |
| 3383 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3384 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3385 | { |
| 3386 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3387 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | nSirStatus ); |
| 3389 | //Pkt will be freed up by the callback |
| 3390 | goto end; |
| 3391 | } |
| 3392 | |
| 3393 | end: |
| 3394 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3395 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3396 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3397 | |
| 3398 | } // limSendReassocReqMgmtFrame |
| 3399 | |
| 3400 | /** |
| 3401 | * \brief Send an Authentication frame |
| 3402 | * |
| 3403 | * |
| 3404 | * \param pMac Pointer to Global MAC structure |
| 3405 | * |
| 3406 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3407 | * to be sent |
| 3408 | * |
| 3409 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3410 | * frame is destined |
| 3411 | * |
| 3412 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3413 | * Authentication frame3 |
| 3414 | * |
| 3415 | * |
| 3416 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3417 | * is formatted and sent when this function is called. |
| 3418 | * |
| 3419 | * |
| 3420 | */ |
| 3421 | |
| 3422 | void |
| 3423 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3424 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3425 | tSirMacAddr peerMacAddr, |
| 3426 | tANI_U8 wepBit, |
| 3427 | tpPESession psessionEntry |
| 3428 | ) |
| 3429 | { |
| 3430 | tANI_U8 *pFrame, *pBody; |
| 3431 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3432 | tpSirMacMgmtHdr pMacHdr; |
| 3433 | tANI_U16 i; |
| 3434 | void *pPacket; |
| 3435 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3436 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | |
| 3438 | if(NULL == psessionEntry) |
| 3439 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3440 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3441 | return; |
| 3442 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3443 | |
| 3444 | limLog(pMac, LOG1, |
| 3445 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3446 | pAuthFrameBody->authTransactionSeqNumber, |
| 3447 | pAuthFrameBody->authStatusCode, |
| 3448 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3449 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3450 | if (wepBit == LIM_WEP_IN_FC) |
| 3451 | { |
| 3452 | /// Auth frame3 to be sent with encrypted framebody |
| 3453 | /** |
| 3454 | * Allocate buffer for Authenticaton frame of size equal |
| 3455 | * to management frame header length plus 2 bytes each for |
| 3456 | * auth algorithm number, transaction number, status code, |
| 3457 | * 128 bytes for challenge text and 4 bytes each for |
| 3458 | * IV & ICV. |
| 3459 | */ |
| 3460 | |
| 3461 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3462 | |
| 3463 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3464 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3465 | else |
| 3466 | { |
| 3467 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3468 | { |
| 3469 | case SIR_MAC_AUTH_FRAME_1: |
| 3470 | /** |
| 3471 | * Allocate buffer for Authenticaton frame of size |
| 3472 | * equal to management frame header length plus 2 bytes |
| 3473 | * each for auth algorithm number, transaction number |
| 3474 | * and status code. |
| 3475 | */ |
| 3476 | |
| 3477 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3478 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3479 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3480 | |
| 3481 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3482 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3483 | { |
| 3484 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3485 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3486 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3487 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3488 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3489 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3490 | else |
| 3491 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3492 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3493 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3494 | frameLen += (2+SIR_MDIE_SIZE); |
| 3495 | } |
| 3496 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3497 | #endif |
| 3498 | break; |
| 3499 | |
| 3500 | case SIR_MAC_AUTH_FRAME_2: |
| 3501 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3502 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3503 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3504 | { |
| 3505 | /** |
| 3506 | * Allocate buffer for Authenticaton frame of size |
| 3507 | * equal to management frame header length plus |
| 3508 | * 2 bytes each for auth algorithm number, |
| 3509 | * transaction number and status code. |
| 3510 | */ |
| 3511 | |
| 3512 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3513 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3514 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3515 | } |
| 3516 | else |
| 3517 | { |
| 3518 | // Shared Key algorithm with challenge text |
| 3519 | // to be sent |
| 3520 | /** |
| 3521 | * Allocate buffer for Authenticaton frame of size |
| 3522 | * equal to management frame header length plus |
| 3523 | * 2 bytes each for auth algorithm number, |
| 3524 | * transaction number, status code and 128 bytes |
| 3525 | * for challenge text. |
| 3526 | */ |
| 3527 | |
| 3528 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3529 | sizeof(tSirMacAuthFrame); |
| 3530 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3531 | } |
| 3532 | |
| 3533 | break; |
| 3534 | |
| 3535 | case SIR_MAC_AUTH_FRAME_3: |
| 3536 | /// Auth frame3 to be sent without encrypted framebody |
| 3537 | /** |
| 3538 | * Allocate buffer for Authenticaton frame of size equal |
| 3539 | * to management frame header length plus 2 bytes each |
| 3540 | * for auth algorithm number, transaction number and |
| 3541 | * status code. |
| 3542 | */ |
| 3543 | |
| 3544 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3545 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3546 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3547 | |
| 3548 | break; |
| 3549 | |
| 3550 | case SIR_MAC_AUTH_FRAME_4: |
| 3551 | /** |
| 3552 | * Allocate buffer for Authenticaton frame of size equal |
| 3553 | * to management frame header length plus 2 bytes each |
| 3554 | * for auth algorithm number, transaction number and |
| 3555 | * status code. |
| 3556 | */ |
| 3557 | |
| 3558 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3559 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3560 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3561 | |
| 3562 | break; |
| 3563 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3564 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3565 | |
| 3566 | |
| 3567 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3568 | |
| 3569 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3570 | { |
| 3571 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3572 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3573 | |
| 3574 | return; |
| 3575 | } |
| 3576 | |
| 3577 | for (i = 0; i < frameLen; i++) |
| 3578 | pFrame[i] = 0; |
| 3579 | |
| 3580 | // Prepare BD |
| 3581 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3582 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3583 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3584 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3585 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3586 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3587 | return; |
| 3588 | } |
| 3589 | |
| 3590 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3591 | pMacHdr->fc.wep = wepBit; |
| 3592 | |
| 3593 | // Prepare BSSId |
| 3594 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3595 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3596 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3597 | (tANI_U8 *) psessionEntry->bssId, |
| 3598 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3599 | } |
| 3600 | |
| 3601 | /// Prepare Authentication frame body |
| 3602 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3603 | |
| 3604 | if (wepBit == LIM_WEP_IN_FC) |
| 3605 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3606 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3607 | |
| 3608 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3609 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3610 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3611 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3612 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3614 | } |
| 3615 | else |
| 3616 | { |
| 3617 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3618 | pBody += sizeof(tANI_U16); |
| 3619 | bodyLen -= sizeof(tANI_U16); |
| 3620 | |
| 3621 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3622 | pBody += sizeof(tANI_U16); |
| 3623 | bodyLen -= sizeof(tANI_U16); |
| 3624 | |
| 3625 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3626 | pBody += sizeof(tANI_U16); |
| 3627 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3628 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3629 | sizeof (pAuthFrameBody->length) + |
| 3630 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3631 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3632 | |
| 3633 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3634 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3635 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3636 | { |
| 3637 | |
| 3638 | { |
| 3639 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3640 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3641 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3642 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3643 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3644 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3645 | (tANI_U8 *)pBody, |
| 3646 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3647 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3648 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3649 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3650 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3651 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3652 | } |
| 3653 | } |
| 3654 | else |
| 3655 | { |
| 3656 | /* MDID attr is 54*/ |
| 3657 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3658 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3659 | *pBody = SIR_MDIE_SIZE; |
| 3660 | pBody++; |
| 3661 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3662 | { |
| 3663 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3664 | pBody++; |
| 3665 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3666 | } |
| 3667 | } |
| 3668 | } |
| 3669 | #endif |
| 3670 | |
| 3671 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3672 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3673 | pAuthFrameBody->authTransactionSeqNumber, |
| 3674 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3675 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3676 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3677 | } |
| 3678 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3679 | |
| 3680 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3681 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3682 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3683 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3684 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3685 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3686 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3687 | ) |
| 3688 | { |
| 3689 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3690 | } |
| 3691 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3692 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3693 | { |
| 3694 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3695 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3696 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 3697 | limLog( pMac, LOG1, FL("Sending Auth Frame over WQ5 to "MAC_ADDRESS_STR |
| 3698 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 3699 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3700 | |
| 3701 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3702 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3703 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3704 | psessionEntry->peSessionId, |
| 3705 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3706 | /// Queue Authentication frame in high priority WQ |
| 3707 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3708 | HAL_TXRX_FRM_802_11_MGMT, |
| 3709 | ANI_TXDIR_TODS, |
| 3710 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3711 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3712 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3713 | psessionEntry->peSessionId, |
| 3714 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3715 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3716 | { |
| 3717 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3718 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3719 | halstatus); |
| 3720 | |
| 3721 | //Pkt will be freed up by the callback |
| 3722 | } |
| 3723 | |
| 3724 | return; |
| 3725 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3726 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3727 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3728 | { |
| 3729 | tANI_U16 aid; |
| 3730 | tpDphHashNode pStaDs; |
| 3731 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3732 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3733 | tpPESession psessionEntry; |
| 3734 | |
| 3735 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3736 | if (pMlmDeauthReq) |
| 3737 | { |
| 3738 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3739 | { |
| 3740 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3741 | } |
| 3742 | |
| 3743 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3744 | { |
| 3745 | |
| 3746 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3747 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3748 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3749 | goto end; |
| 3750 | } |
| 3751 | |
| 3752 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3753 | if (pStaDs == NULL) |
| 3754 | { |
| 3755 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3756 | goto end; |
| 3757 | } |
| 3758 | |
| 3759 | |
| 3760 | /// Receive path cleanup with dummy packet |
| 3761 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3762 | |
| 3763 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3764 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
| 3765 | ( |
| 3766 | #ifdef FEATURE_WLAN_ESE |
| 3767 | (psessionEntry->isESEconnection ) || |
| 3768 | #endif |
| 3769 | #ifdef FEATURE_WLAN_LFR |
| 3770 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
| 3771 | #endif |
| 3772 | (psessionEntry->is11Rconnection ))) |
| 3773 | { |
| 3774 | PELOGE(limLog(pMac, LOGE, |
| 3775 | FL("FT Preauth Session (%p,%d) Cleanup" |
| 3776 | " Deauth reason %d Trigger = %d"), |
| 3777 | psessionEntry, psessionEntry->peSessionId, |
| 3778 | pMlmDeauthReq->reasonCode, |
| 3779 | pMlmDeauthReq->deauthTrigger);); |
| 3780 | limFTCleanup(pMac); |
| 3781 | } |
| 3782 | else |
| 3783 | { |
| 3784 | PELOGE(limLog(pMac, LOGE, |
| 3785 | FL("No FT Preauth Session Cleanup in role %d" |
| 3786 | #ifdef FEATURE_WLAN_ESE |
| 3787 | " isESE %d" |
| 3788 | #endif |
| 3789 | #ifdef FEATURE_WLAN_LFR |
| 3790 | " isLFR %d" |
| 3791 | #endif |
| 3792 | " is11r %d, Deauth reason %d Trigger = %d"), |
| 3793 | psessionEntry->limSystemRole, |
| 3794 | #ifdef FEATURE_WLAN_ESE |
| 3795 | psessionEntry->isESEconnection, |
| 3796 | #endif |
| 3797 | #ifdef FEATURE_WLAN_LFR |
| 3798 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3799 | #endif |
| 3800 | psessionEntry->is11Rconnection, |
| 3801 | pMlmDeauthReq->reasonCode, |
| 3802 | pMlmDeauthReq->deauthTrigger);); |
| 3803 | } |
| 3804 | #endif |
| 3805 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3806 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3807 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3808 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3809 | } |
| 3810 | return eHAL_STATUS_SUCCESS; |
| 3811 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3812 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3813 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3814 | sizeof(tSirMacAddr)); |
| 3815 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3816 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3817 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3818 | |
| 3819 | // Free up buffer allocated |
| 3820 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3821 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3822 | |
| 3823 | limPostSmeMessage(pMac, |
| 3824 | LIM_MLM_DEAUTH_CNF, |
| 3825 | (tANI_U32 *) &mlmDeauthCnf); |
| 3826 | return eHAL_STATUS_SUCCESS; |
| 3827 | } |
| 3828 | |
| 3829 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3830 | { |
| 3831 | tANI_U16 aid; |
| 3832 | tpDphHashNode pStaDs; |
| 3833 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3834 | tpPESession psessionEntry; |
| 3835 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3836 | |
| 3837 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3838 | if (pMlmDisassocReq) |
| 3839 | { |
| 3840 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3841 | { |
| 3842 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3843 | } |
| 3844 | |
| 3845 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3846 | { |
| 3847 | |
| 3848 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3849 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3850 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3851 | goto end; |
| 3852 | } |
| 3853 | |
| 3854 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3855 | if (pStaDs == NULL) |
| 3856 | { |
| 3857 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3858 | goto end; |
| 3859 | } |
| 3860 | |
| 3861 | /// Receive path cleanup with dummy packet |
| 3862 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3863 | { |
| 3864 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3865 | goto end; |
| 3866 | } |
| 3867 | |
| 3868 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3869 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3870 | ( |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3871 | #ifdef FEATURE_WLAN_ESE |
| 3872 | (psessionEntry->isESEconnection ) || |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3873 | #endif |
| 3874 | #ifdef FEATURE_WLAN_LFR |
| 3875 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3876 | #endif |
| 3877 | (psessionEntry->is11Rconnection )) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3878 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3879 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3880 | { |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3881 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3882 | FL("FT Preauth Session (%p,%d) Cleanup"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3883 | psessionEntry, psessionEntry->peSessionId);); |
| 3884 | limFTCleanup(pMac); |
| 3885 | } |
| 3886 | else |
| 3887 | { |
| 3888 | PELOGE(limLog(pMac, LOGE, |
| 3889 | FL("No FT Preauth Session Cleanup in role %d" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3890 | #ifdef FEATURE_WLAN_ESE |
| 3891 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3892 | #endif |
| 3893 | #ifdef FEATURE_WLAN_LFR |
| 3894 | " isLFR %d" |
| 3895 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3896 | " is11r %d reason %d"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3897 | psessionEntry->limSystemRole, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3898 | #ifdef FEATURE_WLAN_ESE |
| 3899 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3900 | #endif |
| 3901 | #ifdef FEATURE_WLAN_LFR |
| 3902 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3903 | #endif |
| 3904 | psessionEntry->is11Rconnection, |
| 3905 | pMlmDisassocReq->reasonCode);); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3906 | } |
| 3907 | #endif |
| 3908 | |
| 3909 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3910 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3911 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3912 | return eHAL_STATUS_SUCCESS; |
| 3913 | } |
| 3914 | else |
| 3915 | { |
| 3916 | return eHAL_STATUS_SUCCESS; |
| 3917 | } |
| 3918 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3919 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3920 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3921 | sizeof(tSirMacAddr)); |
| 3922 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3923 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3924 | |
| 3925 | /* Update PE session ID*/ |
| 3926 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3927 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3928 | if(pMlmDisassocReq != NULL) |
| 3929 | { |
| 3930 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3931 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3932 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3933 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3934 | |
| 3935 | limPostSmeMessage(pMac, |
| 3936 | LIM_MLM_DISASSOC_CNF, |
| 3937 | (tANI_U32 *) &mlmDisassocCnf); |
| 3938 | return eHAL_STATUS_SUCCESS; |
| 3939 | } |
| 3940 | |
| 3941 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3942 | { |
| 3943 | return limSendDisassocCnf(pMac); |
| 3944 | } |
| 3945 | |
| 3946 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3947 | { |
| 3948 | return limSendDeauthCnf(pMac); |
| 3949 | } |
| 3950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3951 | /** |
| 3952 | * \brief This function is called to send Disassociate frame. |
| 3953 | * |
| 3954 | * |
| 3955 | * \param pMac Pointer to Global MAC structure |
| 3956 | * |
| 3957 | * \param nReason Indicates the reason that need to be sent in |
| 3958 | * Disassociation frame |
| 3959 | * |
| 3960 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3961 | * sent |
| 3962 | * |
| 3963 | * |
| 3964 | */ |
| 3965 | |
| 3966 | void |
| 3967 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3968 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3969 | tSirMacAddr peer, |
| 3970 | tpPESession psessionEntry, |
| 3971 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3972 | { |
| 3973 | tDot11fDisassociation frm; |
| 3974 | tANI_U8 *pFrame; |
| 3975 | tSirRetStatus nSirStatus; |
| 3976 | tpSirMacMgmtHdr pMacHdr; |
| 3977 | tANI_U32 nBytes, nPayload, nStatus; |
| 3978 | void *pPacket; |
| 3979 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3980 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3981 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3982 | if(NULL == psessionEntry) |
| 3983 | { |
| 3984 | return; |
| 3985 | } |
| 3986 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3987 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3988 | |
| 3989 | frm.Reason.code = nReason; |
| 3990 | |
| 3991 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 3992 | if ( DOT11F_FAILED( nStatus ) ) |
| 3993 | { |
| 3994 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3995 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3996 | nStatus ); |
| 3997 | // We'll fall back on the worst case scenario: |
| 3998 | nPayload = sizeof( tDot11fDisassociation ); |
| 3999 | } |
| 4000 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4001 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4002 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4003 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4004 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4005 | } |
| 4006 | |
| 4007 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4008 | |
| 4009 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4010 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4011 | ( void** ) &pPacket ); |
| 4012 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4013 | { |
| 4014 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4015 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4016 | return; |
| 4017 | } |
| 4018 | |
| 4019 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4020 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4021 | |
| 4022 | // Next, we fill out the buffer descriptor: |
| 4023 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4024 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4025 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4026 | { |
| 4027 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4028 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4029 | nSirStatus ); |
| 4030 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4031 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4032 | return; // just allocated... |
| 4033 | } |
| 4034 | |
| 4035 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4036 | |
| 4037 | // Prepare the BSSID |
| 4038 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4039 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4040 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4041 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4042 | #endif |
| 4043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4044 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4045 | sizeof(tSirMacMgmtHdr), |
| 4046 | nPayload, &nPayload ); |
| 4047 | if ( DOT11F_FAILED( nStatus ) ) |
| 4048 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4049 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4050 | nStatus ); |
| 4051 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4052 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4053 | return; // allocated! |
| 4054 | } |
| 4055 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4056 | { |
| 4057 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4058 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4059 | } |
| 4060 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4061 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4062 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4063 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4064 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4065 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4066 | |
| 4067 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4069 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4070 | ) |
| 4071 | { |
| 4072 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4073 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4074 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4075 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4076 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4077 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4078 | { |
| 4079 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4080 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4081 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4082 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4083 | { |
| 4084 | /* This frame will be sent on air by firmware, |
| 4085 | which will ensure that this frame goes out |
| 4086 | even though DEL_STA is sent immediately */ |
| 4087 | /* Without this for DEL_STA command there is |
| 4088 | risk of flushing frame in BTQM queue without |
| 4089 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4090 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4091 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4092 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4093 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4094 | } |
| 4095 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4096 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4097 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4098 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4099 | psessionEntry->peSessionId, |
| 4100 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4101 | // Queue Disassociation frame in high priority WQ |
| 4102 | /* get the duration from the request */ |
| 4103 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4104 | HAL_TXRX_FRM_802_11_MGMT, |
| 4105 | ANI_TXDIR_TODS, |
| 4106 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4107 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 4108 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4109 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4110 | psessionEntry->peSessionId, |
| 4111 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4112 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4113 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4114 | if (tx_timer_change( |
| 4115 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4116 | != TX_SUCCESS) |
| 4117 | { |
| 4118 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4119 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4120 | return; |
| 4121 | } |
| 4122 | else if(TX_SUCCESS != tx_timer_activate( |
| 4123 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4124 | { |
| 4125 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4126 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4127 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4128 | return; |
| 4129 | } |
| 4130 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4131 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4132 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4133 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4134 | psessionEntry->peSessionId, |
| 4135 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4136 | // Queue Disassociation frame in high priority WQ |
| 4137 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4138 | HAL_TXRX_FRM_802_11_MGMT, |
| 4139 | ANI_TXDIR_TODS, |
| 4140 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4141 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4142 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4143 | psessionEntry->peSessionId, |
| 4144 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4145 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4146 | { |
| 4147 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4148 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4149 | nSirStatus ); |
| 4150 | //Pkt will be freed up by the callback |
| 4151 | return; |
| 4152 | } |
| 4153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4154 | } // End limSendDisassocMgmtFrame. |
| 4155 | |
| 4156 | /** |
| 4157 | * \brief This function is called to send a Deauthenticate frame |
| 4158 | * |
| 4159 | * |
| 4160 | * \param pMac Pointer to global MAC structure |
| 4161 | * |
| 4162 | * \param nReason Indicates the reason that need to be sent in the |
| 4163 | * Deauthenticate frame |
| 4164 | * |
| 4165 | * \param peeer address of the STA to which the frame is to be sent |
| 4166 | * |
| 4167 | * |
| 4168 | */ |
| 4169 | |
| 4170 | void |
| 4171 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4172 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4173 | tSirMacAddr peer, |
| 4174 | tpPESession psessionEntry, |
| 4175 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4176 | { |
| 4177 | tDot11fDeAuth frm; |
| 4178 | tANI_U8 *pFrame; |
| 4179 | tSirRetStatus nSirStatus; |
| 4180 | tpSirMacMgmtHdr pMacHdr; |
| 4181 | tANI_U32 nBytes, nPayload, nStatus; |
| 4182 | void *pPacket; |
| 4183 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4184 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4185 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4186 | #ifdef FEATURE_WLAN_TDLS |
| 4187 | tANI_U16 aid; |
| 4188 | tpDphHashNode pStaDs; |
| 4189 | #endif |
| 4190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4191 | if(NULL == psessionEntry) |
| 4192 | { |
| 4193 | return; |
| 4194 | } |
| 4195 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4196 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | |
| 4198 | frm.Reason.code = nReason; |
| 4199 | |
| 4200 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4201 | if ( DOT11F_FAILED( nStatus ) ) |
| 4202 | { |
| 4203 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4204 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4205 | nStatus ); |
| 4206 | // We'll fall back on the worst case scenario: |
| 4207 | nPayload = sizeof( tDot11fDeAuth ); |
| 4208 | } |
| 4209 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4210 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4211 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4212 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4213 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4214 | } |
| 4215 | |
| 4216 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4217 | |
| 4218 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4219 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4220 | ( void** ) &pPacket ); |
| 4221 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4222 | { |
| 4223 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4224 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4225 | return; |
| 4226 | } |
| 4227 | |
| 4228 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4229 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4230 | |
| 4231 | // Next, we fill out the buffer descriptor: |
| 4232 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4233 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4234 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4235 | { |
| 4236 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4237 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | nSirStatus ); |
| 4239 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4240 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4241 | return; // just allocated... |
| 4242 | } |
| 4243 | |
| 4244 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4245 | |
| 4246 | // Prepare the BSSID |
| 4247 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4248 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4249 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4250 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4251 | #endif |
| 4252 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4253 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4254 | sizeof(tSirMacMgmtHdr), |
| 4255 | nPayload, &nPayload ); |
| 4256 | if ( DOT11F_FAILED( nStatus ) ) |
| 4257 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4258 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4259 | nStatus ); |
| 4260 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4261 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4262 | return; |
| 4263 | } |
| 4264 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4265 | { |
| 4266 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4267 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4268 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4269 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4270 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4271 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4272 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4273 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4274 | |
| 4275 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4276 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4277 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4278 | ) |
| 4279 | { |
| 4280 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4281 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4282 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4283 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4284 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4285 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4286 | { |
| 4287 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4288 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4289 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4290 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4291 | { |
| 4292 | /* This frame will be sent on air by firmware, |
| 4293 | which will ensure that this frame goes out |
| 4294 | even though DEL_STA is sent immediately */ |
| 4295 | /* Without this for DEL_STA command there is |
| 4296 | risk of flushing frame in BTQM queue without |
| 4297 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4298 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4299 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4300 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4301 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4302 | } |
| 4303 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4304 | #ifdef FEATURE_WLAN_TDLS |
| 4305 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4306 | #endif |
| 4307 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4308 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4309 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4310 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4311 | psessionEntry->peSessionId, |
| 4312 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4313 | // Queue Disassociation frame in high priority WQ |
| 4314 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4315 | HAL_TXRX_FRM_802_11_MGMT, |
| 4316 | ANI_TXDIR_TODS, |
| 4317 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4318 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4319 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4320 | psessionEntry->peSessionId, |
| 4321 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4322 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4323 | { |
| 4324 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4325 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4326 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4327 | //Pkt will be freed up by the callback limTxComplete |
| 4328 | |
| 4329 | /*Call limProcessDeauthAckTimeout which will send |
| 4330 | * DeauthCnf for this frame |
| 4331 | */ |
| 4332 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4333 | return; |
| 4334 | } |
| 4335 | |
| 4336 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4337 | |
| 4338 | if (tx_timer_change( |
| 4339 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4340 | != TX_SUCCESS) |
| 4341 | { |
| 4342 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4343 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4344 | return; |
| 4345 | } |
| 4346 | else if(TX_SUCCESS != tx_timer_activate( |
| 4347 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4348 | { |
| 4349 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4350 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4351 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4352 | return; |
| 4353 | } |
| 4354 | } |
| 4355 | else |
| 4356 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4357 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4358 | psessionEntry->peSessionId, |
| 4359 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4360 | #ifdef FEATURE_WLAN_TDLS |
| 4361 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4362 | { |
| 4363 | // Queue Disassociation frame in high priority WQ |
| 4364 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4365 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4366 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4367 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4368 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4369 | } |
| 4370 | else |
| 4371 | { |
| 4372 | #endif |
| 4373 | // Queue Disassociation frame in high priority WQ |
| 4374 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4375 | HAL_TXRX_FRM_802_11_MGMT, |
| 4376 | ANI_TXDIR_TODS, |
| 4377 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4378 | limTxComplete, pFrame, txFlag ); |
| 4379 | #ifdef FEATURE_WLAN_TDLS |
| 4380 | } |
| 4381 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4382 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4383 | psessionEntry->peSessionId, |
| 4384 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4385 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4386 | { |
| 4387 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4388 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4389 | nSirStatus ); |
| 4390 | //Pkt will be freed up by the callback |
| 4391 | return; |
| 4392 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4393 | } |
| 4394 | |
| 4395 | } // End limSendDeauthMgmtFrame. |
| 4396 | |
| 4397 | |
| 4398 | #ifdef ANI_SUPPORT_11H |
| 4399 | /** |
| 4400 | * \brief Send a Measurement Report Action frame |
| 4401 | * |
| 4402 | * |
| 4403 | * \param pMac Pointer to the global MAC structure |
| 4404 | * |
| 4405 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4406 | * |
| 4407 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4408 | * |
| 4409 | * |
| 4410 | */ |
| 4411 | |
| 4412 | tSirRetStatus |
| 4413 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4414 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4415 | tSirMacAddr peer) |
| 4416 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4417 | tDot11fMeasurementReport frm; |
| 4418 | tANI_U8 *pFrame; |
| 4419 | tSirRetStatus nSirStatus; |
| 4420 | tpSirMacMgmtHdr pMacHdr; |
| 4421 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4422 | void *pPacket; |
| 4423 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4424 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4425 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4426 | |
| 4427 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4428 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4429 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4430 | |
| 4431 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4432 | { |
| 4433 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4434 | nSirStatus = |
| 4435 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4436 | &frm.MeasurementReport ); |
| 4437 | break; |
| 4438 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4439 | nSirStatus = |
| 4440 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4441 | &frm.MeasurementReport ); |
| 4442 | break; |
| 4443 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4444 | nSirStatus = |
| 4445 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4446 | &frm.MeasurementReport ); |
| 4447 | break; |
| 4448 | default: |
| 4449 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4450 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4451 | pMeasReqFrame->measReqIE.measType ); |
| 4452 | return eSIR_FAILURE; |
| 4453 | } |
| 4454 | |
| 4455 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4456 | |
| 4457 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4458 | if ( DOT11F_FAILED( nStatus ) ) |
| 4459 | { |
| 4460 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4461 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4462 | nStatus ); |
| 4463 | // We'll fall back on the worst case scenario: |
| 4464 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4465 | } |
| 4466 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4467 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4468 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4469 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4470 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4471 | } |
| 4472 | |
| 4473 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4474 | |
| 4475 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4476 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4477 | { |
| 4478 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4479 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | return eSIR_FAILURE; |
| 4481 | } |
| 4482 | |
| 4483 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4484 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | |
| 4486 | // Next, we fill out the buffer descriptor: |
| 4487 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4488 | SIR_MAC_MGMT_ACTION, peer); |
| 4489 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4490 | { |
| 4491 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4492 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4493 | nSirStatus ); |
| 4494 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4495 | return eSIR_FAILURE; // just allocated... |
| 4496 | } |
| 4497 | |
| 4498 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4499 | |
| 4500 | nCfg = 6; |
| 4501 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4502 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4503 | { |
| 4504 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4505 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | nSirStatus ); |
| 4507 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4508 | return eSIR_FAILURE; // just allocated... |
| 4509 | } |
| 4510 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4511 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4512 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4513 | #endif |
| 4514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4515 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4516 | sizeof(tSirMacMgmtHdr), |
| 4517 | nPayload, &nPayload ); |
| 4518 | if ( DOT11F_FAILED( nStatus ) ) |
| 4519 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4520 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4521 | nStatus ); |
| 4522 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4523 | return eSIR_FAILURE; // allocated! |
| 4524 | } |
| 4525 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4526 | { |
| 4527 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4528 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4529 | } |
| 4530 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4531 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4532 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4533 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4534 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4535 | HAL_TXRX_FRM_802_11_MGMT, |
| 4536 | ANI_TXDIR_TODS, |
| 4537 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4538 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4539 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4540 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4541 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4542 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4543 | { |
| 4544 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4545 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4546 | nSirStatus ); |
| 4547 | //Pkt will be freed up by the callback |
| 4548 | return eSIR_FAILURE; // just allocated... |
| 4549 | } |
| 4550 | |
| 4551 | return eSIR_SUCCESS; |
| 4552 | |
| 4553 | } // End limSendMeasReportFrame. |
| 4554 | |
| 4555 | |
| 4556 | /** |
| 4557 | * \brief Send a TPC Request Action frame |
| 4558 | * |
| 4559 | * |
| 4560 | * \param pMac Pointer to the global MAC datastructure |
| 4561 | * |
| 4562 | * \param peer MAC address to which the frame should be sent |
| 4563 | * |
| 4564 | * |
| 4565 | */ |
| 4566 | |
| 4567 | void |
| 4568 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4569 | tSirMacAddr peer) |
| 4570 | { |
| 4571 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4572 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4573 | tSirRetStatus nSirStatus; |
| 4574 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4575 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4576 | void *pPacket; |
| 4577 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4578 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4579 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4580 | |
| 4581 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4582 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4583 | frm.DialogToken.token = 1; |
| 4584 | frm.TPCRequest.present = 1; |
| 4585 | |
| 4586 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4587 | if ( DOT11F_FAILED( nStatus ) ) |
| 4588 | { |
| 4589 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4590 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4591 | nStatus ); |
| 4592 | // We'll fall back on the worst case scenario: |
| 4593 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4594 | } |
| 4595 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4596 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4597 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4598 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4599 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4600 | } |
| 4601 | |
| 4602 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4603 | |
| 4604 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4605 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4606 | { |
| 4607 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4608 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4609 | return; |
| 4610 | } |
| 4611 | |
| 4612 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4613 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | |
| 4615 | // Next, we fill out the buffer descriptor: |
| 4616 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4617 | SIR_MAC_MGMT_ACTION, peer); |
| 4618 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4619 | { |
| 4620 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4621 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4622 | nSirStatus ); |
| 4623 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4624 | return; // just allocated... |
| 4625 | } |
| 4626 | |
| 4627 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4628 | |
| 4629 | nCfg = 6; |
| 4630 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4631 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4632 | { |
| 4633 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4634 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4635 | nSirStatus ); |
| 4636 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4637 | return; // just allocated... |
| 4638 | } |
| 4639 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4640 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4641 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4642 | #endif |
| 4643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4644 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4645 | sizeof(tSirMacMgmtHdr), |
| 4646 | nPayload, &nPayload ); |
| 4647 | if ( DOT11F_FAILED( nStatus ) ) |
| 4648 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4649 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4650 | nStatus ); |
| 4651 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4652 | return; // allocated! |
| 4653 | } |
| 4654 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4655 | { |
| 4656 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4657 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4658 | } |
| 4659 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4660 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4661 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4662 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4663 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4664 | HAL_TXRX_FRM_802_11_MGMT, |
| 4665 | ANI_TXDIR_TODS, |
| 4666 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4667 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4668 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4669 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4670 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4671 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4672 | { |
| 4673 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4674 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4675 | nSirStatus ); |
| 4676 | //Pkt will be freed up by the callback |
| 4677 | return; |
| 4678 | } |
| 4679 | |
| 4680 | } // End limSendTpcRequestFrame. |
| 4681 | |
| 4682 | |
| 4683 | /** |
| 4684 | * \brief Send a TPC Report Action frame |
| 4685 | * |
| 4686 | * |
| 4687 | * \param pMac Pointer to the global MAC datastructure |
| 4688 | * |
| 4689 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4690 | * |
| 4691 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4692 | * |
| 4693 | * |
| 4694 | */ |
| 4695 | |
| 4696 | tSirRetStatus |
| 4697 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4698 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4699 | tSirMacAddr peer) |
| 4700 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4701 | tDot11fTPCReport frm; |
| 4702 | tANI_U8 *pFrame; |
| 4703 | tSirRetStatus nSirStatus; |
| 4704 | tpSirMacMgmtHdr pMacHdr; |
| 4705 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4706 | void *pPacket; |
| 4707 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4708 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4709 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4710 | |
| 4711 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4712 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4713 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4714 | |
| 4715 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4716 | // "misplaced this function, need to replace: |
| 4717 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4718 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4719 | frm.TPCReport.tx_power = 0; |
| 4720 | frm.TPCReport.link_margin = 0; |
| 4721 | frm.TPCReport.present = 1; |
| 4722 | |
| 4723 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4724 | if ( DOT11F_FAILED( nStatus ) ) |
| 4725 | { |
| 4726 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4727 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4728 | nStatus ); |
| 4729 | // We'll fall back on the worst case scenario: |
| 4730 | nPayload = sizeof( tDot11fTPCReport ); |
| 4731 | } |
| 4732 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4733 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4734 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4735 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4736 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4737 | } |
| 4738 | |
| 4739 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4740 | |
| 4741 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4742 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4743 | { |
| 4744 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4745 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4746 | return eSIR_FAILURE; |
| 4747 | } |
| 4748 | |
| 4749 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4750 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4751 | |
| 4752 | // Next, we fill out the buffer descriptor: |
| 4753 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4754 | SIR_MAC_MGMT_ACTION, peer); |
| 4755 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4756 | { |
| 4757 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4758 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4759 | nSirStatus ); |
| 4760 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4761 | return eSIR_FAILURE; // just allocated... |
| 4762 | } |
| 4763 | |
| 4764 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4765 | |
| 4766 | nCfg = 6; |
| 4767 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4768 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4769 | { |
| 4770 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4771 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4772 | nSirStatus ); |
| 4773 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4774 | return eSIR_FAILURE; // just allocated... |
| 4775 | } |
| 4776 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4777 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4778 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4779 | #endif |
| 4780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4781 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4782 | sizeof(tSirMacMgmtHdr), |
| 4783 | nPayload, &nPayload ); |
| 4784 | if ( DOT11F_FAILED( nStatus ) ) |
| 4785 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4786 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4787 | nStatus ); |
| 4788 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4789 | return eSIR_FAILURE; // allocated! |
| 4790 | } |
| 4791 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4792 | { |
| 4793 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4794 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4795 | } |
| 4796 | |
| 4797 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4798 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4799 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4800 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4801 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4802 | HAL_TXRX_FRM_802_11_MGMT, |
| 4803 | ANI_TXDIR_TODS, |
| 4804 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4805 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4806 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4807 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4808 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4809 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4810 | { |
| 4811 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4812 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4813 | nSirStatus ); |
| 4814 | //Pkt will be freed up by the callback |
| 4815 | return eSIR_FAILURE; // just allocated... |
| 4816 | } |
| 4817 | |
| 4818 | return eSIR_SUCCESS; |
| 4819 | |
| 4820 | } // End limSendTpcReportFrame. |
| 4821 | #endif //ANI_SUPPORT_11H |
| 4822 | |
| 4823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | /** |
| 4825 | * \brief Send a Channel Switch Announcement |
| 4826 | * |
| 4827 | * |
| 4828 | * \param pMac Pointer to the global MAC datastructure |
| 4829 | * |
| 4830 | * \param peer MAC address to which this frame will be sent |
| 4831 | * |
| 4832 | * \param nMode |
| 4833 | * |
| 4834 | * \param nNewChannel |
| 4835 | * |
| 4836 | * \param nCount |
| 4837 | * |
| 4838 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4839 | * |
| 4840 | * |
| 4841 | */ |
| 4842 | |
| 4843 | tSirRetStatus |
| 4844 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4845 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4846 | tANI_U8 nMode, |
| 4847 | tANI_U8 nNewChannel, |
| 4848 | tANI_U8 nCount, |
| 4849 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4850 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4851 | tDot11fChannelSwitch frm; |
| 4852 | tANI_U8 *pFrame; |
| 4853 | tSirRetStatus nSirStatus; |
| 4854 | tpSirMacMgmtHdr pMacHdr; |
| 4855 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4856 | void *pPacket; |
| 4857 | eHalStatus halstatus; |
| 4858 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4859 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4860 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4861 | |
| 4862 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4863 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4864 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4865 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4866 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4867 | frm.ChanSwitchAnn.present = 1; |
| 4868 | |
| 4869 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4870 | if ( DOT11F_FAILED( nStatus ) ) |
| 4871 | { |
| 4872 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4873 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4874 | nStatus ); |
| 4875 | // We'll fall back on the worst case scenario: |
| 4876 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4877 | } |
| 4878 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4879 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4880 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4881 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4882 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4883 | } |
| 4884 | |
| 4885 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4886 | |
| 4887 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4888 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4889 | { |
| 4890 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4891 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4892 | return eSIR_FAILURE; |
| 4893 | } |
| 4894 | |
| 4895 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4896 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4897 | |
| 4898 | // Next, we fill out the buffer descriptor: |
| 4899 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4900 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4901 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4902 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4903 | (tANI_U8 *) psessionEntry->bssId, |
| 4904 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4905 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4906 | { |
| 4907 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4908 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4909 | nSirStatus ); |
| 4910 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4911 | return eSIR_FAILURE; // just allocated... |
| 4912 | } |
| 4913 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4914 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4915 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4916 | |
| 4917 | nCfg = 6; |
| 4918 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4919 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4920 | { |
| 4921 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4922 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4923 | nSirStatus ); |
| 4924 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4925 | return eSIR_FAILURE; // just allocated... |
| 4926 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4927 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4928 | |
| 4929 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4930 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4931 | #endif |
| 4932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4933 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4934 | sizeof(tSirMacMgmtHdr), |
| 4935 | nPayload, &nPayload ); |
| 4936 | if ( DOT11F_FAILED( nStatus ) ) |
| 4937 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4938 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4939 | nStatus ); |
| 4940 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4941 | return eSIR_FAILURE; // allocated! |
| 4942 | } |
| 4943 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4944 | { |
| 4945 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4946 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4947 | } |
| 4948 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4949 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4950 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4951 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4952 | ) |
| 4953 | { |
| 4954 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4955 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4956 | |
| 4957 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4958 | psessionEntry->peSessionId, |
| 4959 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4960 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4961 | HAL_TXRX_FRM_802_11_MGMT, |
| 4962 | ANI_TXDIR_TODS, |
| 4963 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4964 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4965 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4966 | psessionEntry->peSessionId, |
| 4967 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4968 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4969 | { |
| 4970 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4971 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4972 | nSirStatus ); |
| 4973 | //Pkt will be freed up by the callback |
| 4974 | return eSIR_FAILURE; |
| 4975 | } |
| 4976 | |
| 4977 | return eSIR_SUCCESS; |
| 4978 | |
| 4979 | } // End limSendChannelSwitchMgmtFrame. |
| 4980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4981 | |
| 4982 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4983 | #ifdef WLAN_FEATURE_11AC |
| 4984 | tSirRetStatus |
| 4985 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 4986 | tSirMacAddr peer, |
| 4987 | tANI_U8 nMode, |
| 4988 | tpPESession psessionEntry ) |
| 4989 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4990 | tDot11fOperatingMode frm; |
| 4991 | tANI_U8 *pFrame; |
| 4992 | tSirRetStatus nSirStatus; |
| 4993 | tpSirMacMgmtHdr pMacHdr; |
| 4994 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 4995 | void *pPacket; |
| 4996 | eHalStatus halstatus; |
| 4997 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4998 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4999 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5000 | |
| 5001 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5002 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5003 | frm.OperatingMode.chanWidth = nMode; |
| 5004 | frm.OperatingMode.rxNSS = 0; |
| 5005 | frm.OperatingMode.rxNSSType = 0; |
| 5006 | |
| 5007 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5008 | if ( DOT11F_FAILED( nStatus ) ) |
| 5009 | { |
| 5010 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5011 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5012 | nStatus ); |
| 5013 | // We'll fall back on the worst case scenario: |
| 5014 | nPayload = sizeof( tDot11fOperatingMode); |
| 5015 | } |
| 5016 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5017 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5018 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5019 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5020 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5021 | } |
| 5022 | |
| 5023 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5024 | |
| 5025 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5026 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5027 | { |
| 5028 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Operating Mode" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5029 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5030 | return eSIR_FAILURE; |
| 5031 | } |
| 5032 | |
| 5033 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5034 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5035 | |
| 5036 | |
| 5037 | // Next, we fill out the buffer descriptor: |
| 5038 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5039 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5040 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5041 | } else |
| 5042 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5043 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5044 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5045 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5046 | (tANI_U8 *) psessionEntry->bssId, |
| 5047 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5048 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5049 | { |
| 5050 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5051 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5052 | nSirStatus ); |
| 5053 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5054 | return eSIR_FAILURE; // just allocated... |
| 5055 | } |
| 5056 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5057 | sizeof(tSirMacMgmtHdr), |
| 5058 | nPayload, &nPayload ); |
| 5059 | if ( DOT11F_FAILED( nStatus ) ) |
| 5060 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5061 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5062 | nStatus ); |
| 5063 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5064 | return eSIR_FAILURE; // allocated! |
| 5065 | } |
| 5066 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5067 | { |
| 5068 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5069 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5070 | } |
| 5071 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5072 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5073 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5074 | ) |
| 5075 | { |
| 5076 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5077 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5078 | |
| 5079 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5080 | psessionEntry->peSessionId, |
| 5081 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5082 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5083 | HAL_TXRX_FRM_802_11_MGMT, |
| 5084 | ANI_TXDIR_TODS, |
| 5085 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5086 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5087 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5088 | psessionEntry->peSessionId, |
| 5089 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5090 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5091 | { |
| 5092 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5093 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5094 | nSirStatus ); |
| 5095 | //Pkt will be freed up by the callback |
| 5096 | return eSIR_FAILURE; |
| 5097 | } |
| 5098 | |
| 5099 | return eSIR_SUCCESS; |
| 5100 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5101 | |
| 5102 | /** |
| 5103 | * \brief Send a VHT Channel Switch Announcement |
| 5104 | * |
| 5105 | * |
| 5106 | * \param pMac Pointer to the global MAC datastructure |
| 5107 | * |
| 5108 | * \param peer MAC address to which this frame will be sent |
| 5109 | * |
| 5110 | * \param nChanWidth |
| 5111 | * |
| 5112 | * \param nNewChannel |
| 5113 | * |
| 5114 | * |
| 5115 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5116 | * |
| 5117 | * |
| 5118 | */ |
| 5119 | |
| 5120 | tSirRetStatus |
| 5121 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5122 | tSirMacAddr peer, |
| 5123 | tANI_U8 nChanWidth, |
| 5124 | tANI_U8 nNewChannel, |
| 5125 | tANI_U8 ncbMode, |
| 5126 | tpPESession psessionEntry ) |
| 5127 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5128 | tDot11fChannelSwitch frm; |
| 5129 | tANI_U8 *pFrame; |
| 5130 | tSirRetStatus nSirStatus; |
| 5131 | tpSirMacMgmtHdr pMacHdr; |
| 5132 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5133 | void *pPacket; |
| 5134 | eHalStatus halstatus; |
| 5135 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5136 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5137 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5138 | |
| 5139 | |
| 5140 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5141 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5142 | frm.ChanSwitchAnn.switchMode = 1; |
| 5143 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5144 | frm.ChanSwitchAnn.switchCount = 1; |
| 5145 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5146 | frm.ExtChanSwitchAnn.present = 1; |
| 5147 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5148 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5149 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5150 | frm.ChanSwitchAnn.present = 1; |
| 5151 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5152 | |
| 5153 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5154 | if ( DOT11F_FAILED( nStatus ) ) |
| 5155 | { |
| 5156 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5157 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5158 | nStatus ); |
| 5159 | // We'll fall back on the worst case scenario: |
| 5160 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5161 | } |
| 5162 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5163 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5164 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5165 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5166 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5167 | } |
| 5168 | |
| 5169 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5170 | |
| 5171 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5172 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5173 | { |
| 5174 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5175 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5176 | return eSIR_FAILURE; |
| 5177 | } |
| 5178 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5179 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5180 | |
| 5181 | // Next, we fill out the buffer descriptor: |
| 5182 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5183 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5184 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5185 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5186 | (tANI_U8 *) psessionEntry->bssId, |
| 5187 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5188 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5189 | { |
| 5190 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5191 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5192 | nSirStatus ); |
| 5193 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5194 | return eSIR_FAILURE; // just allocated... |
| 5195 | } |
| 5196 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5197 | sizeof(tSirMacMgmtHdr), |
| 5198 | nPayload, &nPayload ); |
| 5199 | if ( DOT11F_FAILED( nStatus ) ) |
| 5200 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5201 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5202 | nStatus ); |
| 5203 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5204 | return eSIR_FAILURE; // allocated! |
| 5205 | } |
| 5206 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5207 | { |
| 5208 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5209 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5210 | } |
| 5211 | |
| 5212 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5213 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5214 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5215 | ) |
| 5216 | { |
| 5217 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5218 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5219 | |
| 5220 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5221 | psessionEntry->peSessionId, |
| 5222 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5223 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5224 | HAL_TXRX_FRM_802_11_MGMT, |
| 5225 | ANI_TXDIR_TODS, |
| 5226 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5227 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5228 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5229 | psessionEntry->peSessionId, |
| 5230 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5231 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5232 | { |
| 5233 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5234 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5235 | nSirStatus ); |
| 5236 | //Pkt will be freed up by the callback |
| 5237 | return eSIR_FAILURE; |
| 5238 | } |
| 5239 | |
| 5240 | return eSIR_SUCCESS; |
| 5241 | |
| 5242 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5243 | |
| 5244 | |
| 5245 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5246 | #endif |
| 5247 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | /** |
| 5249 | * \brief Send an ADDBA Req Action Frame to peer |
| 5250 | * |
| 5251 | * \sa limSendAddBAReq |
| 5252 | * |
| 5253 | * \param pMac The global tpAniSirGlobal object |
| 5254 | * |
| 5255 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5256 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5257 | * Frame to the peer |
| 5258 | * |
| 5259 | * \return eSIR_SUCCESS if setup completes successfully |
| 5260 | * eSIR_FAILURE is some problem is encountered |
| 5261 | */ |
| 5262 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5263 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5264 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5265 | tDot11fAddBAReq frmAddBAReq; |
| 5266 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5267 | tpSirMacMgmtHdr pMacHdr; |
| 5268 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5269 | tSirRetStatus statusCode; |
| 5270 | eHalStatus halStatus; |
| 5271 | void *pPacket; |
| 5272 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5273 | |
| 5274 | if(NULL == psessionEntry) |
| 5275 | { |
| 5276 | return eSIR_FAILURE; |
| 5277 | } |
| 5278 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5279 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5280 | |
| 5281 | // Category - 3 (BA) |
| 5282 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5283 | |
| 5284 | // Action - 0 (ADDBA Req) |
| 5285 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5286 | |
| 5287 | // FIXME - Dialog Token, generalize this... |
| 5288 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5289 | |
| 5290 | // Fill the ADDBA Parameter Set |
| 5291 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5292 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5293 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5294 | |
| 5295 | // BA timeout |
| 5296 | // 0 - indicates no BA timeout |
| 5297 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5298 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5299 | /* Send SSN whatever we get from FW. |
| 5300 | */ |
| 5301 | frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5302 | |
| 5303 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5304 | |
| 5305 | if( DOT11F_FAILED( nStatus )) |
| 5306 | { |
| 5307 | limLog( pMac, LOGW, |
| 5308 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5309 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5310 | nStatus ); |
| 5311 | |
| 5312 | // We'll fall back on the worst case scenario: |
| 5313 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5314 | } |
| 5315 | else if( DOT11F_WARNED( nStatus )) |
| 5316 | { |
| 5317 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5318 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5319 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5320 | nStatus ); |
| 5321 | } |
| 5322 | |
| 5323 | // Add the MGMT header to frame length |
| 5324 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5325 | |
| 5326 | // Need to allocate a buffer for ADDBA AF |
| 5327 | if( eHAL_STATUS_SUCCESS != |
| 5328 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5329 | HAL_TXRX_FRM_802_11_MGMT, |
| 5330 | (tANI_U16) frameLen, |
| 5331 | (void **) &pAddBAReqBuffer, |
| 5332 | (void **) &pPacket ))) |
| 5333 | { |
| 5334 | // Log error |
| 5335 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5336 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5337 | frameLen, |
| 5338 | halStatus ); |
| 5339 | |
| 5340 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5341 | goto returnAfterError; |
| 5342 | } |
| 5343 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5344 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5345 | |
| 5346 | // Copy necessary info to BD |
| 5347 | if( eSIR_SUCCESS != |
| 5348 | (statusCode = limPopulateMacHeader( pMac, |
| 5349 | pAddBAReqBuffer, |
| 5350 | SIR_MAC_MGMT_FRAME, |
| 5351 | SIR_MAC_MGMT_ACTION, |
| 5352 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5353 | goto returnAfterError; |
| 5354 | |
| 5355 | // Update A3 with the BSSID |
| 5356 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5357 | |
| 5358 | #if 0 |
| 5359 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5360 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5361 | WNI_CFG_BSSID, |
| 5362 | (tANI_U8 *) pMacHdr->bssId, |
| 5363 | &cfgLen )) |
| 5364 | { |
| 5365 | limLog( pMac, LOGP, |
| 5366 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5367 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | |
| 5369 | // FIXME - Need to convert to tSirRetStatus |
| 5370 | statusCode = eSIR_FAILURE; |
| 5371 | goto returnAfterError; |
| 5372 | } |
| 5373 | #endif//TO SUPPORT BT-AMP |
| 5374 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5375 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5376 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5377 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5378 | #endif |
| 5379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5380 | // Now, we're ready to "pack" the frames |
| 5381 | nStatus = dot11fPackAddBAReq( pMac, |
| 5382 | &frmAddBAReq, |
| 5383 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5384 | nPayload, |
| 5385 | &nPayload ); |
| 5386 | |
| 5387 | if( DOT11F_FAILED( nStatus )) |
| 5388 | { |
| 5389 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5390 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5391 | nStatus ); |
| 5392 | |
| 5393 | // FIXME - Need to convert to tSirRetStatus |
| 5394 | statusCode = eSIR_FAILURE; |
| 5395 | goto returnAfterError; |
| 5396 | } |
| 5397 | else if( DOT11F_WARNED( nStatus )) |
| 5398 | { |
| 5399 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5400 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5401 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5402 | } |
| 5403 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5404 | limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with" |
| 5405 | " tid = %d policy = %d buffsize = %d " |
| 5406 | " amsduSupported = %d"), |
| 5407 | MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr), |
| 5408 | frmAddBAReq.AddBAParameterSet.tid, |
| 5409 | frmAddBAReq.AddBAParameterSet.policy, |
| 5410 | frmAddBAReq.AddBAParameterSet.bufferSize, |
| 5411 | frmAddBAReq.AddBAParameterSet.amsduSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5412 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5413 | limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ), |
| 5414 | frmAddBAReq.BAStartingSequenceControl.ssn, |
| 5415 | frmAddBAReq.BAStartingSequenceControl.fragNumber); |
| 5416 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5417 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5418 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5419 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5420 | ) |
| 5421 | { |
| 5422 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5423 | } |
| 5424 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5425 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5426 | psessionEntry->peSessionId, |
| 5427 | pMacHdr->fc.subType)); |
| 5428 | halStatus = halTxFrame( pMac, |
| 5429 | pPacket, |
| 5430 | (tANI_U16) frameLen, |
| 5431 | HAL_TXRX_FRM_802_11_MGMT, |
| 5432 | ANI_TXDIR_TODS, |
| 5433 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5434 | limTxComplete, |
| 5435 | pAddBAReqBuffer, txFlag ); |
| 5436 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5437 | psessionEntry->peSessionId, |
| 5438 | halStatus)); |
| 5439 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5440 | { |
| 5441 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5442 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5443 | halStatus ); |
| 5444 | |
| 5445 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5446 | statusCode = eSIR_FAILURE; |
| 5447 | //Pkt will be freed up by the callback |
| 5448 | return statusCode; |
| 5449 | } |
| 5450 | else |
| 5451 | return eSIR_SUCCESS; |
| 5452 | |
| 5453 | returnAfterError: |
| 5454 | |
| 5455 | // Release buffer, if allocated |
| 5456 | if( NULL != pAddBAReqBuffer ) |
| 5457 | palPktFree( pMac->hHdd, |
| 5458 | HAL_TXRX_FRM_802_11_MGMT, |
| 5459 | (void *) pAddBAReqBuffer, |
| 5460 | (void *) pPacket ); |
| 5461 | |
| 5462 | return statusCode; |
| 5463 | } |
| 5464 | |
| 5465 | /** |
| 5466 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5467 | * |
| 5468 | * \sa limSendAddBARsp |
| 5469 | * |
| 5470 | * \param pMac The global tpAniSirGlobal object |
| 5471 | * |
| 5472 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5473 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5474 | * Frame to the peer |
| 5475 | * |
| 5476 | * \return eSIR_SUCCESS if setup completes successfully |
| 5477 | * eSIR_FAILURE is some problem is encountered |
| 5478 | */ |
| 5479 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5480 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5481 | tpPESession psessionEntry) |
| 5482 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5483 | tDot11fAddBARsp frmAddBARsp; |
| 5484 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5485 | tpSirMacMgmtHdr pMacHdr; |
| 5486 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5487 | tSirRetStatus statusCode; |
| 5488 | eHalStatus halStatus; |
| 5489 | void *pPacket; |
| 5490 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5491 | |
| 5492 | if(NULL == psessionEntry) |
| 5493 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5494 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5495 | return eSIR_FAILURE; |
| 5496 | } |
| 5497 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5498 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5499 | |
| 5500 | // Category - 3 (BA) |
| 5501 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5502 | // Action - 1 (ADDBA Rsp) |
| 5503 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5504 | |
| 5505 | // Should be same as the one we received in the ADDBA Req |
| 5506 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5507 | |
| 5508 | // ADDBA Req status |
| 5509 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5510 | |
| 5511 | // Fill the ADDBA Parameter Set as provided by caller |
| 5512 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5513 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5514 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5515 | |
| 5516 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5517 | { |
| 5518 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5519 | psessionEntry->amsduSupportedInBA; |
| 5520 | } |
| 5521 | else |
| 5522 | { |
| 5523 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5524 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5525 | |
| 5526 | // BA timeout |
| 5527 | // 0 - indicates no BA timeout |
| 5528 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5529 | |
| 5530 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5531 | |
| 5532 | if( DOT11F_FAILED( nStatus )) |
| 5533 | { |
| 5534 | limLog( pMac, LOGW, |
| 5535 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5536 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5537 | nStatus ); |
| 5538 | |
| 5539 | // We'll fall back on the worst case scenario: |
| 5540 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5541 | } |
| 5542 | else if( DOT11F_WARNED( nStatus )) |
| 5543 | { |
| 5544 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5545 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5546 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5547 | nStatus ); |
| 5548 | } |
| 5549 | |
| 5550 | // Need to allocate a buffer for ADDBA AF |
| 5551 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5552 | |
| 5553 | // Allocate shared memory |
| 5554 | if( eHAL_STATUS_SUCCESS != |
| 5555 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5556 | HAL_TXRX_FRM_802_11_MGMT, |
| 5557 | (tANI_U16) frameLen, |
| 5558 | (void **) &pAddBARspBuffer, |
| 5559 | (void **) &pPacket ))) |
| 5560 | { |
| 5561 | // Log error |
| 5562 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5563 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5564 | frameLen, |
| 5565 | halStatus ); |
| 5566 | |
| 5567 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5568 | goto returnAfterError; |
| 5569 | } |
| 5570 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5571 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5572 | |
| 5573 | // Copy necessary info to BD |
| 5574 | if( eSIR_SUCCESS != |
| 5575 | (statusCode = limPopulateMacHeader( pMac, |
| 5576 | pAddBARspBuffer, |
| 5577 | SIR_MAC_MGMT_FRAME, |
| 5578 | SIR_MAC_MGMT_ACTION, |
| 5579 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5580 | goto returnAfterError; |
| 5581 | |
| 5582 | // Update A3 with the BSSID |
| 5583 | |
| 5584 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5585 | |
| 5586 | #if 0 |
| 5587 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5588 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5589 | WNI_CFG_BSSID, |
| 5590 | (tANI_U8 *) pMacHdr->bssId, |
| 5591 | &cfgLen )) |
| 5592 | { |
| 5593 | limLog( pMac, LOGP, |
| 5594 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5595 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5596 | |
| 5597 | // FIXME - Need to convert to tSirRetStatus |
| 5598 | statusCode = eSIR_FAILURE; |
| 5599 | goto returnAfterError; |
| 5600 | } |
| 5601 | #endif // TO SUPPORT BT-AMP |
| 5602 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5603 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5604 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5605 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5606 | #endif |
| 5607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5608 | // Now, we're ready to "pack" the frames |
| 5609 | nStatus = dot11fPackAddBARsp( pMac, |
| 5610 | &frmAddBARsp, |
| 5611 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5612 | nPayload, |
| 5613 | &nPayload ); |
| 5614 | |
| 5615 | if( DOT11F_FAILED( nStatus )) |
| 5616 | { |
| 5617 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5618 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5619 | nStatus ); |
| 5620 | |
| 5621 | // FIXME - Need to convert to tSirRetStatus |
| 5622 | statusCode = eSIR_FAILURE; |
| 5623 | goto returnAfterError; |
| 5624 | } |
| 5625 | else if( DOT11F_WARNED( nStatus )) |
| 5626 | { |
| 5627 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5628 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5629 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5630 | } |
| 5631 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5632 | limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with" |
| 5633 | " tid = %d policy = %d buffsize = %d" |
| 5634 | " amsduSupported = %d status %d"), |
| 5635 | MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr), |
| 5636 | frmAddBARsp.AddBAParameterSet.tid, |
| 5637 | frmAddBARsp.AddBAParameterSet.policy, |
| 5638 | frmAddBARsp.AddBAParameterSet.bufferSize, |
| 5639 | frmAddBARsp.AddBAParameterSet.amsduSupported, |
| 5640 | frmAddBARsp.Status.status); |
| 5641 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5642 | |
| 5643 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5644 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5645 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5646 | ) |
| 5647 | { |
| 5648 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5649 | } |
| 5650 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5651 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5652 | psessionEntry->peSessionId, |
| 5653 | pMacHdr->fc.subType)); |
| 5654 | halStatus = halTxFrame( pMac, |
| 5655 | pPacket, |
| 5656 | (tANI_U16) frameLen, |
| 5657 | HAL_TXRX_FRM_802_11_MGMT, |
| 5658 | ANI_TXDIR_TODS, |
| 5659 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5660 | limTxComplete, |
| 5661 | pAddBARspBuffer, txFlag ); |
| 5662 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5663 | psessionEntry->peSessionId, |
| 5664 | halStatus)); |
| 5665 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5666 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5667 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5668 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | halStatus ); |
| 5670 | |
| 5671 | // FIXME - HAL error codes are different from PE error |
| 5672 | // codes!! And, this routine is returning tSirRetStatus |
| 5673 | statusCode = eSIR_FAILURE; |
| 5674 | //Pkt will be freed up by the callback |
| 5675 | return statusCode; |
| 5676 | } |
| 5677 | else |
| 5678 | return eSIR_SUCCESS; |
| 5679 | |
| 5680 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5681 | // Release buffer, if allocated |
| 5682 | if( NULL != pAddBARspBuffer ) |
| 5683 | palPktFree( pMac->hHdd, |
| 5684 | HAL_TXRX_FRM_802_11_MGMT, |
| 5685 | (void *) pAddBARspBuffer, |
| 5686 | (void *) pPacket ); |
| 5687 | |
| 5688 | return statusCode; |
| 5689 | } |
| 5690 | |
| 5691 | /** |
| 5692 | * \brief Send a DELBA Indication Action Frame to peer |
| 5693 | * |
| 5694 | * \sa limSendDelBAInd |
| 5695 | * |
| 5696 | * \param pMac The global tpAniSirGlobal object |
| 5697 | * |
| 5698 | * \param peerMacAddr MAC Address of peer |
| 5699 | * |
| 5700 | * \param reasonCode Reason for the DELBA notification |
| 5701 | * |
| 5702 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5703 | * This identifies the TID for which the BA session is |
| 5704 | * being deleted. |
| 5705 | * |
| 5706 | * \return eSIR_SUCCESS if setup completes successfully |
| 5707 | * eSIR_FAILURE is some problem is encountered |
| 5708 | */ |
| 5709 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5710 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5711 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5712 | tDot11fDelBAInd frmDelBAInd; |
| 5713 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5714 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5715 | tpSirMacMgmtHdr pMacHdr; |
| 5716 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5717 | tSirRetStatus statusCode; |
| 5718 | eHalStatus halStatus; |
| 5719 | void *pPacket; |
| 5720 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5721 | |
| 5722 | if(NULL == psessionEntry) |
| 5723 | { |
| 5724 | return eSIR_FAILURE; |
| 5725 | } |
| 5726 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5727 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5728 | |
| 5729 | // Category - 3 (BA) |
| 5730 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5731 | // Action - 2 (DELBA) |
| 5732 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5733 | |
| 5734 | // Fill the DELBA Parameter Set as provided by caller |
| 5735 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5736 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5737 | |
| 5738 | // BA Starting Sequence Number |
| 5739 | // Fragment number will always be zero |
| 5740 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5741 | |
| 5742 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5743 | |
| 5744 | if( DOT11F_FAILED( nStatus )) |
| 5745 | { |
| 5746 | limLog( pMac, LOGW, |
| 5747 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5748 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5749 | nStatus ); |
| 5750 | |
| 5751 | // We'll fall back on the worst case scenario: |
| 5752 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5753 | } |
| 5754 | else if( DOT11F_WARNED( nStatus )) |
| 5755 | { |
| 5756 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5757 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5758 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5759 | nStatus ); |
| 5760 | } |
| 5761 | |
| 5762 | // Add the MGMT header to frame length |
| 5763 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5764 | |
| 5765 | // Allocate shared memory |
| 5766 | if( eHAL_STATUS_SUCCESS != |
| 5767 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5768 | HAL_TXRX_FRM_802_11_MGMT, |
| 5769 | (tANI_U16) frameLen, |
| 5770 | (void **) &pDelBAIndBuffer, |
| 5771 | (void **) &pPacket ))) |
| 5772 | { |
| 5773 | // Log error |
| 5774 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5775 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5776 | frameLen, |
| 5777 | halStatus ); |
| 5778 | |
| 5779 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5780 | goto returnAfterError; |
| 5781 | } |
| 5782 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5783 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5784 | |
| 5785 | // Copy necessary info to BD |
| 5786 | if( eSIR_SUCCESS != |
| 5787 | (statusCode = limPopulateMacHeader( pMac, |
| 5788 | pDelBAIndBuffer, |
| 5789 | SIR_MAC_MGMT_FRAME, |
| 5790 | SIR_MAC_MGMT_ACTION, |
| 5791 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5792 | goto returnAfterError; |
| 5793 | |
| 5794 | // Update A3 with the BSSID |
| 5795 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5796 | |
| 5797 | #if 0 |
| 5798 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5799 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5800 | WNI_CFG_BSSID, |
| 5801 | (tANI_U8 *) pMacHdr->bssId, |
| 5802 | &cfgLen )) |
| 5803 | { |
| 5804 | limLog( pMac, LOGP, |
| 5805 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5806 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5807 | |
| 5808 | // FIXME - Need to convert to tSirRetStatus |
| 5809 | statusCode = eSIR_FAILURE; |
| 5810 | goto returnAfterError; |
| 5811 | } |
| 5812 | #endif //TO SUPPORT BT-AMP |
| 5813 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5814 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5815 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5816 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5817 | #endif |
| 5818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5819 | // Now, we're ready to "pack" the frames |
| 5820 | nStatus = dot11fPackDelBAInd( pMac, |
| 5821 | &frmDelBAInd, |
| 5822 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5823 | nPayload, |
| 5824 | &nPayload ); |
| 5825 | |
| 5826 | if( DOT11F_FAILED( nStatus )) |
| 5827 | { |
| 5828 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5829 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5830 | nStatus ); |
| 5831 | |
| 5832 | // FIXME - Need to convert to tSirRetStatus |
| 5833 | statusCode = eSIR_FAILURE; |
| 5834 | goto returnAfterError; |
| 5835 | } |
| 5836 | else if( DOT11F_WARNED( nStatus )) |
| 5837 | { |
| 5838 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5839 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5840 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5841 | } |
| 5842 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5843 | limLog( pMac, LOG1, |
| 5844 | FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d" |
| 5845 | " initiator = %d reason = %d" ), |
| 5846 | MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr), |
| 5847 | frmDelBAInd.DelBAParameterSet.tid, |
| 5848 | frmDelBAInd.DelBAParameterSet.initiator, |
| 5849 | frmDelBAInd.Reason.code); |
| 5850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5851 | |
| 5852 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5853 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5854 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5855 | ) |
| 5856 | { |
| 5857 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5858 | } |
| 5859 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5860 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5861 | psessionEntry->peSessionId, |
| 5862 | pMacHdr->fc.subType)); |
| 5863 | halStatus = halTxFrame( pMac, |
| 5864 | pPacket, |
| 5865 | (tANI_U16) frameLen, |
| 5866 | HAL_TXRX_FRM_802_11_MGMT, |
| 5867 | ANI_TXDIR_TODS, |
| 5868 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5869 | limTxComplete, |
| 5870 | pDelBAIndBuffer, txFlag ); |
| 5871 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5872 | psessionEntry->peSessionId, |
| 5873 | halStatus)); |
| 5874 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5875 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5876 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5877 | statusCode = eSIR_FAILURE; |
| 5878 | //Pkt will be freed up by the callback |
| 5879 | return statusCode; |
| 5880 | } |
| 5881 | else |
| 5882 | return eSIR_SUCCESS; |
| 5883 | |
| 5884 | returnAfterError: |
| 5885 | |
| 5886 | // Release buffer, if allocated |
| 5887 | if( NULL != pDelBAIndBuffer ) |
| 5888 | palPktFree( pMac->hHdd, |
| 5889 | HAL_TXRX_FRM_802_11_MGMT, |
| 5890 | (void *) pDelBAIndBuffer, |
| 5891 | (void *) pPacket ); |
| 5892 | |
| 5893 | return statusCode; |
| 5894 | } |
| 5895 | |
| 5896 | #if defined WLAN_FEATURE_VOWIFI |
| 5897 | |
| 5898 | /** |
| 5899 | * \brief Send a Neighbor Report Request Action frame |
| 5900 | * |
| 5901 | * |
| 5902 | * \param pMac Pointer to the global MAC structure |
| 5903 | * |
| 5904 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5905 | * |
| 5906 | * \param peer mac address of peer station. |
| 5907 | * |
| 5908 | * \param psessionEntry address of session entry. |
| 5909 | * |
| 5910 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5911 | * |
| 5912 | * |
| 5913 | */ |
| 5914 | |
| 5915 | tSirRetStatus |
| 5916 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5917 | tpSirMacNeighborReportReq pNeighborReq, |
| 5918 | tSirMacAddr peer, |
| 5919 | tpPESession psessionEntry |
| 5920 | ) |
| 5921 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5922 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5923 | tDot11fNeighborReportRequest frm; |
| 5924 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5925 | tpSirMacMgmtHdr pMacHdr; |
| 5926 | tANI_U32 nBytes, nPayload, nStatus; |
| 5927 | void *pPacket; |
| 5928 | eHalStatus halstatus; |
| 5929 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | |
| 5931 | if ( psessionEntry == NULL ) |
| 5932 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5933 | limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5934 | return eSIR_FAILURE; |
| 5935 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5936 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5937 | |
| 5938 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5939 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5940 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5941 | |
| 5942 | |
| 5943 | if( pNeighborReq->ssid_present ) |
| 5944 | { |
| 5945 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5946 | } |
| 5947 | |
| 5948 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5949 | if ( DOT11F_FAILED( nStatus ) ) |
| 5950 | { |
| 5951 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5952 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5953 | nStatus ); |
| 5954 | // We'll fall back on the worst case scenario: |
| 5955 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5956 | } |
| 5957 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5958 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5959 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5960 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5961 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5962 | } |
| 5963 | |
| 5964 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5965 | |
| 5966 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5967 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5968 | { |
| 5969 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5970 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5971 | return eSIR_FAILURE; |
| 5972 | } |
| 5973 | |
| 5974 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5975 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | |
| 5977 | // Copy necessary info to BD |
| 5978 | if( eSIR_SUCCESS != |
| 5979 | (statusCode = limPopulateMacHeader( pMac, |
| 5980 | pFrame, |
| 5981 | SIR_MAC_MGMT_FRAME, |
| 5982 | SIR_MAC_MGMT_ACTION, |
| 5983 | peer, psessionEntry->selfMacAddr))) |
| 5984 | goto returnAfterError; |
| 5985 | |
| 5986 | // Update A3 with the BSSID |
| 5987 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5988 | |
| 5989 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5990 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5991 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5992 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5993 | #endif |
| 5994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5995 | // Now, we're ready to "pack" the frames |
| 5996 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 5997 | &frm, |
| 5998 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5999 | nPayload, |
| 6000 | &nPayload ); |
| 6001 | |
| 6002 | if( DOT11F_FAILED( nStatus )) |
| 6003 | { |
| 6004 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6005 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6006 | nStatus ); |
| 6007 | |
| 6008 | // FIXME - Need to convert to tSirRetStatus |
| 6009 | statusCode = eSIR_FAILURE; |
| 6010 | goto returnAfterError; |
| 6011 | } |
| 6012 | else if( DOT11F_WARNED( nStatus )) |
| 6013 | { |
| 6014 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6015 | FL( "There were warnings while packing Neighbor Report " |
| 6016 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6017 | } |
| 6018 | |
| 6019 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6020 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6022 | |
| 6023 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6024 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6025 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6026 | ) |
| 6027 | { |
| 6028 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6029 | } |
| 6030 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6031 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6032 | psessionEntry->peSessionId, |
| 6033 | pMacHdr->fc.subType)); |
| 6034 | halstatus = halTxFrame( pMac, |
| 6035 | pPacket, |
| 6036 | (tANI_U16) nBytes, |
| 6037 | HAL_TXRX_FRM_802_11_MGMT, |
| 6038 | ANI_TXDIR_TODS, |
| 6039 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6040 | limTxComplete, |
| 6041 | pFrame, txFlag ); |
| 6042 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6043 | psessionEntry->peSessionId, |
| 6044 | halstatus)); |
| 6045 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6046 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6047 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6048 | statusCode = eSIR_FAILURE; |
| 6049 | //Pkt will be freed up by the callback |
| 6050 | return statusCode; |
| 6051 | } |
| 6052 | else |
| 6053 | return eSIR_SUCCESS; |
| 6054 | |
| 6055 | returnAfterError: |
| 6056 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6057 | |
| 6058 | return statusCode; |
| 6059 | } // End limSendNeighborReportRequestFrame. |
| 6060 | |
| 6061 | /** |
| 6062 | * \brief Send a Link Report Action frame |
| 6063 | * |
| 6064 | * |
| 6065 | * \param pMac Pointer to the global MAC structure |
| 6066 | * |
| 6067 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6068 | * |
| 6069 | * \param peer mac address of peer station. |
| 6070 | * |
| 6071 | * \param psessionEntry address of session entry. |
| 6072 | * |
| 6073 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6074 | * |
| 6075 | * |
| 6076 | */ |
| 6077 | |
| 6078 | tSirRetStatus |
| 6079 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6080 | tpSirMacLinkReport pLinkReport, |
| 6081 | tSirMacAddr peer, |
| 6082 | tpPESession psessionEntry |
| 6083 | ) |
| 6084 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6085 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6086 | tDot11fLinkMeasurementReport frm; |
| 6087 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6088 | tpSirMacMgmtHdr pMacHdr; |
| 6089 | tANI_U32 nBytes, nPayload, nStatus; |
| 6090 | void *pPacket; |
| 6091 | eHalStatus halstatus; |
| 6092 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6093 | |
| 6094 | |
| 6095 | if ( psessionEntry == NULL ) |
| 6096 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6097 | limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6098 | return eSIR_FAILURE; |
| 6099 | } |
| 6100 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6101 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6102 | |
| 6103 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6104 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6105 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6106 | |
| 6107 | |
| 6108 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6109 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6110 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6111 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6112 | //such case this way than changing the frame parser. |
| 6113 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6114 | frm.TPCEleLen.TPCLen = 2; |
| 6115 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6116 | frm.LinkMargin.linkMargin = 0; |
| 6117 | |
| 6118 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6119 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6120 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6121 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6122 | |
| 6123 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6124 | if ( DOT11F_FAILED( nStatus ) ) |
| 6125 | { |
| 6126 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6127 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6128 | nStatus ); |
| 6129 | // We'll fall back on the worst case scenario: |
| 6130 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6131 | } |
| 6132 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6133 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6134 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6135 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6136 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6137 | } |
| 6138 | |
| 6139 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6140 | |
| 6141 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6142 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6143 | { |
| 6144 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6145 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6146 | return eSIR_FAILURE; |
| 6147 | } |
| 6148 | |
| 6149 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6150 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6151 | |
| 6152 | // Copy necessary info to BD |
| 6153 | if( eSIR_SUCCESS != |
| 6154 | (statusCode = limPopulateMacHeader( pMac, |
| 6155 | pFrame, |
| 6156 | SIR_MAC_MGMT_FRAME, |
| 6157 | SIR_MAC_MGMT_ACTION, |
| 6158 | peer, psessionEntry->selfMacAddr))) |
| 6159 | goto returnAfterError; |
| 6160 | |
| 6161 | // Update A3 with the BSSID |
| 6162 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6163 | |
| 6164 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6165 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6166 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6167 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6168 | #endif |
| 6169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6170 | // Now, we're ready to "pack" the frames |
| 6171 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6172 | &frm, |
| 6173 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6174 | nPayload, |
| 6175 | &nPayload ); |
| 6176 | |
| 6177 | if( DOT11F_FAILED( nStatus )) |
| 6178 | { |
| 6179 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6180 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6181 | nStatus ); |
| 6182 | |
| 6183 | // FIXME - Need to convert to tSirRetStatus |
| 6184 | statusCode = eSIR_FAILURE; |
| 6185 | goto returnAfterError; |
| 6186 | } |
| 6187 | else if( DOT11F_WARNED( nStatus )) |
| 6188 | { |
| 6189 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6190 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6191 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6192 | } |
| 6193 | |
| 6194 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6195 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6196 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6197 | |
| 6198 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6199 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6200 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6201 | ) |
| 6202 | { |
| 6203 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6204 | } |
| 6205 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6206 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6207 | psessionEntry->peSessionId, |
| 6208 | pMacHdr->fc.subType)); |
| 6209 | halstatus = halTxFrame( pMac, |
| 6210 | pPacket, |
| 6211 | (tANI_U16) nBytes, |
| 6212 | HAL_TXRX_FRM_802_11_MGMT, |
| 6213 | ANI_TXDIR_TODS, |
| 6214 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6215 | limTxComplete, |
| 6216 | pFrame, txFlag ); |
| 6217 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6218 | psessionEntry->peSessionId, |
| 6219 | halstatus)); |
| 6220 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6221 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6222 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6223 | statusCode = eSIR_FAILURE; |
| 6224 | //Pkt will be freed up by the callback |
| 6225 | return statusCode; |
| 6226 | } |
| 6227 | else |
| 6228 | return eSIR_SUCCESS; |
| 6229 | |
| 6230 | returnAfterError: |
| 6231 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6232 | |
| 6233 | return statusCode; |
| 6234 | } // End limSendLinkReportActionFrame. |
| 6235 | |
| 6236 | /** |
| 6237 | * \brief Send a Beacon Report Action frame |
| 6238 | * |
| 6239 | * |
| 6240 | * \param pMac Pointer to the global MAC structure |
| 6241 | * |
| 6242 | * \param dialog_token dialog token to be used in the action frame. |
| 6243 | * |
| 6244 | * \param num_report number of reports in pRRMReport. |
| 6245 | * |
| 6246 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6247 | * |
| 6248 | * \param peer mac address of peer station. |
| 6249 | * |
| 6250 | * \param psessionEntry address of session entry. |
| 6251 | * |
| 6252 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6253 | * |
| 6254 | * |
| 6255 | */ |
| 6256 | |
| 6257 | tSirRetStatus |
| 6258 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6259 | tANI_U8 dialog_token, |
| 6260 | tANI_U8 num_report, |
| 6261 | tpSirMacRadioMeasureReport pRRMReport, |
| 6262 | tSirMacAddr peer, |
| 6263 | tpPESession psessionEntry |
| 6264 | ) |
| 6265 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6266 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6267 | tANI_U8 *pFrame; |
| 6268 | tpSirMacMgmtHdr pMacHdr; |
| 6269 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6271 | eHalStatus halstatus; |
| 6272 | tANI_U8 i; |
| 6273 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6274 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6275 | tDot11fRadioMeasurementReport *frm = |
| 6276 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6277 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6278 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6279 | return eSIR_FAILURE; |
| 6280 | } |
| 6281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6282 | if ( psessionEntry == NULL ) |
| 6283 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6284 | limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6285 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6286 | return eSIR_FAILURE; |
| 6287 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6288 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6289 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6290 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6291 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6292 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6293 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6294 | frm->num_MeasurementReport = (num_report > RADIO_REPORTS_MAX_IN_A_FRAME ) ? RADIO_REPORTS_MAX_IN_A_FRAME : num_report; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6295 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6296 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6297 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6298 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6299 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6300 | frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6301 | switch( pRRMReport[i].type ) |
| 6302 | { |
| 6303 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6304 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6305 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6306 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6307 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6308 | break; |
| 6309 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6310 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6311 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6312 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | break; |
| 6314 | } |
| 6315 | } |
| 6316 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6317 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6318 | if ( DOT11F_FAILED( nStatus ) ) |
| 6319 | { |
| 6320 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6321 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6322 | nStatus ); |
| 6323 | // We'll fall back on the worst case scenario: |
| 6324 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6325 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6326 | return eSIR_FAILURE; |
| 6327 | } |
| 6328 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6329 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6330 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6331 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6332 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | } |
| 6334 | |
| 6335 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6336 | |
| 6337 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6338 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6339 | { |
| 6340 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6341 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6342 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6343 | return eSIR_FAILURE; |
| 6344 | } |
| 6345 | |
| 6346 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6347 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | |
| 6349 | // Copy necessary info to BD |
| 6350 | if( eSIR_SUCCESS != |
| 6351 | (statusCode = limPopulateMacHeader( pMac, |
| 6352 | pFrame, |
| 6353 | SIR_MAC_MGMT_FRAME, |
| 6354 | SIR_MAC_MGMT_ACTION, |
| 6355 | peer, psessionEntry->selfMacAddr))) |
| 6356 | goto returnAfterError; |
| 6357 | |
| 6358 | // Update A3 with the BSSID |
| 6359 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6360 | |
| 6361 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6362 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6363 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6364 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6365 | #endif |
| 6366 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6367 | // Now, we're ready to "pack" the frames |
| 6368 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6369 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6370 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6371 | nPayload, |
| 6372 | &nPayload ); |
| 6373 | |
| 6374 | if( DOT11F_FAILED( nStatus )) |
| 6375 | { |
| 6376 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6377 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6378 | nStatus ); |
| 6379 | |
| 6380 | // FIXME - Need to convert to tSirRetStatus |
| 6381 | statusCode = eSIR_FAILURE; |
| 6382 | goto returnAfterError; |
| 6383 | } |
| 6384 | else if( DOT11F_WARNED( nStatus )) |
| 6385 | { |
| 6386 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6387 | FL( "There were warnings while packing Radio " |
| 6388 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6389 | } |
| 6390 | |
| 6391 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6392 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6393 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6394 | |
| 6395 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6396 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6397 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6398 | ) |
| 6399 | { |
| 6400 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6401 | } |
| 6402 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6403 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6404 | psessionEntry->peSessionId, |
| 6405 | pMacHdr->fc.subType)); |
| 6406 | halstatus = halTxFrame( pMac, |
| 6407 | pPacket, |
| 6408 | (tANI_U16) nBytes, |
| 6409 | HAL_TXRX_FRM_802_11_MGMT, |
| 6410 | ANI_TXDIR_TODS, |
| 6411 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6412 | limTxComplete, |
| 6413 | pFrame, txFlag ); |
| 6414 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6415 | psessionEntry->peSessionId, |
| 6416 | halstatus)); |
| 6417 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6418 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6419 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6420 | statusCode = eSIR_FAILURE; |
| 6421 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6422 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6423 | return statusCode; |
| 6424 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6425 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6426 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6427 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6429 | |
| 6430 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6431 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6432 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6433 | return statusCode; |
| 6434 | } // End limSendBeaconReportActionFrame. |
| 6435 | |
| 6436 | #endif |
| 6437 | |
| 6438 | #ifdef WLAN_FEATURE_11W |
| 6439 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6440 | * \brief Send SA query request action frame to peer |
| 6441 | * |
| 6442 | * \sa limSendSaQueryRequestFrame |
| 6443 | * |
| 6444 | * |
| 6445 | * \param pMac The global tpAniSirGlobal object |
| 6446 | * |
| 6447 | * \param transId Transaction identifier |
| 6448 | * |
| 6449 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6450 | * |
| 6451 | * \param psessionEntry The PE session entry |
| 6452 | * |
| 6453 | * \return eSIR_SUCCESS if setup completes successfully |
| 6454 | * eSIR_FAILURE is some problem is encountered |
| 6455 | */ |
| 6456 | |
| 6457 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6458 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6459 | { |
| 6460 | |
| 6461 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6462 | tANI_U8 *pFrame; |
| 6463 | tSirRetStatus nSirStatus; |
| 6464 | tpSirMacMgmtHdr pMacHdr; |
| 6465 | tANI_U32 nBytes, nPayload, nStatus; |
| 6466 | void *pPacket; |
| 6467 | eHalStatus halstatus; |
| 6468 | tANI_U8 txFlag = 0; |
| 6469 | |
| 6470 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6471 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6472 | /* 11w action field is : |
| 6473 | action: 0 --> SA Query Request action frame |
| 6474 | action: 1 --> SA Query Response action frame */ |
| 6475 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6476 | /* 11w SA Query Request transId */ |
| 6477 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6478 | |
| 6479 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6480 | if ( DOT11F_FAILED( nStatus ) ) |
| 6481 | { |
| 6482 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6483 | "for an SA Query Request (0x%08x)."), |
| 6484 | nStatus ); |
| 6485 | // We'll fall back on the worst case scenario: |
| 6486 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6487 | } |
| 6488 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6489 | { |
| 6490 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6491 | "the packed size for an SA Query Request" |
| 6492 | " (0x%08x)."), nStatus ); |
| 6493 | } |
| 6494 | |
| 6495 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6496 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6497 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6498 | { |
| 6499 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6500 | "action frame"), nBytes ); |
| 6501 | return eSIR_FAILURE; |
| 6502 | } |
| 6503 | |
| 6504 | // Paranoia: |
| 6505 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6506 | |
| 6507 | // Copy necessary info to BD |
| 6508 | nSirStatus = limPopulateMacHeader( pMac, |
| 6509 | pFrame, |
| 6510 | SIR_MAC_MGMT_FRAME, |
| 6511 | SIR_MAC_MGMT_ACTION, |
| 6512 | peer, psessionEntry->selfMacAddr ); |
| 6513 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6514 | goto returnAfterError; |
| 6515 | |
| 6516 | // Update A3 with the BSSID |
| 6517 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6518 | |
| 6519 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6520 | |
| 6521 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6522 | // in the FC |
| 6523 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6524 | |
| 6525 | // Pack 11w SA Query Request frame |
| 6526 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6527 | &frm, |
| 6528 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6529 | nPayload, |
| 6530 | &nPayload ); |
| 6531 | |
| 6532 | if ( DOT11F_FAILED( nStatus )) |
| 6533 | { |
| 6534 | limLog( pMac, LOGE, |
| 6535 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6536 | nStatus ); |
| 6537 | // FIXME - Need to convert to tSirRetStatus |
| 6538 | nSirStatus = eSIR_FAILURE; |
| 6539 | goto returnAfterError; |
| 6540 | } |
| 6541 | else if ( DOT11F_WARNED( nStatus )) |
| 6542 | { |
| 6543 | limLog( pMac, LOGW, |
| 6544 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6545 | nStatus); |
| 6546 | } |
| 6547 | |
| 6548 | limLog( pMac, LOG1, |
| 6549 | FL( "Sending an SA Query Request to " )); |
| 6550 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6551 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6552 | limLog( pMac, LOGE, |
| 6553 | FL( "Sending an SA Query Request from " )); |
| 6554 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6555 | |
| 6556 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6557 | #ifdef WLAN_FEATURE_P2P |
| 6558 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6559 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6560 | #endif |
| 6561 | ) |
| 6562 | { |
| 6563 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6564 | } |
| 6565 | |
| 6566 | halstatus = halTxFrame( pMac, |
| 6567 | pPacket, |
| 6568 | (tANI_U16) nBytes, |
| 6569 | HAL_TXRX_FRM_802_11_MGMT, |
| 6570 | ANI_TXDIR_TODS, |
| 6571 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6572 | limTxComplete, |
| 6573 | pFrame, txFlag ); |
| 6574 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6575 | { |
| 6576 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6577 | nSirStatus = eSIR_FAILURE; |
| 6578 | //Pkt will be freed up by the callback |
| 6579 | return nSirStatus; |
| 6580 | } |
| 6581 | else { |
| 6582 | return eSIR_SUCCESS; |
| 6583 | } |
| 6584 | |
| 6585 | returnAfterError: |
| 6586 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6587 | return nSirStatus; |
| 6588 | } // End limSendSaQueryRequestFrame |
| 6589 | |
| 6590 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6591 | * \brief Send SA query response action frame to peer |
| 6592 | * |
| 6593 | * \sa limSendSaQueryResponseFrame |
| 6594 | * |
| 6595 | * |
| 6596 | * \param pMac The global tpAniSirGlobal object |
| 6597 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6598 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6599 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6600 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6601 | * |
| 6602 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6603 | * |
| 6604 | * \return eSIR_SUCCESS if setup completes successfully |
| 6605 | * eSIR_FAILURE is some problem is encountered |
| 6606 | */ |
| 6607 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6608 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6609 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6610 | { |
| 6611 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6612 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6613 | tANI_U8 *pFrame; |
| 6614 | tSirRetStatus nSirStatus; |
| 6615 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6616 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6617 | void *pPacket; |
| 6618 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6619 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6621 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6622 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6623 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6624 | action: 0 --> SA query request action frame |
| 6625 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6626 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6627 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6628 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6629 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6631 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6632 | if ( DOT11F_FAILED( nStatus ) ) |
| 6633 | { |
| 6634 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6635 | "or a SA Query Response (0x%08x)."), |
| 6636 | nStatus ); |
| 6637 | // We'll fall back on the worst case scenario: |
| 6638 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6639 | } |
| 6640 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6641 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6642 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6643 | "the packed size for an SA Query Response" |
| 6644 | " (0x%08x)."), nStatus ); |
| 6645 | } |
| 6646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6647 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6648 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6649 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6650 | { |
| 6651 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6652 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6653 | return eSIR_FAILURE; |
| 6654 | } |
| 6655 | |
| 6656 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6657 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6658 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6659 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6660 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6661 | pFrame, |
| 6662 | SIR_MAC_MGMT_FRAME, |
| 6663 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6664 | peer, psessionEntry->selfMacAddr ); |
| 6665 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6666 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6668 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6669 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6670 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6671 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6672 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6673 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6674 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6675 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6677 | // Pack 11w SA query response frame |
| 6678 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6679 | &frm, |
| 6680 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6681 | nPayload, |
| 6682 | &nPayload ); |
| 6683 | |
| 6684 | if ( DOT11F_FAILED( nStatus )) |
| 6685 | { |
| 6686 | limLog( pMac, LOGE, |
| 6687 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6688 | nStatus ); |
| 6689 | // FIXME - Need to convert to tSirRetStatus |
| 6690 | nSirStatus = eSIR_FAILURE; |
| 6691 | goto returnAfterError; |
| 6692 | } |
| 6693 | else if ( DOT11F_WARNED( nStatus )) |
| 6694 | { |
| 6695 | limLog( pMac, LOGW, |
| 6696 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6697 | nStatus); |
| 6698 | } |
| 6699 | |
| 6700 | limLog( pMac, LOG1, |
| 6701 | FL( "Sending a SA Query Response to " )); |
| 6702 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6703 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6704 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6705 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6706 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6707 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6708 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6709 | ) |
| 6710 | { |
| 6711 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6712 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6713 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6714 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6715 | psessionEntry->peSessionId, |
| 6716 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6717 | halstatus = halTxFrame( pMac, |
| 6718 | pPacket, |
| 6719 | (tANI_U16) nBytes, |
| 6720 | HAL_TXRX_FRM_802_11_MGMT, |
| 6721 | ANI_TXDIR_TODS, |
| 6722 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6723 | limTxComplete, |
| 6724 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6725 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6726 | psessionEntry->peSessionId, |
| 6727 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6728 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6729 | { |
| 6730 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6731 | nSirStatus = eSIR_FAILURE; |
| 6732 | //Pkt will be freed up by the callback |
| 6733 | return nSirStatus; |
| 6734 | } |
| 6735 | else { |
| 6736 | return eSIR_SUCCESS; |
| 6737 | } |
| 6738 | |
| 6739 | returnAfterError: |
| 6740 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6741 | return nSirStatus; |
| 6742 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6743 | #endif |