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 | |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 269 | #ifdef WLAN_FEATURE_11W |
| 270 | /** |
| 271 | * |
| 272 | * \brief This function is called by various LIM modules to correctly set |
| 273 | * the Protected bit in the Frame Control Field of the 802.11 frame MAC header |
| 274 | * |
| 275 | * |
| 276 | * \param pMac Pointer to Global MAC structure |
| 277 | * |
| 278 | * \param psessionEntry Pointer to session corresponding to the connection |
| 279 | * |
| 280 | * \param peer Peer address of the STA to which the frame is to be sent |
| 281 | * |
| 282 | * \param pMacHdr Pointer to the frame MAC header |
| 283 | * |
| 284 | * \return nothing |
| 285 | * |
| 286 | * |
| 287 | */ |
| 288 | void |
| 289 | limSetProtectedBit(tpAniSirGlobal pMac, |
| 290 | tpPESession psessionEntry, |
| 291 | tSirMacAddr peer, |
| 292 | tpSirMacMgmtHdr pMacHdr) |
| 293 | { |
| 294 | tANI_U16 aid; |
| 295 | tpDphHashNode pStaDs; |
| 296 | |
| 297 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || |
| 298 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 299 | { |
| 300 | |
| 301 | pStaDs = dphLookupHashEntry( pMac, peer, &aid, &psessionEntry->dph.dphHashTable ); |
| 302 | if( pStaDs != NULL ) |
| 303 | if( pStaDs->rmfEnabled ) |
| 304 | pMacHdr->fc.wep = 1; |
| 305 | } |
| 306 | else if ( psessionEntry->limRmfEnabled ) |
| 307 | pMacHdr->fc.wep = 1; |
| 308 | } /*** end limSetProtectedBit() ***/ |
| 309 | #endif |
| 310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | /** |
| 312 | * \brief limSendProbeReqMgmtFrame |
| 313 | * |
| 314 | * |
| 315 | * \param pMac Pointer to Global MAC structure |
| 316 | * |
| 317 | * \param pSsid SSID to be sent in Probe Request frame |
| 318 | * |
| 319 | * \param bssid BSSID to be sent in Probe Request frame |
| 320 | * |
| 321 | * \param nProbeDelay probe delay to be used before sending Probe Request |
| 322 | * frame |
| 323 | * |
| 324 | * \param nChannelNum Channel # on which the Probe Request is going out |
| 325 | * |
| 326 | * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame |
| 327 | * |
| 328 | * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame |
| 329 | * |
| 330 | * This function is called by various LIM modules to send Probe Request frame |
| 331 | * during active scan/learn phase. |
| 332 | * Probe request is sent out in the following scenarios: |
| 333 | * --heartbeat failure: session needed |
| 334 | * --join req: session needed |
| 335 | * --foreground scan: no session |
| 336 | * --background scan: no session |
| 337 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 338 | * |
| 339 | * |
| 340 | */ |
| 341 | tSirRetStatus |
| 342 | limSendProbeReqMgmtFrame(tpAniSirGlobal pMac, |
| 343 | tSirMacSSid *pSsid, |
| 344 | tSirMacAddr bssid, |
| 345 | tANI_U8 nChannelNum, |
| 346 | tSirMacAddr SelfMacAddr, |
| 347 | tANI_U32 dot11mode, |
| 348 | tANI_U32 nAdditionalIELen, |
| 349 | tANI_U8 *pAdditionalIE) |
| 350 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 351 | tDot11fProbeRequest pr; |
| 352 | tANI_U32 nStatus, nBytes, nPayload; |
| 353 | tSirRetStatus nSirStatus; |
| 354 | tANI_U8 *pFrame; |
| 355 | void *pPacket; |
| 356 | eHalStatus halstatus; |
| 357 | tpPESession psessionEntry; |
| 358 | tANI_U8 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | tANI_U8 *p2pIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 360 | tANI_U32 txFlag = 0; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 361 | tANI_U32 chanbond24G = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | |
| 363 | #ifndef GEN4_SCAN |
| 364 | return eSIR_FAILURE; |
| 365 | #endif |
| 366 | |
| 367 | #if defined ( ANI_DVT_DEBUG ) |
| 368 | return eSIR_FAILURE; |
| 369 | #endif |
| 370 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame] | 371 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 372 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 373 | * is false and dot11mode is 11ac set it to 11n. |
| 374 | */ |
| 375 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 376 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 377 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 378 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 379 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | /* |
| 381 | * session context may or may not be present, when probe request needs to be sent out. |
| 382 | * following cases exist: |
| 383 | * --heartbeat failure: session needed |
| 384 | * --join req: session needed |
| 385 | * --foreground scan: no session |
| 386 | * --background scan: no session |
| 387 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 388 | * If session context does not exist, some IEs will be populated from CFGs, |
| 389 | * e.g. Supported and Extended rate set IEs |
| 390 | */ |
| 391 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 392 | |
| 393 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 394 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 395 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 396 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | |
| 398 | // & delegating to assorted helpers: |
| 399 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 400 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | if( nAdditionalIELen && pAdditionalIE ) |
| 402 | { |
| 403 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 404 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 405 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 406 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 407 | ( p2pIe != NULL ) && |
| 408 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 409 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 410 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 411 | ( ( psessionEntry != NULL ) && |
| 412 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 413 | ) |
| 414 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 415 | { |
| 416 | /* In the below API pass channel number > 14, do that it fills only |
| 417 | * 11a rates in supported rates */ |
| 418 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 419 | } |
| 420 | else |
| 421 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 422 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 423 | &pr.SuppRates,psessionEntry); |
| 424 | |
| 425 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 426 | { |
| 427 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 430 | |
| 431 | #if defined WLAN_FEATURE_VOWIFI |
| 432 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 433 | //DS params "can" be present in RRM is disabled and "is" present if |
| 434 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 435 | //RRM is not enabled. |
| 436 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 437 | //Call RRM module to get the tx power for management used. |
| 438 | { |
| 439 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 440 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 441 | } |
| 442 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 443 | |
| 444 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 445 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 447 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 449 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 450 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 451 | } else { //psessionEntry == NULL |
| 452 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 454 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | } |
| 456 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 457 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 458 | /* Get HT40 capability for 2.4GHz band */ |
| 459 | wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G); |
| 460 | if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 461 | { |
| 462 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 463 | pr.HTCaps.shortGI40MHz = 0; |
| 464 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 465 | #ifdef WLAN_FEATURE_11AC |
| 466 | if (psessionEntry != NULL ) { |
| 467 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 468 | //Include HT Capability IE |
| 469 | if (psessionEntry->vhtCapability) |
| 470 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 471 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 472 | } |
| 473 | } else { |
| 474 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 475 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 476 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 477 | } |
| 478 | } |
| 479 | #endif |
| 480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | |
| 482 | // That's it-- now we pack it. First, how much space are we going to |
| 483 | // need? |
| 484 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 485 | if ( DOT11F_FAILED( nStatus ) ) |
| 486 | { |
| 487 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 488 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 489 | // We'll fall back on the worst case scenario: |
| 490 | nPayload = sizeof( tDot11fProbeRequest ); |
| 491 | } |
| 492 | else if ( DOT11F_WARNED( nStatus ) ) |
| 493 | { |
| 494 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 495 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 496 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 500 | |
| 501 | // Ok-- try to allocate some memory: |
| 502 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 503 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 504 | ( void** ) &pPacket ); |
| 505 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 506 | { |
| 507 | 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] | 508 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 509 | return eSIR_MEM_ALLOC_FAILED; |
| 510 | } |
| 511 | |
| 512 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 513 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | |
| 515 | // Next, we fill out the buffer descriptor: |
| 516 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 517 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | if ( eSIR_SUCCESS != nSirStatus ) |
| 519 | { |
| 520 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 521 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 522 | nSirStatus ); |
| 523 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 524 | ( void* ) pFrame, ( void* ) pPacket ); |
| 525 | return nSirStatus; // allocated! |
| 526 | } |
| 527 | |
| 528 | // That done, pack the Probe Request: |
| 529 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 530 | sizeof( tSirMacMgmtHdr ), |
| 531 | nPayload, &nPayload ); |
| 532 | if ( DOT11F_FAILED( nStatus ) ) |
| 533 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 534 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | nStatus ); |
| 536 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 537 | return eSIR_FAILURE; // allocated! |
| 538 | } |
| 539 | else if ( DOT11F_WARNED( nStatus ) ) |
| 540 | { |
| 541 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 542 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | // Append any AddIE if present. |
| 546 | if( nAdditionalIELen ) |
| 547 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 548 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 549 | pAdditionalIE, nAdditionalIELen ); |
| 550 | nPayload += nAdditionalIELen; |
| 551 | } |
| 552 | |
| 553 | /* If this probe request is sent during P2P Search State, then we need |
| 554 | * to send it at OFDM rate. |
| 555 | */ |
| 556 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 557 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 558 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 559 | /* For unicast probe req mgmt from Join function |
| 560 | we don't set above variables. So we need to add |
| 561 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 562 | || ( ( psessionEntry != NULL ) && |
| 563 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | ) |
| 565 | { |
| 566 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 567 | } |
| 568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 570 | HAL_TXRX_FRM_802_11_MGMT, |
| 571 | ANI_TXDIR_TODS, |
| 572 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 573 | limTxComplete, pFrame, txFlag ); |
| 574 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 575 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 576 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 577 | //Pkt will be freed up by the callback |
| 578 | return eSIR_FAILURE; |
| 579 | } |
| 580 | |
| 581 | return eSIR_SUCCESS; |
| 582 | } // End limSendProbeReqMgmtFrame. |
| 583 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 584 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 585 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 586 | tANI_U8 probeReqP2pIe) |
| 587 | { |
| 588 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 589 | from additional IE */ |
| 590 | if(!probeReqP2pIe) |
| 591 | { |
| 592 | tANI_U8* tempbuf = NULL; |
| 593 | tANI_U16 tempLen = 0; |
| 594 | int left = *addnIELen; |
| 595 | v_U8_t *ptr = addIE; |
| 596 | v_U8_t elem_id, elem_len; |
| 597 | |
| 598 | if(NULL == addIE) |
| 599 | { |
| 600 | PELOGE(limLog(pMac, LOGE, |
| 601 | FL(" NULL addIE pointer"));) |
| 602 | return eSIR_FAILURE; |
| 603 | } |
| 604 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 605 | tempbuf = vos_mem_malloc(left); |
| 606 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | { |
| 608 | PELOGE(limLog(pMac, LOGE, |
| 609 | FL("Unable to allocate memory to store addn IE"));) |
| 610 | return eSIR_MEM_ALLOC_FAILED; |
| 611 | } |
| 612 | |
| 613 | while(left >= 2) |
| 614 | { |
| 615 | elem_id = ptr[0]; |
| 616 | elem_len = ptr[1]; |
| 617 | left -= 2; |
| 618 | if(elem_len > left) |
| 619 | { |
| 620 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 621 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 623 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 624 | return eSIR_FAILURE; |
| 625 | } |
| 626 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 627 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 628 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 629 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 630 | tempLen += (elem_len + 2); |
| 631 | } |
| 632 | left -= elem_len; |
| 633 | ptr += (elem_len + 2); |
| 634 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 635 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 637 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | } |
| 639 | return eSIR_SUCCESS; |
| 640 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 641 | |
| 642 | void |
| 643 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 644 | tSirMacAddr peerMacAddr, |
| 645 | tpAniSSID pSsid, |
| 646 | short nStaId, |
| 647 | tANI_U8 nKeepAlive, |
| 648 | tpPESession psessionEntry, |
| 649 | tANI_U8 probeReqP2pIe) |
| 650 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 651 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 652 | tSirRetStatus nSirStatus; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 653 | tANI_U32 cfg, nPayload, nStatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 654 | tpSirMacMgmtHdr pMacHdr; |
| 655 | tANI_U8 *pFrame; |
| 656 | void *pPacket; |
| 657 | eHalStatus halstatus; |
| 658 | tANI_U32 addnIEPresent; |
| 659 | tANI_U32 addnIE1Len=0; |
| 660 | tANI_U32 addnIE2Len=0; |
| 661 | tANI_U32 addnIE3Len=0; |
| 662 | tANI_U16 totalAddnIeLen = 0; |
| 663 | tANI_U32 wpsApEnable=0, tmp; |
| 664 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 665 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 666 | tANI_U8 *pP2pIe = NULL; |
| 667 | tANI_U8 noaLen = 0; |
| 668 | tANI_U8 total_noaLen = 0; |
| 669 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 670 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 671 | 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] | 672 | tDot11fIEExtCap extractedExtCap; |
| 673 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 674 | tANI_U32 nBytes = 0; |
| 675 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 676 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 677 | { |
| 678 | return; // in this case. |
| 679 | } |
| 680 | |
| 681 | if(NULL == psessionEntry) |
| 682 | { |
| 683 | return; |
| 684 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 685 | |
| 686 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 687 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 688 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 689 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 690 | return; |
| 691 | } |
| 692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 693 | // Fill out 'frm', after which we'll just hand the struct off to |
| 694 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 695 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 696 | |
| 697 | // Timestamp to be updated by TFP, below. |
| 698 | |
| 699 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 700 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 701 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 702 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 703 | } |
| 704 | else |
| 705 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 706 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 707 | if (eSIR_SUCCESS != nSirStatus) |
| 708 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 709 | 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] | 710 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 711 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 712 | return; |
| 713 | } |
| 714 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 715 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 716 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 717 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 718 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 719 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 720 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 721 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 722 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 723 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 724 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 725 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 726 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 727 | { |
| 728 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 729 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 730 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | } |
| 732 | } |
| 733 | else |
| 734 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 735 | 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] | 736 | 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] | 737 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 738 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 739 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 740 | if (wpsApEnable) |
| 741 | { |
| 742 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 743 | } |
| 744 | |
| 745 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 746 | { |
| 747 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 748 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 749 | } |
| 750 | |
| 751 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 752 | { |
| 753 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 754 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 755 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 757 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 758 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 759 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 761 | |
| 762 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 763 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | |
| 765 | |
| 766 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 767 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 768 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 769 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 770 | |
| 771 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 772 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 773 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 774 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 775 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 777 | #ifdef WLAN_FEATURE_11AC |
| 778 | if(psessionEntry->vhtCapability) |
| 779 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 780 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 781 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
| 782 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 783 | // we do not support multi users yet |
| 784 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 785 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 786 | } |
| 787 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 789 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 790 | if ( psessionEntry->pLimStartBssReq ) |
| 791 | { |
| 792 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 793 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 794 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 795 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 796 | } |
| 797 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 798 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 799 | |
| 800 | #if defined(FEATURE_WLAN_WAPI) |
| 801 | if( psessionEntry->pLimStartBssReq ) |
| 802 | { |
| 803 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 804 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | #endif // defined(FEATURE_WLAN_WAPI) |
| 808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 809 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 810 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 811 | { |
| 812 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 813 | } |
| 814 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 815 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 816 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | { |
| 818 | |
| 819 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 820 | &addnIEPresent) != eSIR_SUCCESS) |
| 821 | { |
| 822 | 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] | 823 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 824 | return; |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | if (addnIEPresent) |
| 829 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 830 | |
| 831 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 832 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 833 | { |
| 834 | PELOGE(limLog(pMac, LOGE, |
| 835 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 836 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 837 | return; |
| 838 | } |
| 839 | |
| 840 | //Probe rsp IE available |
| 841 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 842 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 843 | { |
| 844 | 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] | 845 | vos_mem_free(addIE); |
| 846 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 847 | return; |
| 848 | } |
| 849 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 850 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 851 | { |
| 852 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 853 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 854 | &addnIE1Len) ) |
| 855 | { |
| 856 | limLog(pMac, LOGP, |
| 857 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 858 | vos_mem_free(addIE); |
| 859 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 860 | return; |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | //Probe rsp IE available |
| 865 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 866 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 867 | { |
| 868 | 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] | 869 | vos_mem_free(addIE); |
| 870 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 871 | return; |
| 872 | } |
| 873 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 874 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 875 | { |
| 876 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 877 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 878 | &addnIE2Len) ) |
| 879 | { |
| 880 | limLog(pMac, LOGP, |
| 881 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 882 | vos_mem_free(addIE); |
| 883 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 884 | return; |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | //Probe rsp IE available |
| 889 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 890 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 891 | { |
| 892 | 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] | 893 | vos_mem_free(addIE); |
| 894 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 895 | return; |
| 896 | } |
| 897 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 898 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 899 | { |
| 900 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 901 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 902 | &addIE[addnIE1Len + addnIE2Len], |
| 903 | &addnIE3Len) ) |
| 904 | { |
| 905 | limLog(pMac, LOGP, |
| 906 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 907 | vos_mem_free(addIE); |
| 908 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 909 | return; |
| 910 | } |
| 911 | } |
| 912 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 915 | { |
| 916 | limLog(pMac, LOGP, |
| 917 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 918 | vos_mem_free(addIE); |
| 919 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 920 | return; |
| 921 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 922 | |
| 923 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 924 | sizeof( tDot11fIEExtCap ), 0); |
| 925 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 926 | addIE, |
| 927 | &totalAddnIeLen, |
| 928 | &extractedExtCap ); |
| 929 | if(eSIR_SUCCESS != nSirStatus ) |
| 930 | { |
| 931 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 932 | limLog(pMac, LOG1, |
| 933 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 934 | } |
| 935 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 936 | nBytes = nBytes + totalAddnIeLen; |
| 937 | |
| 938 | if (probeReqP2pIe) |
| 939 | { |
| 940 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 941 | if (pP2pIe != NULL) |
| 942 | { |
| 943 | //get NoA attribute stream P2P IE |
| 944 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 945 | if (noaLen != 0) |
| 946 | { |
| 947 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 948 | &noaStream[0], noaLen); |
| 949 | nBytes = nBytes + total_noaLen; |
| 950 | } |
| 951 | } |
| 952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 953 | } |
| 954 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 955 | /*merge ExtCap IE*/ |
| 956 | if (extractedExtCapFlag && extractedExtCap.present) |
| 957 | { |
| 958 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 959 | } |
| 960 | |
| 961 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 962 | if ( DOT11F_FAILED( nStatus ) ) |
| 963 | { |
| 964 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 965 | "or a Probe Response (0x%08x)."), |
| 966 | nStatus ); |
| 967 | // We'll fall back on the worst case scenario: |
| 968 | nPayload = sizeof( tDot11fProbeResponse ); |
| 969 | } |
| 970 | else if ( DOT11F_WARNED( nStatus ) ) |
| 971 | { |
| 972 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 973 | "the packed size for a Probe Response " |
| 974 | "(0x%08x)."), nStatus ); |
| 975 | } |
| 976 | |
| 977 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 978 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 980 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 981 | ( void** ) &pPacket ); |
| 982 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 983 | { |
| 984 | 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] | 985 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 986 | if ( addIE != NULL ) |
| 987 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 988 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 989 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 990 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 991 | return; |
| 992 | } |
| 993 | |
| 994 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 995 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 996 | |
| 997 | // Next, we fill out the buffer descriptor: |
| 998 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 999 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 1000 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1001 | { |
| 1002 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1003 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1004 | nSirStatus ); |
| 1005 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1006 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1007 | if ( addIE != NULL ) |
| 1008 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1009 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1011 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1012 | return; |
| 1013 | } |
| 1014 | |
| 1015 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1016 | |
| 1017 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1018 | |
| 1019 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1020 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1021 | nPayload, &nPayload ); |
| 1022 | if ( DOT11F_FAILED( nStatus ) ) |
| 1023 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1024 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | nStatus ); |
| 1026 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1027 | if ( addIE != NULL ) |
| 1028 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1029 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1031 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | return; // allocated! |
| 1033 | } |
| 1034 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1035 | { |
| 1036 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1037 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1038 | } |
| 1039 | |
| 1040 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1041 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1042 | |
| 1043 | pMac->sys.probeRespond++; |
| 1044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1045 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1046 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1047 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1048 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1050 | |
| 1051 | if ( addnIEPresent ) |
| 1052 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1053 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1054 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | if (noaLen != 0) |
| 1056 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1057 | 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] | 1058 | { |
| 1059 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1060 | FL("Not able to insert NoA because of length constraint." |
| 1061 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1062 | vos_mem_free(addIE); |
| 1063 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1064 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1065 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1066 | return; |
| 1067 | } |
| 1068 | else |
| 1069 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1070 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1071 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1072 | } |
| 1073 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1074 | |
| 1075 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1077 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | ) |
| 1079 | { |
| 1080 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1081 | } |
| 1082 | |
| 1083 | // Queue Probe Response frame in high priority WQ |
| 1084 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1085 | ( tANI_U16 ) nBytes, |
| 1086 | HAL_TXRX_FRM_802_11_MGMT, |
| 1087 | ANI_TXDIR_TODS, |
| 1088 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1089 | limTxComplete, pFrame, txFlag ); |
| 1090 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1091 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1092 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1093 | //Pkt will be freed up by the callback |
| 1094 | } |
| 1095 | |
| 1096 | if ( addIE != NULL ) |
| 1097 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1098 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1099 | } |
| 1100 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1101 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1102 | return; |
| 1103 | |
| 1104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | } // End limSendProbeRspMgmtFrame. |
| 1106 | |
| 1107 | void |
| 1108 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1109 | tSirMacAddr peerMacAddr, |
| 1110 | tSirAddtsReqInfo *pAddTS, |
| 1111 | tpPESession psessionEntry) |
| 1112 | { |
| 1113 | tANI_U16 i; |
| 1114 | tANI_U8 *pFrame; |
| 1115 | tSirRetStatus nSirStatus; |
| 1116 | tDot11fAddTSRequest AddTSReq; |
| 1117 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1118 | tANI_U32 nPayload, nBytes, nStatus; |
| 1119 | tpSirMacMgmtHdr pMacHdr; |
| 1120 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1121 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1122 | tANI_U32 phyMode; |
| 1123 | #endif |
| 1124 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1125 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | |
| 1127 | if(NULL == psessionEntry) |
| 1128 | { |
| 1129 | return; |
| 1130 | } |
| 1131 | |
| 1132 | if ( ! pAddTS->wmeTspecPresent ) |
| 1133 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1134 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1135 | |
| 1136 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1137 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1138 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1139 | if ( pAddTS->lleTspecPresent ) |
| 1140 | { |
| 1141 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1142 | } |
| 1143 | else |
| 1144 | { |
| 1145 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1146 | } |
| 1147 | |
| 1148 | if ( pAddTS->lleTspecPresent ) |
| 1149 | { |
| 1150 | AddTSReq.num_WMMTCLAS = 0; |
| 1151 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1152 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1153 | { |
| 1154 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1155 | &AddTSReq.TCLAS[i] ); |
| 1156 | } |
| 1157 | } |
| 1158 | else |
| 1159 | { |
| 1160 | AddTSReq.num_TCLAS = 0; |
| 1161 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1162 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1163 | { |
| 1164 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1165 | &AddTSReq.WMMTCLAS[i] ); |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | if ( pAddTS->tclasProcPresent ) |
| 1170 | { |
| 1171 | if ( pAddTS->lleTspecPresent ) |
| 1172 | { |
| 1173 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1174 | AddTSReq.TCLASSPROC.present = 1; |
| 1175 | } |
| 1176 | else |
| 1177 | { |
| 1178 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1179 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1180 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1181 | } |
| 1182 | } |
| 1183 | |
| 1184 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1185 | if ( DOT11F_FAILED( nStatus ) ) |
| 1186 | { |
| 1187 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1188 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1189 | nStatus ); |
| 1190 | // We'll fall back on the worst case scenario: |
| 1191 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1192 | } |
| 1193 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1194 | { |
| 1195 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1196 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1197 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1198 | } |
| 1199 | } |
| 1200 | else |
| 1201 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1202 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | |
| 1204 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1205 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1206 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1207 | |
| 1208 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1209 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1210 | |
| 1211 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1212 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1213 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1214 | |
| 1215 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1216 | { |
| 1217 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1218 | } |
| 1219 | else |
| 1220 | { |
| 1221 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1222 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1223 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1224 | #endif |
| 1225 | // fillWmeTspecIE |
| 1226 | |
| 1227 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1228 | if ( DOT11F_FAILED( nStatus ) ) |
| 1229 | { |
| 1230 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1231 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1232 | nStatus ); |
| 1233 | // We'll fall back on the worst case scenario: |
| 1234 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1235 | } |
| 1236 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1237 | { |
| 1238 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1239 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1240 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1241 | } |
| 1242 | } |
| 1243 | |
| 1244 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1245 | |
| 1246 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1247 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1248 | ( void** ) &pPacket ); |
| 1249 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1250 | { |
| 1251 | 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] | 1252 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1253 | return; |
| 1254 | } |
| 1255 | |
| 1256 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1257 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1258 | |
| 1259 | // Next, we fill out the buffer descriptor: |
| 1260 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1261 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1262 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1263 | { |
| 1264 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1265 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1266 | nSirStatus ); |
| 1267 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1268 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1269 | return; |
| 1270 | } |
| 1271 | |
| 1272 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1273 | |
| 1274 | #if 0 |
| 1275 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1276 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1277 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1278 | { |
| 1279 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1280 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1281 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1282 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1283 | return; |
| 1284 | } |
| 1285 | #endif //TO SUPPORT BT-AMP |
| 1286 | |
| 1287 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1288 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1289 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1290 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1291 | #endif |
| 1292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1293 | // That done, pack the struct: |
| 1294 | if ( ! pAddTS->wmeTspecPresent ) |
| 1295 | { |
| 1296 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1297 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1298 | nPayload, &nPayload ); |
| 1299 | if ( DOT11F_FAILED( nStatus ) ) |
| 1300 | { |
| 1301 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1302 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1303 | nStatus ); |
| 1304 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1305 | return; // allocated! |
| 1306 | } |
| 1307 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1308 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1309 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1310 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | } |
| 1312 | } |
| 1313 | else |
| 1314 | { |
| 1315 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1316 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1317 | nPayload, &nPayload ); |
| 1318 | if ( DOT11F_FAILED( nStatus ) ) |
| 1319 | { |
| 1320 | 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] | 1321 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | nStatus ); |
| 1323 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1324 | return; // allocated! |
| 1325 | } |
| 1326 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1327 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1328 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1329 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") ); |
| 1334 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1335 | |
| 1336 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1337 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1338 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1339 | ) |
| 1340 | { |
| 1341 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1342 | } |
| 1343 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1344 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1345 | psessionEntry->peSessionId, |
| 1346 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | // Queue Addts Response frame in high priority WQ |
| 1348 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1349 | HAL_TXRX_FRM_802_11_MGMT, |
| 1350 | ANI_TXDIR_TODS, |
| 1351 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1352 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1353 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1354 | psessionEntry->peSessionId, |
| 1355 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1356 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1357 | { |
| 1358 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1359 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1360 | //Pkt will be freed up by the callback |
| 1361 | } |
| 1362 | |
| 1363 | } // End limSendAddtsReqActionFrame. |
| 1364 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1365 | |
| 1366 | |
| 1367 | void |
| 1368 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1369 | tANI_U16 statusCode, |
| 1370 | tANI_U16 aid, |
| 1371 | tSirMacAddr peerMacAddr, |
| 1372 | tANI_U8 subType, |
| 1373 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1374 | { |
| 1375 | static tDot11fAssocResponse frm; |
| 1376 | tANI_U8 *pFrame, *macAddr; |
| 1377 | tpSirMacMgmtHdr pMacHdr; |
| 1378 | tSirRetStatus nSirStatus; |
| 1379 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1380 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1381 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1382 | void *pPacket; |
| 1383 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1384 | tUpdateBeaconParams beaconParams; |
| 1385 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1386 | tANI_U32 addnIEPresent = false; |
| 1387 | tANI_U32 addnIELen=0; |
| 1388 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1389 | tpSirAssocReq pAssocReq = NULL; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1390 | tANI_U16 addStripoffIELen = 0; |
| 1391 | tDot11fIEExtCap extractedExtCap; |
| 1392 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1393 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1394 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1395 | #ifdef WLAN_FEATURE_11W |
| 1396 | tANI_U32 retryInterval; |
| 1397 | tANI_U32 maxRetries; |
| 1398 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1399 | |
| 1400 | if(NULL == psessionEntry) |
| 1401 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1402 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1403 | return; |
| 1404 | } |
| 1405 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1406 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1407 | |
| 1408 | limGetQosMode(psessionEntry, &qosMode); |
| 1409 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1410 | |
| 1411 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1412 | // STA sent a traffic spec. |
| 1413 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1414 | |
| 1415 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1416 | |
| 1417 | frm.Status.status = statusCode; |
| 1418 | |
| 1419 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1420 | |
| 1421 | if ( NULL == pSta ) |
| 1422 | { |
| 1423 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1424 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1425 | } |
| 1426 | else |
| 1427 | { |
| 1428 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1429 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1430 | } |
| 1431 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1432 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1433 | { |
| 1434 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1435 | { |
| 1436 | pAssocReq = |
| 1437 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1438 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1439 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1440 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1442 | } |
| 1443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1444 | |
| 1445 | if ( NULL != pSta ) |
| 1446 | { |
| 1447 | if ( eHAL_SET == qosMode ) |
| 1448 | { |
| 1449 | if ( pSta->lleEnabled ) |
| 1450 | { |
| 1451 | lleMode = 1; |
| 1452 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1453 | { |
| 1454 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1455 | |
| 1456 | // FramesToDo:... |
| 1457 | // if ( fAddTS ) |
| 1458 | // { |
| 1459 | // tANI_U8 *pAf = pBody; |
| 1460 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1461 | // tANI_U32 tlen; |
| 1462 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1463 | // &tlen, bufLen - frameLen); |
| 1464 | // } // End if on Add TS. |
| 1465 | } |
| 1466 | } // End if on .11e enabled in 'pSta'. |
| 1467 | } // End if on QOS Mode on. |
| 1468 | |
| 1469 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1470 | { |
| 1471 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1472 | { |
| 1473 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1474 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1475 | |
| 1476 | if ( pSta->wsmEnabled ) |
| 1477 | { |
| 1478 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1479 | } |
| 1480 | } |
| 1481 | } |
| 1482 | |
| 1483 | if ( pSta->aniPeer ) |
| 1484 | { |
| 1485 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1486 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1487 | { |
| 1488 | edcaInclude = 1; |
| 1489 | } |
| 1490 | |
| 1491 | } // End if on Airgo peer. |
| 1492 | |
| 1493 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1494 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1495 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1496 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1497 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1498 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1499 | |
| 1500 | #ifdef WLAN_FEATURE_11AC |
| 1501 | if( pSta->mlmStaContext.vhtCapability && |
| 1502 | psessionEntry->vhtCapability ) |
| 1503 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1504 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1505 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
| 1506 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1507 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1508 | } |
| 1509 | #endif |
| 1510 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1511 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1512 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1513 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame^] | 1514 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1515 | &maxRetries ) != eSIR_SUCCESS ) |
| 1516 | limLog( pMac, LOGE, |
| 1517 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1518 | else |
| 1519 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1520 | &retryInterval ) != eSIR_SUCCESS) |
| 1521 | limLog( pMac, LOGE, |
| 1522 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1523 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame^] | 1524 | PopulateDot11fTimeoutInterval( |
| 1525 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1526 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1527 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1528 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1529 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1530 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1531 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1533 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1534 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1535 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1536 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1537 | |
| 1538 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1539 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1540 | |
| 1541 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1542 | |
| 1543 | //Send message to HAL about beacon parameter change. |
| 1544 | if(beaconParams.paramChangeBitmap) |
| 1545 | { |
| 1546 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1547 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1548 | } |
| 1549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | if ( pAssocReq != NULL ) |
| 1551 | { |
| 1552 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1553 | &addnIEPresent) != eSIR_SUCCESS) |
| 1554 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1555 | limLog(pMac, LOGP, FL("Unable to get " |
| 1556 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1557 | return; |
| 1558 | } |
| 1559 | |
| 1560 | if (addnIEPresent) |
| 1561 | { |
| 1562 | //Assoc rsp IE available |
| 1563 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1564 | &addnIELen) != eSIR_SUCCESS) |
| 1565 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1566 | limLog(pMac, LOGP, FL("Unable to get " |
| 1567 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | return; |
| 1569 | } |
| 1570 | |
| 1571 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1572 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1573 | { |
| 1574 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1575 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1576 | { |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1577 | |
| 1578 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1579 | sizeof( tDot11fIEExtCap ), 0); |
| 1580 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1581 | &addIE[0], |
| 1582 | &addStripoffIELen, |
| 1583 | &extractedExtCap ); |
| 1584 | if(eSIR_SUCCESS != nSirStatus) |
| 1585 | { |
| 1586 | limLog(pMac, LOG1, |
| 1587 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1588 | } |
| 1589 | else |
| 1590 | { |
| 1591 | addnIELen = addStripoffIELen; |
| 1592 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1594 | nBytes = nBytes + addnIELen; |
| 1595 | } |
| 1596 | } |
| 1597 | } |
| 1598 | } |
| 1599 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1600 | /* merge the ExtCap struct*/ |
| 1601 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1602 | { |
| 1603 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap); |
| 1604 | } |
| 1605 | |
| 1606 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1607 | if ( DOT11F_FAILED( nStatus ) ) |
| 1608 | { |
| 1609 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1610 | "or an Association Response (0x%08x)."), |
| 1611 | nStatus ); |
| 1612 | return; |
| 1613 | } |
| 1614 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1615 | { |
| 1616 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1617 | "the packed size for an Association Re" |
| 1618 | "sponse (0x%08x)."), nStatus ); |
| 1619 | } |
| 1620 | |
| 1621 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1623 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1624 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1625 | ( void** ) &pPacket ); |
| 1626 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1627 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1628 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1629 | return; |
| 1630 | } |
| 1631 | |
| 1632 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1633 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1634 | |
| 1635 | // Next, we fill out the buffer descriptor: |
| 1636 | nSirStatus = limPopulateMacHeader( pMac, |
| 1637 | pFrame, |
| 1638 | SIR_MAC_MGMT_FRAME, |
| 1639 | ( LIM_ASSOC == subType ) ? |
| 1640 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1641 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1642 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1643 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1644 | { |
| 1645 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1646 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1647 | nSirStatus ); |
| 1648 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1649 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1650 | return; |
| 1651 | } |
| 1652 | |
| 1653 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1655 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1656 | |
| 1657 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1658 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1659 | nPayload, &nPayload ); |
| 1660 | if ( DOT11F_FAILED( nStatus ) ) |
| 1661 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1662 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1663 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1664 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1665 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1666 | return; // allocated! |
| 1667 | } |
| 1668 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1669 | { |
| 1670 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1671 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1672 | } |
| 1673 | |
| 1674 | macAddr = pMacHdr->da; |
| 1675 | |
| 1676 | if (subType == LIM_ASSOC) |
| 1677 | { |
| 1678 | PELOG1(limLog(pMac, LOG1, |
| 1679 | FL("*** Sending Assoc Resp status %d aid %d to "), |
| 1680 | statusCode, aid);) |
| 1681 | } |
| 1682 | else{ |
| 1683 | PELOG1(limLog(pMac, LOG1, |
| 1684 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
| 1685 | statusCode, aid);) |
| 1686 | } |
| 1687 | PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1688 | |
| 1689 | if ( addnIEPresent ) |
| 1690 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1691 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1692 | } |
| 1693 | |
| 1694 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1695 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1696 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1697 | ) |
| 1698 | { |
| 1699 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1700 | } |
| 1701 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1702 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1703 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1704 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1705 | |
| 1706 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1707 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1708 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1709 | psessionEntry->peSessionId, |
| 1710 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1711 | /// Queue Association Response frame in high priority WQ |
| 1712 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1713 | HAL_TXRX_FRM_802_11_MGMT, |
| 1714 | ANI_TXDIR_TODS, |
| 1715 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1716 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1717 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1718 | psessionEntry->peSessionId, |
| 1719 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1720 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1721 | { |
| 1722 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1723 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1724 | nSirStatus); |
| 1725 | |
| 1726 | //Pkt will be freed up by the callback |
| 1727 | } |
| 1728 | |
| 1729 | // update the ANI peer station count |
| 1730 | //FIXME_PROTECTION : take care of different type of station |
| 1731 | // counter inside this function. |
| 1732 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1733 | |
| 1734 | } // End limSendAssocRspMgmtFrame. |
| 1735 | |
| 1736 | |
| 1737 | |
| 1738 | void |
| 1739 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1740 | tSirMacAddr peer, |
| 1741 | tANI_U16 nStatusCode, |
| 1742 | tSirAddtsReqInfo *pAddTS, |
| 1743 | tSirMacScheduleIE *pSchedule, |
| 1744 | tpPESession psessionEntry) |
| 1745 | { |
| 1746 | tANI_U8 *pFrame; |
| 1747 | tpSirMacMgmtHdr pMacHdr; |
| 1748 | tDot11fAddTSResponse AddTSRsp; |
| 1749 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1750 | tSirRetStatus nSirStatus; |
| 1751 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1752 | void *pPacket; |
| 1753 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1754 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1755 | |
| 1756 | if(NULL == psessionEntry) |
| 1757 | { |
| 1758 | return; |
| 1759 | } |
| 1760 | |
| 1761 | if ( ! pAddTS->wmeTspecPresent ) |
| 1762 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1763 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | |
| 1765 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1766 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1767 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1768 | AddTSRsp.Status.status = nStatusCode; |
| 1769 | |
| 1770 | // The TsDelay information element is only filled in for a specific |
| 1771 | // status code: |
| 1772 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1773 | { |
| 1774 | if ( pAddTS->wsmTspecPresent ) |
| 1775 | { |
| 1776 | AddTSRsp.WMMTSDelay.version = 1; |
| 1777 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1778 | AddTSRsp.WMMTSDelay.present = 1; |
| 1779 | } |
| 1780 | else |
| 1781 | { |
| 1782 | AddTSRsp.TSDelay.delay = 10; |
| 1783 | AddTSRsp.TSDelay.present = 1; |
| 1784 | } |
| 1785 | } |
| 1786 | |
| 1787 | if ( pAddTS->wsmTspecPresent ) |
| 1788 | { |
| 1789 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1790 | } |
| 1791 | else |
| 1792 | { |
| 1793 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1794 | } |
| 1795 | |
| 1796 | if ( pAddTS->wsmTspecPresent ) |
| 1797 | { |
| 1798 | AddTSRsp.num_WMMTCLAS = 0; |
| 1799 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1800 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1801 | { |
| 1802 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1803 | &AddTSRsp.TCLAS[i] ); |
| 1804 | } |
| 1805 | } |
| 1806 | else |
| 1807 | { |
| 1808 | AddTSRsp.num_TCLAS = 0; |
| 1809 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1810 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1811 | { |
| 1812 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1813 | &AddTSRsp.WMMTCLAS[i] ); |
| 1814 | } |
| 1815 | } |
| 1816 | |
| 1817 | if ( pAddTS->tclasProcPresent ) |
| 1818 | { |
| 1819 | if ( pAddTS->wsmTspecPresent ) |
| 1820 | { |
| 1821 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1822 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1823 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1824 | } |
| 1825 | else |
| 1826 | { |
| 1827 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1828 | AddTSRsp.TCLASSPROC.present = 1; |
| 1829 | } |
| 1830 | } |
| 1831 | |
| 1832 | // schedule element is included only if requested in the tspec and we are |
| 1833 | // using hcca (or both edca and hcca) |
| 1834 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1835 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1836 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1837 | // sta figure it out |
| 1838 | if ((pSchedule != NULL) && |
| 1839 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1840 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1841 | { |
| 1842 | if ( pAddTS->wsmTspecPresent ) |
| 1843 | { |
| 1844 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1845 | } |
| 1846 | else |
| 1847 | { |
| 1848 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1849 | } |
| 1850 | } |
| 1851 | |
| 1852 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1853 | if ( DOT11F_FAILED( nStatus ) ) |
| 1854 | { |
| 1855 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1856 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1857 | nStatus ); |
| 1858 | // We'll fall back on the worst case scenario: |
| 1859 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1860 | } |
| 1861 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1862 | { |
| 1863 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1864 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1865 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | } |
| 1867 | } |
| 1868 | else |
| 1869 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1870 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1871 | |
| 1872 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1873 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1874 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1875 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1876 | |
| 1877 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1878 | |
| 1879 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1880 | if ( DOT11F_FAILED( nStatus ) ) |
| 1881 | { |
| 1882 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1883 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1884 | nStatus ); |
| 1885 | // We'll fall back on the worst case scenario: |
| 1886 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1887 | } |
| 1888 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1889 | { |
| 1890 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1891 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1892 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1893 | } |
| 1894 | } |
| 1895 | |
| 1896 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1897 | |
| 1898 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1899 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1900 | { |
| 1901 | 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] | 1902 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1903 | return; |
| 1904 | } |
| 1905 | |
| 1906 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1907 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1908 | |
| 1909 | // Next, we fill out the buffer descriptor: |
| 1910 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1911 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1912 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1913 | { |
| 1914 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1915 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1916 | nSirStatus ); |
| 1917 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1918 | return; // allocated! |
| 1919 | } |
| 1920 | |
| 1921 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1922 | |
| 1923 | |
| 1924 | #if 0 |
| 1925 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1926 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1927 | { |
| 1928 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1929 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1930 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1931 | return; // allocated! |
| 1932 | } |
| 1933 | #endif //TO SUPPORT BT-AMP |
| 1934 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1935 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1936 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1937 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1938 | #endif |
| 1939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1940 | // That done, pack the struct: |
| 1941 | if ( ! pAddTS->wmeTspecPresent ) |
| 1942 | { |
| 1943 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1944 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1945 | nPayload, &nPayload ); |
| 1946 | if ( DOT11F_FAILED( nStatus ) ) |
| 1947 | { |
| 1948 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1949 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1950 | nStatus ); |
| 1951 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1952 | return; |
| 1953 | } |
| 1954 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1955 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1956 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1957 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | } |
| 1959 | } |
| 1960 | else |
| 1961 | { |
| 1962 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1963 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1964 | nPayload, &nPayload ); |
| 1965 | if ( DOT11F_FAILED( nStatus ) ) |
| 1966 | { |
| 1967 | 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] | 1968 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1969 | nStatus ); |
| 1970 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1971 | return; |
| 1972 | } |
| 1973 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1974 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1975 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1976 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1977 | } |
| 1978 | } |
| 1979 | |
| 1980 | PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
| 1981 | nStatusCode ); |
| 1982 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 1983 | |
| 1984 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1985 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1986 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1987 | ) |
| 1988 | { |
| 1989 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1990 | } |
| 1991 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1992 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1993 | psessionEntry->peSessionId, |
| 1994 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1995 | // Queue the frame in high priority WQ: |
| 1996 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1997 | HAL_TXRX_FRM_802_11_MGMT, |
| 1998 | ANI_TXDIR_TODS, |
| 1999 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2000 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2001 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2002 | psessionEntry->peSessionId, |
| 2003 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2005 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2006 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | nSirStatus ); |
| 2008 | //Pkt will be freed up by the callback |
| 2009 | } |
| 2010 | |
| 2011 | } // End limSendAddtsRspActionFrame. |
| 2012 | |
| 2013 | void |
| 2014 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 2015 | tSirMacAddr peer, |
| 2016 | tANI_U8 wmmTspecPresent, |
| 2017 | tSirMacTSInfo *pTsinfo, |
| 2018 | tSirMacTspecIE *pTspecIe, |
| 2019 | tpPESession psessionEntry) |
| 2020 | { |
| 2021 | tANI_U8 *pFrame; |
| 2022 | tpSirMacMgmtHdr pMacHdr; |
| 2023 | tDot11fDelTS DelTS; |
| 2024 | tDot11fWMMDelTS WMMDelTS; |
| 2025 | tSirRetStatus nSirStatus; |
| 2026 | tANI_U32 nBytes, nPayload, nStatus; |
| 2027 | void *pPacket; |
| 2028 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2029 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2030 | |
| 2031 | if(NULL == psessionEntry) |
| 2032 | { |
| 2033 | return; |
| 2034 | } |
| 2035 | |
| 2036 | if ( ! wmmTspecPresent ) |
| 2037 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2038 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2039 | |
| 2040 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2041 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2042 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2043 | |
| 2044 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2045 | if ( DOT11F_FAILED( nStatus ) ) |
| 2046 | { |
| 2047 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2048 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2049 | nStatus ); |
| 2050 | // We'll fall back on the worst case scenario: |
| 2051 | nPayload = sizeof( tDot11fDelTS ); |
| 2052 | } |
| 2053 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2054 | { |
| 2055 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2056 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2057 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2058 | } |
| 2059 | } |
| 2060 | else |
| 2061 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2062 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | |
| 2064 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2065 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2066 | WMMDelTS.DialogToken.token = 0; |
| 2067 | WMMDelTS.StatusCode.statusCode = 0; |
| 2068 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2069 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2070 | if ( DOT11F_FAILED( nStatus ) ) |
| 2071 | { |
| 2072 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2073 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2074 | nStatus ); |
| 2075 | // We'll fall back on the worst case scenario: |
| 2076 | nPayload = sizeof( tDot11fDelTS ); |
| 2077 | } |
| 2078 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2079 | { |
| 2080 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2081 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2082 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2083 | } |
| 2084 | } |
| 2085 | |
| 2086 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2087 | |
| 2088 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2089 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2090 | { |
| 2091 | 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] | 2092 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2093 | return; |
| 2094 | } |
| 2095 | |
| 2096 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2097 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2098 | |
| 2099 | // Next, we fill out the buffer descriptor: |
| 2100 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2101 | SIR_MAC_MGMT_ACTION, peer, |
| 2102 | psessionEntry->selfMacAddr); |
| 2103 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2104 | { |
| 2105 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2106 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2107 | nSirStatus ); |
| 2108 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2109 | return; // allocated! |
| 2110 | } |
| 2111 | |
| 2112 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2113 | |
| 2114 | #if 0 |
| 2115 | |
| 2116 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2117 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2118 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2119 | { |
| 2120 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2121 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2122 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2123 | return; // allocated! |
| 2124 | } |
| 2125 | #endif //TO SUPPORT BT-AMP |
| 2126 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2127 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2128 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2129 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2130 | #endif |
| 2131 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2132 | // That done, pack the struct: |
| 2133 | if ( !wmmTspecPresent ) |
| 2134 | { |
| 2135 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2136 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2137 | nPayload, &nPayload ); |
| 2138 | if ( DOT11F_FAILED( nStatus ) ) |
| 2139 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2140 | 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] | 2141 | nStatus ); |
| 2142 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2143 | return; // allocated! |
| 2144 | } |
| 2145 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2146 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2147 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2148 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | } |
| 2150 | } |
| 2151 | else |
| 2152 | { |
| 2153 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2154 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2155 | nPayload, &nPayload ); |
| 2156 | if ( DOT11F_FAILED( nStatus ) ) |
| 2157 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2158 | 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] | 2159 | nStatus ); |
| 2160 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2161 | return; // allocated! |
| 2162 | } |
| 2163 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2164 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2165 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2166 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | } |
| 2168 | } |
| 2169 | |
| 2170 | PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2171 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 2172 | |
| 2173 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2174 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2175 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2176 | ) |
| 2177 | { |
| 2178 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2179 | } |
| 2180 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2181 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2182 | psessionEntry->peSessionId, |
| 2183 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2184 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2185 | HAL_TXRX_FRM_802_11_MGMT, |
| 2186 | ANI_TXDIR_TODS, |
| 2187 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2188 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2189 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2190 | psessionEntry->peSessionId, |
| 2191 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2192 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2193 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2194 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2195 | nSirStatus ); |
| 2196 | //Pkt will be freed up by the callback |
| 2197 | } |
| 2198 | |
| 2199 | } // End limSendDeltsReqActionFrame. |
| 2200 | |
| 2201 | void |
| 2202 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2203 | tLimMlmAssocReq *pMlmAssocReq, |
| 2204 | tpPESession psessionEntry) |
| 2205 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2206 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | tANI_U16 caps; |
| 2208 | tANI_U8 *pFrame; |
| 2209 | tSirRetStatus nSirStatus; |
| 2210 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2211 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2213 | void *pPacket; |
| 2214 | eHalStatus halstatus; |
| 2215 | tANI_U16 nAddIELen; |
| 2216 | tANI_U8 *pAddIE; |
| 2217 | tANI_U8 *wpsIe = NULL; |
| 2218 | #if defined WLAN_FEATURE_VOWIFI |
| 2219 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2220 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2221 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2222 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2223 | tDot11fIEExtCap extractedExtCap; |
| 2224 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2225 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2226 | |
| 2227 | if(NULL == psessionEntry) |
| 2228 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2229 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2230 | return; |
| 2231 | } |
| 2232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2233 | /* check this early to avoid unncessary operation */ |
| 2234 | if(NULL == psessionEntry->pLimJoinReq) |
| 2235 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2236 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2237 | return; |
| 2238 | } |
| 2239 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2240 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2241 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2242 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2243 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2244 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2245 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2246 | return; |
| 2247 | } |
| 2248 | |
| 2249 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2250 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2252 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 2253 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
| 2254 | &nAddIELen, |
| 2255 | &extractedExtCap ); |
| 2256 | if(eSIR_SUCCESS != nSirStatus ) |
| 2257 | { |
| 2258 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2259 | limLog(pMac, LOG1, |
| 2260 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2261 | } |
| 2262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2263 | caps = pMlmAssocReq->capabilityInfo; |
| 2264 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2265 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2266 | #if defined(FEATURE_WLAN_WAPI) |
| 2267 | /* CR: 262463 : |
| 2268 | According to WAPI standard: |
| 2269 | 7.3.1.4 Capability Information field |
| 2270 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2271 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2272 | Reassociation management frames. */ |
| 2273 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2274 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2275 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2276 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2277 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2278 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2279 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2280 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2281 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2282 | |
| 2283 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2284 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2285 | |
| 2286 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2287 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2288 | |
| 2289 | // We prefer .11e asociations: |
| 2290 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2291 | |
| 2292 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2293 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2294 | |
| 2295 | if ( psessionEntry->lim11hEnable && |
| 2296 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2297 | { |
| 2298 | #if defined WLAN_FEATURE_VOWIFI |
| 2299 | PowerCapsPopulated = TRUE; |
| 2300 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2301 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2302 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2303 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2304 | |
| 2305 | } |
| 2306 | |
| 2307 | #if defined WLAN_FEATURE_VOWIFI |
| 2308 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2309 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2310 | { |
| 2311 | if (PowerCapsPopulated == FALSE) |
| 2312 | { |
| 2313 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2314 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | } |
| 2316 | } |
| 2317 | #endif |
| 2318 | |
| 2319 | if ( fQosEnabled && |
| 2320 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2321 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2322 | |
| 2323 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2324 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2325 | |
| 2326 | #if defined WLAN_FEATURE_VOWIFI |
| 2327 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2328 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2329 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2330 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2331 | } |
| 2332 | #endif |
| 2333 | // The join request *should* contain zero or one of the WPA and RSN |
| 2334 | // IEs. The payload send along with the request is a |
| 2335 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2336 | |
| 2337 | // typedef struct sSirRSNie |
| 2338 | // { |
| 2339 | // tANI_U16 length; |
| 2340 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2341 | // } tSirRSNie, *tpSirRSNie; |
| 2342 | |
| 2343 | // So, we should be able to make the following two calls harmlessly, |
| 2344 | // since they do nothing if they don't find the given IE in the |
| 2345 | // bytestream with which they're provided. |
| 2346 | |
| 2347 | // The net effect of this will be to faithfully transmit whatever |
| 2348 | // security IE is in the join request. |
| 2349 | |
| 2350 | // *However*, if we're associating for the purpose of WPS |
| 2351 | // enrollment, and we've been configured to indicate that by |
| 2352 | // eliding the WPA or RSN IE, we just skip this: |
| 2353 | if( nAddIELen && pAddIE ) |
| 2354 | { |
| 2355 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2356 | } |
| 2357 | if ( NULL == wpsIe ) |
| 2358 | { |
| 2359 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2360 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2361 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2362 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2363 | #if defined(FEATURE_WLAN_WAPI) |
| 2364 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2365 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2366 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2367 | } |
| 2368 | |
| 2369 | // include WME EDCA IE as well |
| 2370 | if ( fWmeEnabled ) |
| 2371 | { |
| 2372 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2373 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2374 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2375 | } |
| 2376 | |
| 2377 | if ( fWsmEnabled && |
| 2378 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2379 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2380 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | } |
| 2382 | } |
| 2383 | |
| 2384 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2385 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2386 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | pMac->lim.htCapabilityPresentInBeacon) |
| 2388 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2389 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2390 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2391 | |
| 2392 | /* |
| 2393 | * To resolve the interop problem with Broadcom AP, |
| 2394 | * where TQ STA could not pass traffic with GF enabled, |
| 2395 | * TQ STA will do Greenfield only with TQ AP, for |
| 2396 | * everybody else it will be turned off. |
| 2397 | */ |
| 2398 | |
| 2399 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2400 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2401 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2402 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2403 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2404 | } |
| 2405 | #endif |
| 2406 | |
| 2407 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2408 | #ifdef WLAN_FEATURE_11AC |
| 2409 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2410 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2411 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2412 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2413 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2414 | } |
| 2415 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2416 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2417 | |
| 2418 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2419 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2420 | { |
| 2421 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2422 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2423 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2424 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2425 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2426 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2427 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2428 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2429 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2430 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2431 | { |
| 2432 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2433 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2434 | } |
| 2435 | #endif |
| 2436 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2437 | #ifdef FEATURE_WLAN_ESE |
| 2438 | /* For ESE Associations fill the ESE IEs */ |
| 2439 | if (psessionEntry->isESEconnection && |
| 2440 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2441 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2442 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2443 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2444 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2445 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2446 | } |
| 2447 | #endif |
| 2448 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2449 | /* merge the ExtCap struct*/ |
| 2450 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2451 | { |
| 2452 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 2453 | } |
| 2454 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2455 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2456 | if ( DOT11F_FAILED( nStatus ) ) |
| 2457 | { |
| 2458 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2459 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2460 | nStatus ); |
| 2461 | // We'll fall back on the worst case scenario: |
| 2462 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2463 | } |
| 2464 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2465 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2466 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2468 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2469 | } |
| 2470 | |
| 2471 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2472 | |
| 2473 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2474 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2475 | ( void** ) &pPacket ); |
| 2476 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2477 | { |
| 2478 | 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] | 2479 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2480 | |
| 2481 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2482 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2483 | |
| 2484 | |
| 2485 | /* Update PE session id*/ |
| 2486 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2487 | |
| 2488 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2489 | |
| 2490 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2491 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2492 | |
| 2493 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2494 | ( tANI_U32* ) &mlmAssocCnf); |
| 2495 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2496 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2497 | return; |
| 2498 | } |
| 2499 | |
| 2500 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2501 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2502 | |
| 2503 | // Next, we fill out the buffer descriptor: |
| 2504 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2505 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2506 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2507 | { |
| 2508 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2509 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2510 | nSirStatus ); |
| 2511 | 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] | 2512 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2513 | return; |
| 2514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2515 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2516 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2517 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2518 | sizeof(tSirMacMgmtHdr), |
| 2519 | nPayload, &nPayload ); |
| 2520 | if ( DOT11F_FAILED( nStatus ) ) |
| 2521 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2522 | 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] | 2523 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2524 | nStatus ); |
| 2525 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2526 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2527 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2528 | return; |
| 2529 | } |
| 2530 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2531 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2532 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2533 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2534 | } |
| 2535 | |
| 2536 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2537 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2538 | nBytes );) |
| 2539 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2540 | |
| 2541 | if( psessionEntry->assocReq != NULL ) |
| 2542 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2543 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | psessionEntry->assocReq = NULL; |
| 2545 | } |
| 2546 | |
| 2547 | if( nAddIELen ) |
| 2548 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2549 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2550 | pAddIE, |
| 2551 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | nPayload += nAddIELen; |
| 2553 | } |
| 2554 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2555 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2556 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2557 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2558 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2559 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2560 | } |
| 2561 | else |
| 2562 | { |
| 2563 | //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] | 2564 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2565 | psessionEntry->assocReqLen = nPayload; |
| 2566 | } |
| 2567 | |
| 2568 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2569 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2570 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2571 | ) |
| 2572 | { |
| 2573 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2574 | } |
| 2575 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2576 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2577 | { |
| 2578 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2579 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2580 | |
| 2581 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2582 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2583 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2584 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2585 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2586 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2587 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2588 | psessionEntry->peSessionId, |
| 2589 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2590 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2591 | HAL_TXRX_FRM_802_11_MGMT, |
| 2592 | ANI_TXDIR_TODS, |
| 2593 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2594 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2595 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2596 | psessionEntry->peSessionId, |
| 2597 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2598 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2599 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2600 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2601 | halstatus ); |
| 2602 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2603 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2604 | return; |
| 2605 | } |
| 2606 | |
| 2607 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2608 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2609 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2610 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2611 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2612 | } // End limSendAssocReqMgmtFrame |
| 2613 | |
| 2614 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2615 | #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] | 2616 | /*------------------------------------------------------------------------------------ |
| 2617 | * |
| 2618 | * Send Reassoc Req with FTIEs. |
| 2619 | * |
| 2620 | *----------------------------------------------------------------------------------- |
| 2621 | */ |
| 2622 | void |
| 2623 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2624 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2625 | { |
| 2626 | static tDot11fReAssocRequest frm; |
| 2627 | tANI_U16 caps; |
| 2628 | tANI_U8 *pFrame; |
| 2629 | tSirRetStatus nSirStatus; |
| 2630 | tANI_U32 nBytes, nPayload, nStatus; |
| 2631 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2632 | void *pPacket; |
| 2633 | eHalStatus halstatus; |
| 2634 | #if defined WLAN_FEATURE_VOWIFI |
| 2635 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2636 | #endif |
| 2637 | tANI_U16 ft_ies_length = 0; |
| 2638 | tANI_U8 *pBody; |
| 2639 | tANI_U16 nAddIELen; |
| 2640 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2641 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2642 | tANI_U8 *wpsIe = NULL; |
| 2643 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2644 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2645 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2646 | |
| 2647 | if (NULL == psessionEntry) |
| 2648 | { |
| 2649 | return; |
| 2650 | } |
| 2651 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2652 | /* check this early to avoid unncessary operation */ |
| 2653 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2654 | { |
| 2655 | return; |
| 2656 | } |
| 2657 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2658 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2659 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2660 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2661 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2662 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2663 | |
| 2664 | caps = pMlmReassocReq->capabilityInfo; |
| 2665 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2666 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2667 | #if defined(FEATURE_WLAN_WAPI) |
| 2668 | /* CR: 262463 : |
| 2669 | According to WAPI standard: |
| 2670 | 7.3.1.4 Capability Information field |
| 2671 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2672 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2673 | Reassociation management frames. */ |
| 2674 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2675 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2676 | #endif |
| 2677 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2678 | |
| 2679 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2680 | |
| 2681 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2682 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2684 | |
| 2685 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2686 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2687 | &frm.SuppRates,psessionEntry); |
| 2688 | |
| 2689 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2690 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2691 | |
| 2692 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2693 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2694 | |
| 2695 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2696 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2697 | |
| 2698 | if ( psessionEntry->lim11hEnable && |
| 2699 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2700 | { |
| 2701 | #if defined WLAN_FEATURE_VOWIFI |
| 2702 | PowerCapsPopulated = TRUE; |
| 2703 | |
| 2704 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2705 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2706 | #endif |
| 2707 | } |
| 2708 | |
| 2709 | #if defined WLAN_FEATURE_VOWIFI |
| 2710 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2711 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2712 | { |
| 2713 | if (PowerCapsPopulated == FALSE) |
| 2714 | { |
| 2715 | PowerCapsPopulated = TRUE; |
| 2716 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2717 | } |
| 2718 | } |
| 2719 | #endif |
| 2720 | |
| 2721 | if ( fQosEnabled && |
| 2722 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2723 | { |
| 2724 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2725 | } |
| 2726 | |
| 2727 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2728 | &frm.ExtSuppRates, psessionEntry ); |
| 2729 | |
| 2730 | #if defined WLAN_FEATURE_VOWIFI |
| 2731 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2732 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2733 | { |
| 2734 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2735 | } |
| 2736 | #endif |
| 2737 | |
| 2738 | // Ideally this should be enabled for 11r also. But 11r does |
| 2739 | // not follow the usual norm of using the Opaque object |
| 2740 | // for rsnie and fties. Instead we just add |
| 2741 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2742 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2743 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2744 | // |
| 2745 | // The join request *should* contain zero or one of the WPA and RSN |
| 2746 | // IEs. The payload send along with the request is a |
| 2747 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2748 | |
| 2749 | // typedef struct sSirRSNie |
| 2750 | // { |
| 2751 | // tANI_U16 length; |
| 2752 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2753 | // } tSirRSNie, *tpSirRSNie; |
| 2754 | |
| 2755 | // So, we should be able to make the following two calls harmlessly, |
| 2756 | // since they do nothing if they don't find the given IE in the |
| 2757 | // bytestream with which they're provided. |
| 2758 | |
| 2759 | // The net effect of this will be to faithfully transmit whatever |
| 2760 | // security IE is in the join request. |
| 2761 | |
| 2762 | // *However*, if we're associating for the purpose of WPS |
| 2763 | // enrollment, and we've been configured to indicate that by |
| 2764 | // eliding the WPA or RSN IE, we just skip this: |
| 2765 | if (!psessionEntry->is11Rconnection) |
| 2766 | { |
| 2767 | if( nAddIELen && pAddIE ) |
| 2768 | { |
| 2769 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2770 | } |
| 2771 | if ( NULL == wpsIe ) |
| 2772 | { |
| 2773 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2774 | &frm.RSNOpaque ); |
| 2775 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2776 | &frm.WPAOpaque ); |
| 2777 | } |
| 2778 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2779 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2780 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2781 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2782 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2783 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2784 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2785 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2786 | } |
| 2787 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2788 | #ifdef FEATURE_WLAN_ESE |
| 2789 | // For ESE Associations fill the ESE IEs |
| 2790 | if (psessionEntry->isESEconnection && |
| 2791 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2792 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2793 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2794 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2795 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2796 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2797 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2798 | #endif //FEATURE_WLAN_ESE |
| 2799 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2800 | |
| 2801 | // include WME EDCA IE as well |
| 2802 | if ( fWmeEnabled ) |
| 2803 | { |
| 2804 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2805 | { |
| 2806 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2807 | } |
| 2808 | |
| 2809 | if ( fWsmEnabled && |
| 2810 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2811 | { |
| 2812 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2813 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2814 | #ifdef FEATURE_WLAN_ESE |
| 2815 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2816 | { |
| 2817 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2818 | |
| 2819 | // 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] | 2820 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2821 | { |
| 2822 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2823 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2824 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2825 | |
| 2826 | tsrsIE.tsid = 0; |
| 2827 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2828 | { |
| 2829 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2830 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2831 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2832 | { |
| 2833 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2834 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2835 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | } |
| 2837 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2838 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2839 | } |
| 2840 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2841 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2842 | pMac->lim.htCapabilityPresentInBeacon) |
| 2843 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2844 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2845 | } |
| 2846 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2847 | #if defined WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2848 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && (0 == pMac->ft.ftSmeContext.reassoc_ft_ies_length) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2849 | #if defined FEATURE_WLAN_ESE |
| 2850 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2851 | #endif |
| 2852 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2853 | { |
| 2854 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2855 | } |
| 2856 | #endif |
| 2857 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2858 | #ifdef WLAN_FEATURE_11AC |
| 2859 | if ( psessionEntry->vhtCapability && |
| 2860 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2861 | { |
| 2862 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
| 2863 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2864 | } |
| 2865 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2866 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2869 | if ( DOT11F_FAILED( nStatus ) ) |
| 2870 | { |
| 2871 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2872 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2873 | nStatus ); |
| 2874 | // We'll fall back on the worst case scenario: |
| 2875 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2876 | } |
| 2877 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2878 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2879 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2881 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2882 | } |
| 2883 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2884 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2885 | |
| 2886 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2887 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2888 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2889 | #endif |
| 2890 | |
| 2891 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2892 | if (psessionEntry->is11Rconnection) |
| 2893 | { |
| 2894 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2895 | } |
| 2896 | #endif |
| 2897 | |
| 2898 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2899 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2900 | ( void** ) &pPacket ); |
| 2901 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2902 | { |
| 2903 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2904 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2905 | 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] | 2906 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2907 | goto end; |
| 2908 | } |
| 2909 | |
| 2910 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2911 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2912 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2913 | #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] | 2914 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2915 | #endif |
| 2916 | // Next, we fill out the buffer descriptor: |
| 2917 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2918 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2919 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2920 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2921 | { |
| 2922 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2923 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2924 | nSirStatus ); |
| 2925 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2926 | goto end; |
| 2927 | } |
| 2928 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2929 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2930 | // That done, pack the ReAssoc Request: |
| 2931 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2932 | sizeof(tSirMacMgmtHdr), |
| 2933 | nPayload, &nPayload ); |
| 2934 | if ( DOT11F_FAILED( nStatus ) ) |
| 2935 | { |
| 2936 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2937 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2938 | nStatus ); |
| 2939 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2940 | goto end; |
| 2941 | } |
| 2942 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2943 | { |
| 2944 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2945 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2946 | } |
| 2947 | |
| 2948 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2949 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2950 | nBytes, nPayload );) |
| 2951 | if( psessionEntry->assocReq != NULL ) |
| 2952 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2953 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2954 | psessionEntry->assocReq = NULL; |
| 2955 | } |
| 2956 | |
| 2957 | if( nAddIELen ) |
| 2958 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2959 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2960 | pAddIE, |
| 2961 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2962 | nPayload += nAddIELen; |
| 2963 | } |
| 2964 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2965 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2966 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2967 | { |
| 2968 | 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] | 2969 | } |
| 2970 | else |
| 2971 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2972 | //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] | 2973 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2974 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2975 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2976 | |
| 2977 | if (psessionEntry->is11Rconnection) |
| 2978 | { |
| 2979 | { |
| 2980 | int i = 0; |
| 2981 | |
| 2982 | pBody = pFrame + nBytes; |
| 2983 | for (i=0; i<ft_ies_length; i++) |
| 2984 | { |
| 2985 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2986 | pBody++; |
| 2987 | } |
| 2988 | } |
| 2989 | } |
| 2990 | |
| 2991 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2992 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2993 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2994 | (tANI_U8 *)pFrame, |
| 2995 | (nBytes + ft_ies_length));) |
| 2996 | #endif |
| 2997 | |
| 2998 | |
| 2999 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3000 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3001 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3002 | ) |
| 3003 | { |
| 3004 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3005 | } |
| 3006 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3007 | if( NULL != psessionEntry->assocReq ) |
| 3008 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3009 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3010 | psessionEntry->assocReq = NULL; |
| 3011 | } |
| 3012 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3013 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3014 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3015 | { |
| 3016 | 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] | 3017 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3018 | } |
| 3019 | else |
| 3020 | { |
| 3021 | //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] | 3022 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3023 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3024 | psessionEntry->assocReqLen = (ft_ies_length); |
| 3025 | } |
| 3026 | |
| 3027 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3028 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3029 | psessionEntry->peSessionId, |
| 3030 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3031 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3032 | HAL_TXRX_FRM_802_11_MGMT, |
| 3033 | ANI_TXDIR_TODS, |
| 3034 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3035 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3036 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3037 | psessionEntry->peSessionId, |
| 3038 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3039 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3040 | { |
| 3041 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3042 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3043 | nSirStatus ); |
| 3044 | //Pkt will be freed up by the callback |
| 3045 | goto end; |
| 3046 | } |
| 3047 | |
| 3048 | end: |
| 3049 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3050 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3051 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3052 | |
| 3053 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3054 | |
| 3055 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3056 | tLimMlmReassocReq *pMlmReassocReq, |
| 3057 | tpPESession psessionEntry) |
| 3058 | { |
| 3059 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3060 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 3061 | if(NULL == pTmpMlmReassocReq) |
| 3062 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3063 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3064 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3065 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3066 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3067 | } |
| 3068 | |
| 3069 | // Prepare and send Reassociation request frame |
| 3070 | // start reassoc timer. |
| 3071 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3072 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3073 | 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] | 3074 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3075 | != TX_SUCCESS) |
| 3076 | { |
| 3077 | // Could not start reassoc failure timer. |
| 3078 | // Log error |
| 3079 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3080 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3081 | // Return Reassoc confirm with |
| 3082 | // Resources Unavailable |
| 3083 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3084 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3085 | goto end; |
| 3086 | } |
| 3087 | |
| 3088 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3089 | return; |
| 3090 | |
| 3091 | end: |
| 3092 | // Free up buffer allocated for reassocReq |
| 3093 | if (pMlmReassocReq != NULL) |
| 3094 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3095 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3096 | pMlmReassocReq = NULL; |
| 3097 | } |
| 3098 | if (pTmpMlmReassocReq != NULL) |
| 3099 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3100 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3101 | pTmpMlmReassocReq = NULL; |
| 3102 | } |
| 3103 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3104 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3105 | /* Update PE sessio Id*/ |
| 3106 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3107 | |
| 3108 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3109 | } |
| 3110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3112 | |
| 3113 | |
| 3114 | void |
| 3115 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3116 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3117 | { |
| 3118 | static tDot11fReAssocRequest frm; |
| 3119 | tANI_U16 caps; |
| 3120 | tANI_U8 *pFrame; |
| 3121 | tSirRetStatus nSirStatus; |
| 3122 | tANI_U32 nBytes, nPayload, nStatus; |
| 3123 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3124 | void *pPacket; |
| 3125 | eHalStatus halstatus; |
| 3126 | tANI_U16 nAddIELen; |
| 3127 | tANI_U8 *pAddIE; |
| 3128 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3129 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3130 | #if defined WLAN_FEATURE_VOWIFI |
| 3131 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3132 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3133 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3134 | |
| 3135 | if(NULL == psessionEntry) |
| 3136 | { |
| 3137 | return; |
| 3138 | } |
| 3139 | |
| 3140 | /* check this early to avoid unncessary operation */ |
| 3141 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3142 | { |
| 3143 | return; |
| 3144 | } |
| 3145 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3146 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3147 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3148 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | |
| 3150 | caps = pMlmReassocReq->capabilityInfo; |
| 3151 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3152 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3153 | #if defined(FEATURE_WLAN_WAPI) |
| 3154 | /* CR: 262463 : |
| 3155 | According to WAPI standard: |
| 3156 | 7.3.1.4 Capability Information field |
| 3157 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3158 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3159 | Reassociation management frames. */ |
| 3160 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3161 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3162 | #endif |
| 3163 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3164 | |
| 3165 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3166 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3167 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3168 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3169 | |
| 3170 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3171 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3172 | &frm.SuppRates,psessionEntry); |
| 3173 | |
| 3174 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3175 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3176 | |
| 3177 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3178 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3179 | |
| 3180 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3181 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3182 | |
| 3183 | |
| 3184 | if ( psessionEntry->lim11hEnable && |
| 3185 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3186 | { |
| 3187 | #if defined WLAN_FEATURE_VOWIFI |
| 3188 | PowerCapsPopulated = TRUE; |
| 3189 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3190 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3191 | #endif |
| 3192 | } |
| 3193 | |
| 3194 | #if defined WLAN_FEATURE_VOWIFI |
| 3195 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3196 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3197 | { |
| 3198 | if (PowerCapsPopulated == FALSE) |
| 3199 | { |
| 3200 | PowerCapsPopulated = TRUE; |
| 3201 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3202 | } |
| 3203 | } |
| 3204 | #endif |
| 3205 | |
| 3206 | if ( fQosEnabled && |
| 3207 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3208 | { |
| 3209 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3210 | } |
| 3211 | |
| 3212 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3213 | &frm.ExtSuppRates, psessionEntry ); |
| 3214 | |
| 3215 | #if defined WLAN_FEATURE_VOWIFI |
| 3216 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3217 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3218 | { |
| 3219 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3220 | } |
| 3221 | #endif |
| 3222 | // The join request *should* contain zero or one of the WPA and RSN |
| 3223 | // IEs. The payload send along with the request is a |
| 3224 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3225 | |
| 3226 | // typedef struct sSirRSNie |
| 3227 | // { |
| 3228 | // tANI_U16 length; |
| 3229 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3230 | // } tSirRSNie, *tpSirRSNie; |
| 3231 | |
| 3232 | // So, we should be able to make the following two calls harmlessly, |
| 3233 | // since they do nothing if they don't find the given IE in the |
| 3234 | // bytestream with which they're provided. |
| 3235 | |
| 3236 | // The net effect of this will be to faithfully transmit whatever |
| 3237 | // security IE is in the join request. |
| 3238 | |
| 3239 | // *However*, if we're associating for the purpose of WPS |
| 3240 | // enrollment, and we've been configured to indicate that by |
| 3241 | // eliding the WPA or RSN IE, we just skip this: |
| 3242 | if( nAddIELen && pAddIE ) |
| 3243 | { |
| 3244 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3245 | } |
| 3246 | if ( NULL == wpsIe ) |
| 3247 | { |
| 3248 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3249 | &frm.RSNOpaque ); |
| 3250 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3251 | &frm.WPAOpaque ); |
| 3252 | #if defined(FEATURE_WLAN_WAPI) |
| 3253 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3254 | &frm.WAPIOpaque ); |
| 3255 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3256 | } |
| 3257 | |
| 3258 | // include WME EDCA IE as well |
| 3259 | if ( fWmeEnabled ) |
| 3260 | { |
| 3261 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3262 | { |
| 3263 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3264 | } |
| 3265 | |
| 3266 | if ( fWsmEnabled && |
| 3267 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3268 | { |
| 3269 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3270 | } |
| 3271 | } |
| 3272 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3273 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3274 | pMac->lim.htCapabilityPresentInBeacon) |
| 3275 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3276 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3277 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3278 | #ifdef WLAN_FEATURE_11AC |
| 3279 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3280 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3281 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3282 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3283 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3284 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3285 | } |
| 3286 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3287 | |
| 3288 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3289 | if ( DOT11F_FAILED( nStatus ) ) |
| 3290 | { |
| 3291 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3292 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3293 | nStatus ); |
| 3294 | // We'll fall back on the worst case scenario: |
| 3295 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3296 | } |
| 3297 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3298 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3299 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3300 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3301 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | } |
| 3303 | |
| 3304 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3305 | |
| 3306 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3307 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3308 | ( void** ) &pPacket ); |
| 3309 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3310 | { |
| 3311 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3312 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3313 | 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] | 3314 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3315 | goto end; |
| 3316 | } |
| 3317 | |
| 3318 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3319 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3320 | |
| 3321 | // Next, we fill out the buffer descriptor: |
| 3322 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3323 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3324 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3325 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3326 | { |
| 3327 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3328 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3329 | nSirStatus ); |
| 3330 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3331 | goto end; |
| 3332 | } |
| 3333 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3334 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3335 | // That done, pack the Probe Request: |
| 3336 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3337 | sizeof(tSirMacMgmtHdr), |
| 3338 | nPayload, &nPayload ); |
| 3339 | if ( DOT11F_FAILED( nStatus ) ) |
| 3340 | { |
| 3341 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3342 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3343 | nStatus ); |
| 3344 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3345 | goto end; |
| 3346 | } |
| 3347 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3348 | { |
| 3349 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3350 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3351 | } |
| 3352 | |
| 3353 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3354 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3355 | nBytes );) |
| 3356 | |
| 3357 | if( psessionEntry->assocReq != NULL ) |
| 3358 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3359 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3360 | psessionEntry->assocReq = NULL; |
| 3361 | } |
| 3362 | |
| 3363 | if( nAddIELen ) |
| 3364 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3365 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3366 | pAddIE, |
| 3367 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3368 | nPayload += nAddIELen; |
| 3369 | } |
| 3370 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3371 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3372 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3373 | { |
| 3374 | 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] | 3375 | } |
| 3376 | else |
| 3377 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3378 | //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] | 3379 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3382 | |
| 3383 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3384 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3385 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | ) |
| 3387 | { |
| 3388 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3389 | } |
| 3390 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3391 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3392 | { |
| 3393 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3394 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3395 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3396 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3397 | psessionEntry->peSessionId, |
| 3398 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3399 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3400 | HAL_TXRX_FRM_802_11_MGMT, |
| 3401 | ANI_TXDIR_TODS, |
| 3402 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3403 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3404 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3405 | psessionEntry->peSessionId, |
| 3406 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3407 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3408 | { |
| 3409 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3410 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3411 | nSirStatus ); |
| 3412 | //Pkt will be freed up by the callback |
| 3413 | goto end; |
| 3414 | } |
| 3415 | |
| 3416 | end: |
| 3417 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3418 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3419 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3420 | |
| 3421 | } // limSendReassocReqMgmtFrame |
| 3422 | |
| 3423 | /** |
| 3424 | * \brief Send an Authentication frame |
| 3425 | * |
| 3426 | * |
| 3427 | * \param pMac Pointer to Global MAC structure |
| 3428 | * |
| 3429 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3430 | * to be sent |
| 3431 | * |
| 3432 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3433 | * frame is destined |
| 3434 | * |
| 3435 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3436 | * Authentication frame3 |
| 3437 | * |
| 3438 | * |
| 3439 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3440 | * is formatted and sent when this function is called. |
| 3441 | * |
| 3442 | * |
| 3443 | */ |
| 3444 | |
| 3445 | void |
| 3446 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3447 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3448 | tSirMacAddr peerMacAddr, |
| 3449 | tANI_U8 wepBit, |
| 3450 | tpPESession psessionEntry |
| 3451 | ) |
| 3452 | { |
| 3453 | tANI_U8 *pFrame, *pBody; |
| 3454 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3455 | tpSirMacMgmtHdr pMacHdr; |
| 3456 | tANI_U16 i; |
| 3457 | void *pPacket; |
| 3458 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3459 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3460 | |
| 3461 | if(NULL == psessionEntry) |
| 3462 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3463 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3464 | return; |
| 3465 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3466 | |
| 3467 | limLog(pMac, LOG1, |
| 3468 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3469 | pAuthFrameBody->authTransactionSeqNumber, |
| 3470 | pAuthFrameBody->authStatusCode, |
| 3471 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3472 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3473 | if (wepBit == LIM_WEP_IN_FC) |
| 3474 | { |
| 3475 | /// Auth frame3 to be sent with encrypted framebody |
| 3476 | /** |
| 3477 | * Allocate buffer for Authenticaton frame of size equal |
| 3478 | * to management frame header length plus 2 bytes each for |
| 3479 | * auth algorithm number, transaction number, status code, |
| 3480 | * 128 bytes for challenge text and 4 bytes each for |
| 3481 | * IV & ICV. |
| 3482 | */ |
| 3483 | |
| 3484 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3485 | |
| 3486 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3487 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3488 | else |
| 3489 | { |
| 3490 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3491 | { |
| 3492 | case SIR_MAC_AUTH_FRAME_1: |
| 3493 | /** |
| 3494 | * Allocate buffer for Authenticaton frame of size |
| 3495 | * equal to management frame header length plus 2 bytes |
| 3496 | * each for auth algorithm number, transaction number |
| 3497 | * and status code. |
| 3498 | */ |
| 3499 | |
| 3500 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3501 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3502 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3503 | |
| 3504 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3505 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3506 | { |
| 3507 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3508 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3509 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3510 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3511 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3512 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3513 | else |
| 3514 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3515 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3516 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3517 | frameLen += (2+SIR_MDIE_SIZE); |
| 3518 | } |
| 3519 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3520 | #endif |
| 3521 | break; |
| 3522 | |
| 3523 | case SIR_MAC_AUTH_FRAME_2: |
| 3524 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3525 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3526 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3527 | { |
| 3528 | /** |
| 3529 | * Allocate buffer for Authenticaton frame of size |
| 3530 | * equal to management frame header length plus |
| 3531 | * 2 bytes each for auth algorithm number, |
| 3532 | * transaction number and status code. |
| 3533 | */ |
| 3534 | |
| 3535 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3536 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3537 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3538 | } |
| 3539 | else |
| 3540 | { |
| 3541 | // Shared Key algorithm with challenge text |
| 3542 | // to be sent |
| 3543 | /** |
| 3544 | * Allocate buffer for Authenticaton frame of size |
| 3545 | * equal to management frame header length plus |
| 3546 | * 2 bytes each for auth algorithm number, |
| 3547 | * transaction number, status code and 128 bytes |
| 3548 | * for challenge text. |
| 3549 | */ |
| 3550 | |
| 3551 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3552 | sizeof(tSirMacAuthFrame); |
| 3553 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3554 | } |
| 3555 | |
| 3556 | break; |
| 3557 | |
| 3558 | case SIR_MAC_AUTH_FRAME_3: |
| 3559 | /// Auth frame3 to be sent without encrypted framebody |
| 3560 | /** |
| 3561 | * Allocate buffer for Authenticaton frame of size equal |
| 3562 | * to management frame header length plus 2 bytes each |
| 3563 | * for auth algorithm number, transaction number and |
| 3564 | * status code. |
| 3565 | */ |
| 3566 | |
| 3567 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3568 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3569 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3570 | |
| 3571 | break; |
| 3572 | |
| 3573 | case SIR_MAC_AUTH_FRAME_4: |
| 3574 | /** |
| 3575 | * Allocate buffer for Authenticaton frame of size equal |
| 3576 | * to management frame header length plus 2 bytes each |
| 3577 | * for auth algorithm number, transaction number and |
| 3578 | * status code. |
| 3579 | */ |
| 3580 | |
| 3581 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3582 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3583 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3584 | |
| 3585 | break; |
| 3586 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3587 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3588 | |
| 3589 | |
| 3590 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3591 | |
| 3592 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3593 | { |
| 3594 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3595 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3596 | |
| 3597 | return; |
| 3598 | } |
| 3599 | |
| 3600 | for (i = 0; i < frameLen; i++) |
| 3601 | pFrame[i] = 0; |
| 3602 | |
| 3603 | // Prepare BD |
| 3604 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3605 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3606 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3607 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3608 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3609 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3610 | return; |
| 3611 | } |
| 3612 | |
| 3613 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3614 | pMacHdr->fc.wep = wepBit; |
| 3615 | |
| 3616 | // Prepare BSSId |
| 3617 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3618 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3619 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3620 | (tANI_U8 *) psessionEntry->bssId, |
| 3621 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3622 | } |
| 3623 | |
| 3624 | /// Prepare Authentication frame body |
| 3625 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3626 | |
| 3627 | if (wepBit == LIM_WEP_IN_FC) |
| 3628 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3629 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3630 | |
| 3631 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3632 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3633 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3634 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3635 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3636 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3637 | } |
| 3638 | else |
| 3639 | { |
| 3640 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3641 | pBody += sizeof(tANI_U16); |
| 3642 | bodyLen -= sizeof(tANI_U16); |
| 3643 | |
| 3644 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3645 | pBody += sizeof(tANI_U16); |
| 3646 | bodyLen -= sizeof(tANI_U16); |
| 3647 | |
| 3648 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3649 | pBody += sizeof(tANI_U16); |
| 3650 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3651 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3652 | sizeof (pAuthFrameBody->length) + |
| 3653 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3654 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | |
| 3656 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3657 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3658 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3659 | { |
| 3660 | |
| 3661 | { |
| 3662 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3663 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3664 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3665 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3666 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3667 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3668 | (tANI_U8 *)pBody, |
| 3669 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3670 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3671 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3672 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3673 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3674 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3675 | } |
| 3676 | } |
| 3677 | else |
| 3678 | { |
| 3679 | /* MDID attr is 54*/ |
| 3680 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3681 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3682 | *pBody = SIR_MDIE_SIZE; |
| 3683 | pBody++; |
| 3684 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3685 | { |
| 3686 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3687 | pBody++; |
| 3688 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3689 | } |
| 3690 | } |
| 3691 | } |
| 3692 | #endif |
| 3693 | |
| 3694 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3695 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3696 | pAuthFrameBody->authTransactionSeqNumber, |
| 3697 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3698 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3699 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3700 | } |
| 3701 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3702 | |
| 3703 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3704 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3705 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3706 | #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] | 3707 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3708 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3709 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3710 | ) |
| 3711 | { |
| 3712 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3713 | } |
| 3714 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3715 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3716 | { |
| 3717 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3718 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3719 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 3720 | limLog( pMac, LOG1, FL("Sending Auth Frame over WQ5 to "MAC_ADDRESS_STR |
| 3721 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 3722 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3723 | |
| 3724 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3725 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3726 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3727 | psessionEntry->peSessionId, |
| 3728 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3729 | /// Queue Authentication frame in high priority WQ |
| 3730 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3731 | HAL_TXRX_FRM_802_11_MGMT, |
| 3732 | ANI_TXDIR_TODS, |
| 3733 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3734 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3735 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3736 | psessionEntry->peSessionId, |
| 3737 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3739 | { |
| 3740 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3741 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | halstatus); |
| 3743 | |
| 3744 | //Pkt will be freed up by the callback |
| 3745 | } |
| 3746 | |
| 3747 | return; |
| 3748 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3749 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3750 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3751 | { |
| 3752 | tANI_U16 aid; |
| 3753 | tpDphHashNode pStaDs; |
| 3754 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3755 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3756 | tpPESession psessionEntry; |
| 3757 | |
| 3758 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3759 | if (pMlmDeauthReq) |
| 3760 | { |
| 3761 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3762 | { |
| 3763 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3764 | } |
| 3765 | |
| 3766 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3767 | { |
| 3768 | |
| 3769 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3770 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3771 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3772 | goto end; |
| 3773 | } |
| 3774 | |
| 3775 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3776 | if (pStaDs == NULL) |
| 3777 | { |
| 3778 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3779 | goto end; |
| 3780 | } |
| 3781 | |
| 3782 | |
| 3783 | /// Receive path cleanup with dummy packet |
| 3784 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3785 | |
| 3786 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3787 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
| 3788 | ( |
| 3789 | #ifdef FEATURE_WLAN_ESE |
| 3790 | (psessionEntry->isESEconnection ) || |
| 3791 | #endif |
| 3792 | #ifdef FEATURE_WLAN_LFR |
| 3793 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
| 3794 | #endif |
| 3795 | (psessionEntry->is11Rconnection ))) |
| 3796 | { |
| 3797 | PELOGE(limLog(pMac, LOGE, |
| 3798 | FL("FT Preauth Session (%p,%d) Cleanup" |
| 3799 | " Deauth reason %d Trigger = %d"), |
| 3800 | psessionEntry, psessionEntry->peSessionId, |
| 3801 | pMlmDeauthReq->reasonCode, |
| 3802 | pMlmDeauthReq->deauthTrigger);); |
| 3803 | limFTCleanup(pMac); |
| 3804 | } |
| 3805 | else |
| 3806 | { |
| 3807 | PELOGE(limLog(pMac, LOGE, |
| 3808 | FL("No FT Preauth Session Cleanup in role %d" |
| 3809 | #ifdef FEATURE_WLAN_ESE |
| 3810 | " isESE %d" |
| 3811 | #endif |
| 3812 | #ifdef FEATURE_WLAN_LFR |
| 3813 | " isLFR %d" |
| 3814 | #endif |
| 3815 | " is11r %d, Deauth reason %d Trigger = %d"), |
| 3816 | psessionEntry->limSystemRole, |
| 3817 | #ifdef FEATURE_WLAN_ESE |
| 3818 | psessionEntry->isESEconnection, |
| 3819 | #endif |
| 3820 | #ifdef FEATURE_WLAN_LFR |
| 3821 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3822 | #endif |
| 3823 | psessionEntry->is11Rconnection, |
| 3824 | pMlmDeauthReq->reasonCode, |
| 3825 | pMlmDeauthReq->deauthTrigger);); |
| 3826 | } |
| 3827 | #endif |
| 3828 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3829 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3830 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3831 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3832 | } |
| 3833 | return eHAL_STATUS_SUCCESS; |
| 3834 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3835 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3836 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3837 | sizeof(tSirMacAddr)); |
| 3838 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3839 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3840 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3841 | |
| 3842 | // Free up buffer allocated |
| 3843 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3844 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3845 | |
| 3846 | limPostSmeMessage(pMac, |
| 3847 | LIM_MLM_DEAUTH_CNF, |
| 3848 | (tANI_U32 *) &mlmDeauthCnf); |
| 3849 | return eHAL_STATUS_SUCCESS; |
| 3850 | } |
| 3851 | |
| 3852 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3853 | { |
| 3854 | tANI_U16 aid; |
| 3855 | tpDphHashNode pStaDs; |
| 3856 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3857 | tpPESession psessionEntry; |
| 3858 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3859 | |
| 3860 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3861 | if (pMlmDisassocReq) |
| 3862 | { |
| 3863 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3864 | { |
| 3865 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3866 | } |
| 3867 | |
| 3868 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3869 | { |
| 3870 | |
| 3871 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3872 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3873 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3874 | goto end; |
| 3875 | } |
| 3876 | |
| 3877 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3878 | if (pStaDs == NULL) |
| 3879 | { |
| 3880 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3881 | goto end; |
| 3882 | } |
| 3883 | |
| 3884 | /// Receive path cleanup with dummy packet |
| 3885 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3886 | { |
| 3887 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3888 | goto end; |
| 3889 | } |
| 3890 | |
| 3891 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3892 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3893 | ( |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3894 | #ifdef FEATURE_WLAN_ESE |
| 3895 | (psessionEntry->isESEconnection ) || |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3896 | #endif |
| 3897 | #ifdef FEATURE_WLAN_LFR |
| 3898 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3899 | #endif |
| 3900 | (psessionEntry->is11Rconnection )) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3901 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3902 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3903 | { |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3904 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3905 | FL("FT Preauth Session (%p,%d) Cleanup"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3906 | psessionEntry, psessionEntry->peSessionId);); |
| 3907 | limFTCleanup(pMac); |
| 3908 | } |
| 3909 | else |
| 3910 | { |
| 3911 | PELOGE(limLog(pMac, LOGE, |
| 3912 | FL("No FT Preauth Session Cleanup in role %d" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3913 | #ifdef FEATURE_WLAN_ESE |
| 3914 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3915 | #endif |
| 3916 | #ifdef FEATURE_WLAN_LFR |
| 3917 | " isLFR %d" |
| 3918 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3919 | " is11r %d reason %d"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3920 | psessionEntry->limSystemRole, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3921 | #ifdef FEATURE_WLAN_ESE |
| 3922 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3923 | #endif |
| 3924 | #ifdef FEATURE_WLAN_LFR |
| 3925 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3926 | #endif |
| 3927 | psessionEntry->is11Rconnection, |
| 3928 | pMlmDisassocReq->reasonCode);); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3929 | } |
| 3930 | #endif |
| 3931 | |
| 3932 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3933 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3934 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3935 | return eHAL_STATUS_SUCCESS; |
| 3936 | } |
| 3937 | else |
| 3938 | { |
| 3939 | return eHAL_STATUS_SUCCESS; |
| 3940 | } |
| 3941 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3942 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3943 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3944 | sizeof(tSirMacAddr)); |
| 3945 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3946 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3947 | |
| 3948 | /* Update PE session ID*/ |
| 3949 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3950 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3951 | if(pMlmDisassocReq != NULL) |
| 3952 | { |
| 3953 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3954 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3955 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3956 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3957 | |
| 3958 | limPostSmeMessage(pMac, |
| 3959 | LIM_MLM_DISASSOC_CNF, |
| 3960 | (tANI_U32 *) &mlmDisassocCnf); |
| 3961 | return eHAL_STATUS_SUCCESS; |
| 3962 | } |
| 3963 | |
| 3964 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3965 | { |
| 3966 | return limSendDisassocCnf(pMac); |
| 3967 | } |
| 3968 | |
| 3969 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3970 | { |
| 3971 | return limSendDeauthCnf(pMac); |
| 3972 | } |
| 3973 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3974 | /** |
| 3975 | * \brief This function is called to send Disassociate frame. |
| 3976 | * |
| 3977 | * |
| 3978 | * \param pMac Pointer to Global MAC structure |
| 3979 | * |
| 3980 | * \param nReason Indicates the reason that need to be sent in |
| 3981 | * Disassociation frame |
| 3982 | * |
| 3983 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3984 | * sent |
| 3985 | * |
| 3986 | * |
| 3987 | */ |
| 3988 | |
| 3989 | void |
| 3990 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3991 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3992 | tSirMacAddr peer, |
| 3993 | tpPESession psessionEntry, |
| 3994 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3995 | { |
| 3996 | tDot11fDisassociation frm; |
| 3997 | tANI_U8 *pFrame; |
| 3998 | tSirRetStatus nSirStatus; |
| 3999 | tpSirMacMgmtHdr pMacHdr; |
| 4000 | tANI_U32 nBytes, nPayload, nStatus; |
| 4001 | void *pPacket; |
| 4002 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4003 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4004 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4005 | if(NULL == psessionEntry) |
| 4006 | { |
| 4007 | return; |
| 4008 | } |
| 4009 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4010 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4011 | |
| 4012 | frm.Reason.code = nReason; |
| 4013 | |
| 4014 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 4015 | if ( DOT11F_FAILED( nStatus ) ) |
| 4016 | { |
| 4017 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4018 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4019 | nStatus ); |
| 4020 | // We'll fall back on the worst case scenario: |
| 4021 | nPayload = sizeof( tDot11fDisassociation ); |
| 4022 | } |
| 4023 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4024 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4025 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4026 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4027 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4028 | } |
| 4029 | |
| 4030 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4031 | |
| 4032 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4033 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4034 | ( void** ) &pPacket ); |
| 4035 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4036 | { |
| 4037 | 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] | 4038 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | return; |
| 4040 | } |
| 4041 | |
| 4042 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4043 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4044 | |
| 4045 | // Next, we fill out the buffer descriptor: |
| 4046 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4047 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4048 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4049 | { |
| 4050 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4051 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4052 | nSirStatus ); |
| 4053 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4054 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4055 | return; // just allocated... |
| 4056 | } |
| 4057 | |
| 4058 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4059 | |
| 4060 | // Prepare the BSSID |
| 4061 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4062 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4063 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4064 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4065 | #endif |
| 4066 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4067 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4068 | sizeof(tSirMacMgmtHdr), |
| 4069 | nPayload, &nPayload ); |
| 4070 | if ( DOT11F_FAILED( nStatus ) ) |
| 4071 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4072 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4073 | nStatus ); |
| 4074 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4075 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4076 | return; // allocated! |
| 4077 | } |
| 4078 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4079 | { |
| 4080 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4081 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4082 | } |
| 4083 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4084 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4085 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4086 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4087 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4088 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4089 | |
| 4090 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4091 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4092 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4093 | ) |
| 4094 | { |
| 4095 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4096 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4097 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4098 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4099 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4100 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4101 | { |
| 4102 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4103 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4104 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4105 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4106 | { |
| 4107 | /* This frame will be sent on air by firmware, |
| 4108 | which will ensure that this frame goes out |
| 4109 | even though DEL_STA is sent immediately */ |
| 4110 | /* Without this for DEL_STA command there is |
| 4111 | risk of flushing frame in BTQM queue without |
| 4112 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4113 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4114 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4115 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4116 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4117 | } |
| 4118 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4119 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4120 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4121 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4122 | psessionEntry->peSessionId, |
| 4123 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4124 | // Queue Disassociation frame in high priority WQ |
| 4125 | /* get the duration from the request */ |
| 4126 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4127 | HAL_TXRX_FRM_802_11_MGMT, |
| 4128 | ANI_TXDIR_TODS, |
| 4129 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4130 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 4131 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4132 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4133 | psessionEntry->peSessionId, |
| 4134 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4135 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4136 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4137 | if (tx_timer_change( |
| 4138 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4139 | != TX_SUCCESS) |
| 4140 | { |
| 4141 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4142 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4143 | return; |
| 4144 | } |
| 4145 | else if(TX_SUCCESS != tx_timer_activate( |
| 4146 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4147 | { |
| 4148 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4149 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4150 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4151 | return; |
| 4152 | } |
| 4153 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4154 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4155 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4156 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4157 | psessionEntry->peSessionId, |
| 4158 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4159 | // Queue Disassociation frame in high priority WQ |
| 4160 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4161 | HAL_TXRX_FRM_802_11_MGMT, |
| 4162 | ANI_TXDIR_TODS, |
| 4163 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4164 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4165 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4166 | psessionEntry->peSessionId, |
| 4167 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4168 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4169 | { |
| 4170 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4171 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4172 | nSirStatus ); |
| 4173 | //Pkt will be freed up by the callback |
| 4174 | return; |
| 4175 | } |
| 4176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4177 | } // End limSendDisassocMgmtFrame. |
| 4178 | |
| 4179 | /** |
| 4180 | * \brief This function is called to send a Deauthenticate frame |
| 4181 | * |
| 4182 | * |
| 4183 | * \param pMac Pointer to global MAC structure |
| 4184 | * |
| 4185 | * \param nReason Indicates the reason that need to be sent in the |
| 4186 | * Deauthenticate frame |
| 4187 | * |
| 4188 | * \param peeer address of the STA to which the frame is to be sent |
| 4189 | * |
| 4190 | * |
| 4191 | */ |
| 4192 | |
| 4193 | void |
| 4194 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4195 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4196 | tSirMacAddr peer, |
| 4197 | tpPESession psessionEntry, |
| 4198 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4199 | { |
| 4200 | tDot11fDeAuth frm; |
| 4201 | tANI_U8 *pFrame; |
| 4202 | tSirRetStatus nSirStatus; |
| 4203 | tpSirMacMgmtHdr pMacHdr; |
| 4204 | tANI_U32 nBytes, nPayload, nStatus; |
| 4205 | void *pPacket; |
| 4206 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4207 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4208 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4209 | #ifdef FEATURE_WLAN_TDLS |
| 4210 | tANI_U16 aid; |
| 4211 | tpDphHashNode pStaDs; |
| 4212 | #endif |
| 4213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4214 | if(NULL == psessionEntry) |
| 4215 | { |
| 4216 | return; |
| 4217 | } |
| 4218 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4219 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4220 | |
| 4221 | frm.Reason.code = nReason; |
| 4222 | |
| 4223 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4224 | if ( DOT11F_FAILED( nStatus ) ) |
| 4225 | { |
| 4226 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4227 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4228 | nStatus ); |
| 4229 | // We'll fall back on the worst case scenario: |
| 4230 | nPayload = sizeof( tDot11fDeAuth ); |
| 4231 | } |
| 4232 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4233 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4234 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4235 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4236 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4237 | } |
| 4238 | |
| 4239 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4240 | |
| 4241 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4242 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4243 | ( void** ) &pPacket ); |
| 4244 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4245 | { |
| 4246 | 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] | 4247 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4248 | return; |
| 4249 | } |
| 4250 | |
| 4251 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4252 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4253 | |
| 4254 | // Next, we fill out the buffer descriptor: |
| 4255 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4256 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4257 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4258 | { |
| 4259 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4260 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4261 | nSirStatus ); |
| 4262 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4263 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4264 | return; // just allocated... |
| 4265 | } |
| 4266 | |
| 4267 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4268 | |
| 4269 | // Prepare the BSSID |
| 4270 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4271 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4272 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4273 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4274 | #endif |
| 4275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4276 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4277 | sizeof(tSirMacMgmtHdr), |
| 4278 | nPayload, &nPayload ); |
| 4279 | if ( DOT11F_FAILED( nStatus ) ) |
| 4280 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4281 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4282 | nStatus ); |
| 4283 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4284 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4285 | return; |
| 4286 | } |
| 4287 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4288 | { |
| 4289 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4290 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4291 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4292 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4293 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4294 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4295 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4296 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4297 | |
| 4298 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4299 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4300 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4301 | ) |
| 4302 | { |
| 4303 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4304 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4305 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4306 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4307 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4308 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4309 | { |
| 4310 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4311 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4312 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4313 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4314 | { |
| 4315 | /* This frame will be sent on air by firmware, |
| 4316 | which will ensure that this frame goes out |
| 4317 | even though DEL_STA is sent immediately */ |
| 4318 | /* Without this for DEL_STA command there is |
| 4319 | risk of flushing frame in BTQM queue without |
| 4320 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4321 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4322 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4323 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4324 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4325 | } |
| 4326 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4327 | #ifdef FEATURE_WLAN_TDLS |
| 4328 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4329 | #endif |
| 4330 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4331 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4332 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4333 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4334 | psessionEntry->peSessionId, |
| 4335 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4336 | // Queue Disassociation frame in high priority WQ |
| 4337 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4338 | HAL_TXRX_FRM_802_11_MGMT, |
| 4339 | ANI_TXDIR_TODS, |
| 4340 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4341 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4342 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4343 | psessionEntry->peSessionId, |
| 4344 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4345 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4346 | { |
| 4347 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4348 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4349 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4350 | //Pkt will be freed up by the callback limTxComplete |
| 4351 | |
| 4352 | /*Call limProcessDeauthAckTimeout which will send |
| 4353 | * DeauthCnf for this frame |
| 4354 | */ |
| 4355 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4356 | return; |
| 4357 | } |
| 4358 | |
| 4359 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4360 | |
| 4361 | if (tx_timer_change( |
| 4362 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4363 | != TX_SUCCESS) |
| 4364 | { |
| 4365 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4366 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4367 | return; |
| 4368 | } |
| 4369 | else if(TX_SUCCESS != tx_timer_activate( |
| 4370 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4371 | { |
| 4372 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4373 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4374 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4375 | return; |
| 4376 | } |
| 4377 | } |
| 4378 | else |
| 4379 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4380 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4381 | psessionEntry->peSessionId, |
| 4382 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4383 | #ifdef FEATURE_WLAN_TDLS |
| 4384 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4385 | { |
| 4386 | // Queue Disassociation frame in high priority WQ |
| 4387 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4388 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4389 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4390 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4391 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4392 | } |
| 4393 | else |
| 4394 | { |
| 4395 | #endif |
| 4396 | // Queue Disassociation frame in high priority WQ |
| 4397 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4398 | HAL_TXRX_FRM_802_11_MGMT, |
| 4399 | ANI_TXDIR_TODS, |
| 4400 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4401 | limTxComplete, pFrame, txFlag ); |
| 4402 | #ifdef FEATURE_WLAN_TDLS |
| 4403 | } |
| 4404 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4405 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4406 | psessionEntry->peSessionId, |
| 4407 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4408 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4409 | { |
| 4410 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4411 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4412 | nSirStatus ); |
| 4413 | //Pkt will be freed up by the callback |
| 4414 | return; |
| 4415 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4416 | } |
| 4417 | |
| 4418 | } // End limSendDeauthMgmtFrame. |
| 4419 | |
| 4420 | |
| 4421 | #ifdef ANI_SUPPORT_11H |
| 4422 | /** |
| 4423 | * \brief Send a Measurement Report Action frame |
| 4424 | * |
| 4425 | * |
| 4426 | * \param pMac Pointer to the global MAC structure |
| 4427 | * |
| 4428 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4429 | * |
| 4430 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4431 | * |
| 4432 | * |
| 4433 | */ |
| 4434 | |
| 4435 | tSirRetStatus |
| 4436 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4437 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4438 | tSirMacAddr peer) |
| 4439 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4440 | tDot11fMeasurementReport frm; |
| 4441 | tANI_U8 *pFrame; |
| 4442 | tSirRetStatus nSirStatus; |
| 4443 | tpSirMacMgmtHdr pMacHdr; |
| 4444 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4445 | void *pPacket; |
| 4446 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4447 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4448 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4449 | |
| 4450 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4451 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4452 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4453 | |
| 4454 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4455 | { |
| 4456 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4457 | nSirStatus = |
| 4458 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4459 | &frm.MeasurementReport ); |
| 4460 | break; |
| 4461 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4462 | nSirStatus = |
| 4463 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4464 | &frm.MeasurementReport ); |
| 4465 | break; |
| 4466 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4467 | nSirStatus = |
| 4468 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4469 | &frm.MeasurementReport ); |
| 4470 | break; |
| 4471 | default: |
| 4472 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4473 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4474 | pMeasReqFrame->measReqIE.measType ); |
| 4475 | return eSIR_FAILURE; |
| 4476 | } |
| 4477 | |
| 4478 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4479 | |
| 4480 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4481 | if ( DOT11F_FAILED( nStatus ) ) |
| 4482 | { |
| 4483 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4484 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | nStatus ); |
| 4486 | // We'll fall back on the worst case scenario: |
| 4487 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4488 | } |
| 4489 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4490 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4491 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4492 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4493 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4494 | } |
| 4495 | |
| 4496 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4497 | |
| 4498 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4499 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4500 | { |
| 4501 | 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] | 4502 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4503 | return eSIR_FAILURE; |
| 4504 | } |
| 4505 | |
| 4506 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4507 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4508 | |
| 4509 | // Next, we fill out the buffer descriptor: |
| 4510 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4511 | SIR_MAC_MGMT_ACTION, peer); |
| 4512 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4513 | { |
| 4514 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4515 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4516 | nSirStatus ); |
| 4517 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4518 | return eSIR_FAILURE; // just allocated... |
| 4519 | } |
| 4520 | |
| 4521 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4522 | |
| 4523 | nCfg = 6; |
| 4524 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4525 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4526 | { |
| 4527 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4528 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4529 | nSirStatus ); |
| 4530 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4531 | return eSIR_FAILURE; // just allocated... |
| 4532 | } |
| 4533 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4534 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4535 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4536 | #endif |
| 4537 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4539 | sizeof(tSirMacMgmtHdr), |
| 4540 | nPayload, &nPayload ); |
| 4541 | if ( DOT11F_FAILED( nStatus ) ) |
| 4542 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4543 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4544 | nStatus ); |
| 4545 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4546 | return eSIR_FAILURE; // allocated! |
| 4547 | } |
| 4548 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4549 | { |
| 4550 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4551 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | } |
| 4553 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4554 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4555 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4556 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4557 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4558 | HAL_TXRX_FRM_802_11_MGMT, |
| 4559 | ANI_TXDIR_TODS, |
| 4560 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4561 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4562 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4563 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4564 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4565 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4566 | { |
| 4567 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4568 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4569 | nSirStatus ); |
| 4570 | //Pkt will be freed up by the callback |
| 4571 | return eSIR_FAILURE; // just allocated... |
| 4572 | } |
| 4573 | |
| 4574 | return eSIR_SUCCESS; |
| 4575 | |
| 4576 | } // End limSendMeasReportFrame. |
| 4577 | |
| 4578 | |
| 4579 | /** |
| 4580 | * \brief Send a TPC Request Action frame |
| 4581 | * |
| 4582 | * |
| 4583 | * \param pMac Pointer to the global MAC datastructure |
| 4584 | * |
| 4585 | * \param peer MAC address to which the frame should be sent |
| 4586 | * |
| 4587 | * |
| 4588 | */ |
| 4589 | |
| 4590 | void |
| 4591 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4592 | tSirMacAddr peer) |
| 4593 | { |
| 4594 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4595 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4596 | tSirRetStatus nSirStatus; |
| 4597 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4598 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4599 | void *pPacket; |
| 4600 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4602 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4603 | |
| 4604 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4605 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4606 | frm.DialogToken.token = 1; |
| 4607 | frm.TPCRequest.present = 1; |
| 4608 | |
| 4609 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4610 | if ( DOT11F_FAILED( nStatus ) ) |
| 4611 | { |
| 4612 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4613 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | nStatus ); |
| 4615 | // We'll fall back on the worst case scenario: |
| 4616 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4617 | } |
| 4618 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4619 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4620 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4621 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4622 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4623 | } |
| 4624 | |
| 4625 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4626 | |
| 4627 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4628 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4629 | { |
| 4630 | 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] | 4631 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4632 | return; |
| 4633 | } |
| 4634 | |
| 4635 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4636 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4637 | |
| 4638 | // Next, we fill out the buffer descriptor: |
| 4639 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4640 | SIR_MAC_MGMT_ACTION, peer); |
| 4641 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4642 | { |
| 4643 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4644 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4645 | nSirStatus ); |
| 4646 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4647 | return; // just allocated... |
| 4648 | } |
| 4649 | |
| 4650 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4651 | |
| 4652 | nCfg = 6; |
| 4653 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4654 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4655 | { |
| 4656 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4657 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4658 | nSirStatus ); |
| 4659 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4660 | return; // just allocated... |
| 4661 | } |
| 4662 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4663 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4664 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4665 | #endif |
| 4666 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4667 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4668 | sizeof(tSirMacMgmtHdr), |
| 4669 | nPayload, &nPayload ); |
| 4670 | if ( DOT11F_FAILED( nStatus ) ) |
| 4671 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4672 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4673 | nStatus ); |
| 4674 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4675 | return; // allocated! |
| 4676 | } |
| 4677 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4678 | { |
| 4679 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4680 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4681 | } |
| 4682 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4683 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4684 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4685 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4686 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4687 | HAL_TXRX_FRM_802_11_MGMT, |
| 4688 | ANI_TXDIR_TODS, |
| 4689 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4690 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4691 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4692 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4693 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4694 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4695 | { |
| 4696 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4697 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4698 | nSirStatus ); |
| 4699 | //Pkt will be freed up by the callback |
| 4700 | return; |
| 4701 | } |
| 4702 | |
| 4703 | } // End limSendTpcRequestFrame. |
| 4704 | |
| 4705 | |
| 4706 | /** |
| 4707 | * \brief Send a TPC Report Action frame |
| 4708 | * |
| 4709 | * |
| 4710 | * \param pMac Pointer to the global MAC datastructure |
| 4711 | * |
| 4712 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4713 | * |
| 4714 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4715 | * |
| 4716 | * |
| 4717 | */ |
| 4718 | |
| 4719 | tSirRetStatus |
| 4720 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4721 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4722 | tSirMacAddr peer) |
| 4723 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4724 | tDot11fTPCReport frm; |
| 4725 | tANI_U8 *pFrame; |
| 4726 | tSirRetStatus nSirStatus; |
| 4727 | tpSirMacMgmtHdr pMacHdr; |
| 4728 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4729 | void *pPacket; |
| 4730 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4731 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4732 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4733 | |
| 4734 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4735 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4736 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4737 | |
| 4738 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4739 | // "misplaced this function, need to replace: |
| 4740 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4741 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4742 | frm.TPCReport.tx_power = 0; |
| 4743 | frm.TPCReport.link_margin = 0; |
| 4744 | frm.TPCReport.present = 1; |
| 4745 | |
| 4746 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4747 | if ( DOT11F_FAILED( nStatus ) ) |
| 4748 | { |
| 4749 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4750 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4751 | nStatus ); |
| 4752 | // We'll fall back on the worst case scenario: |
| 4753 | nPayload = sizeof( tDot11fTPCReport ); |
| 4754 | } |
| 4755 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4756 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4757 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4758 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4759 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4760 | } |
| 4761 | |
| 4762 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4763 | |
| 4764 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4765 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4766 | { |
| 4767 | 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] | 4768 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4769 | return eSIR_FAILURE; |
| 4770 | } |
| 4771 | |
| 4772 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4773 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4774 | |
| 4775 | // Next, we fill out the buffer descriptor: |
| 4776 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4777 | SIR_MAC_MGMT_ACTION, peer); |
| 4778 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4779 | { |
| 4780 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4781 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4782 | nSirStatus ); |
| 4783 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4784 | return eSIR_FAILURE; // just allocated... |
| 4785 | } |
| 4786 | |
| 4787 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4788 | |
| 4789 | nCfg = 6; |
| 4790 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4791 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4792 | { |
| 4793 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4794 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4795 | nSirStatus ); |
| 4796 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4797 | return eSIR_FAILURE; // just allocated... |
| 4798 | } |
| 4799 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4800 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4801 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4802 | #endif |
| 4803 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4804 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4805 | sizeof(tSirMacMgmtHdr), |
| 4806 | nPayload, &nPayload ); |
| 4807 | if ( DOT11F_FAILED( nStatus ) ) |
| 4808 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4809 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4810 | nStatus ); |
| 4811 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4812 | return eSIR_FAILURE; // allocated! |
| 4813 | } |
| 4814 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4815 | { |
| 4816 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4817 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4818 | } |
| 4819 | |
| 4820 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4821 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4822 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4823 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4825 | HAL_TXRX_FRM_802_11_MGMT, |
| 4826 | ANI_TXDIR_TODS, |
| 4827 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4828 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4829 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4830 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4831 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4832 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4833 | { |
| 4834 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4835 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4836 | nSirStatus ); |
| 4837 | //Pkt will be freed up by the callback |
| 4838 | return eSIR_FAILURE; // just allocated... |
| 4839 | } |
| 4840 | |
| 4841 | return eSIR_SUCCESS; |
| 4842 | |
| 4843 | } // End limSendTpcReportFrame. |
| 4844 | #endif //ANI_SUPPORT_11H |
| 4845 | |
| 4846 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4847 | /** |
| 4848 | * \brief Send a Channel Switch Announcement |
| 4849 | * |
| 4850 | * |
| 4851 | * \param pMac Pointer to the global MAC datastructure |
| 4852 | * |
| 4853 | * \param peer MAC address to which this frame will be sent |
| 4854 | * |
| 4855 | * \param nMode |
| 4856 | * |
| 4857 | * \param nNewChannel |
| 4858 | * |
| 4859 | * \param nCount |
| 4860 | * |
| 4861 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4862 | * |
| 4863 | * |
| 4864 | */ |
| 4865 | |
| 4866 | tSirRetStatus |
| 4867 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4868 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4869 | tANI_U8 nMode, |
| 4870 | tANI_U8 nNewChannel, |
| 4871 | tANI_U8 nCount, |
| 4872 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4873 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4874 | tDot11fChannelSwitch frm; |
| 4875 | tANI_U8 *pFrame; |
| 4876 | tSirRetStatus nSirStatus; |
| 4877 | tpSirMacMgmtHdr pMacHdr; |
| 4878 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4879 | void *pPacket; |
| 4880 | eHalStatus halstatus; |
| 4881 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4882 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4883 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4884 | |
| 4885 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4886 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4887 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4888 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4889 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4890 | frm.ChanSwitchAnn.present = 1; |
| 4891 | |
| 4892 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4893 | if ( DOT11F_FAILED( nStatus ) ) |
| 4894 | { |
| 4895 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4896 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4897 | nStatus ); |
| 4898 | // We'll fall back on the worst case scenario: |
| 4899 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4900 | } |
| 4901 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4902 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4903 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4905 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4906 | } |
| 4907 | |
| 4908 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4909 | |
| 4910 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4911 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4912 | { |
| 4913 | 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] | 4914 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4915 | return eSIR_FAILURE; |
| 4916 | } |
| 4917 | |
| 4918 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4919 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4920 | |
| 4921 | // Next, we fill out the buffer descriptor: |
| 4922 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4923 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4924 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4925 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4926 | (tANI_U8 *) psessionEntry->bssId, |
| 4927 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4928 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4929 | { |
| 4930 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4931 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4932 | nSirStatus ); |
| 4933 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4934 | return eSIR_FAILURE; // just allocated... |
| 4935 | } |
| 4936 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4937 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4938 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4939 | |
| 4940 | nCfg = 6; |
| 4941 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4942 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4943 | { |
| 4944 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4945 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4946 | nSirStatus ); |
| 4947 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4948 | return eSIR_FAILURE; // just allocated... |
| 4949 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4950 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4951 | |
| 4952 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4953 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4954 | #endif |
| 4955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4956 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4957 | sizeof(tSirMacMgmtHdr), |
| 4958 | nPayload, &nPayload ); |
| 4959 | if ( DOT11F_FAILED( nStatus ) ) |
| 4960 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4961 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4962 | nStatus ); |
| 4963 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4964 | return eSIR_FAILURE; // allocated! |
| 4965 | } |
| 4966 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4967 | { |
| 4968 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4969 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4970 | } |
| 4971 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4972 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4973 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4974 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4975 | ) |
| 4976 | { |
| 4977 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4978 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4979 | |
| 4980 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4981 | psessionEntry->peSessionId, |
| 4982 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4983 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4984 | HAL_TXRX_FRM_802_11_MGMT, |
| 4985 | ANI_TXDIR_TODS, |
| 4986 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4987 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4988 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4989 | psessionEntry->peSessionId, |
| 4990 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4992 | { |
| 4993 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4994 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | nSirStatus ); |
| 4996 | //Pkt will be freed up by the callback |
| 4997 | return eSIR_FAILURE; |
| 4998 | } |
| 4999 | |
| 5000 | return eSIR_SUCCESS; |
| 5001 | |
| 5002 | } // End limSendChannelSwitchMgmtFrame. |
| 5003 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5004 | |
| 5005 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5006 | #ifdef WLAN_FEATURE_11AC |
| 5007 | tSirRetStatus |
| 5008 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 5009 | tSirMacAddr peer, |
| 5010 | tANI_U8 nMode, |
| 5011 | tpPESession psessionEntry ) |
| 5012 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5013 | tDot11fOperatingMode frm; |
| 5014 | tANI_U8 *pFrame; |
| 5015 | tSirRetStatus nSirStatus; |
| 5016 | tpSirMacMgmtHdr pMacHdr; |
| 5017 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 5018 | void *pPacket; |
| 5019 | eHalStatus halstatus; |
| 5020 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5021 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5022 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5023 | |
| 5024 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5025 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5026 | frm.OperatingMode.chanWidth = nMode; |
| 5027 | frm.OperatingMode.rxNSS = 0; |
| 5028 | frm.OperatingMode.rxNSSType = 0; |
| 5029 | |
| 5030 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5031 | if ( DOT11F_FAILED( nStatus ) ) |
| 5032 | { |
| 5033 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5034 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5035 | nStatus ); |
| 5036 | // We'll fall back on the worst case scenario: |
| 5037 | nPayload = sizeof( tDot11fOperatingMode); |
| 5038 | } |
| 5039 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5040 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5041 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5042 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5043 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5044 | } |
| 5045 | |
| 5046 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5047 | |
| 5048 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5049 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5050 | { |
| 5051 | 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] | 5052 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5053 | return eSIR_FAILURE; |
| 5054 | } |
| 5055 | |
| 5056 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5057 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5058 | |
| 5059 | |
| 5060 | // Next, we fill out the buffer descriptor: |
| 5061 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5062 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5063 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5064 | } else |
| 5065 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5066 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5067 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5068 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5069 | (tANI_U8 *) psessionEntry->bssId, |
| 5070 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5071 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5072 | { |
| 5073 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5074 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5075 | nSirStatus ); |
| 5076 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5077 | return eSIR_FAILURE; // just allocated... |
| 5078 | } |
| 5079 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5080 | sizeof(tSirMacMgmtHdr), |
| 5081 | nPayload, &nPayload ); |
| 5082 | if ( DOT11F_FAILED( nStatus ) ) |
| 5083 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5084 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5085 | nStatus ); |
| 5086 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5087 | return eSIR_FAILURE; // allocated! |
| 5088 | } |
| 5089 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5090 | { |
| 5091 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5092 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5093 | } |
| 5094 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5095 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5096 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5097 | ) |
| 5098 | { |
| 5099 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5100 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5101 | |
| 5102 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5103 | psessionEntry->peSessionId, |
| 5104 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5105 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5106 | HAL_TXRX_FRM_802_11_MGMT, |
| 5107 | ANI_TXDIR_TODS, |
| 5108 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5109 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5110 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5111 | psessionEntry->peSessionId, |
| 5112 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5113 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5114 | { |
| 5115 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5116 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5117 | nSirStatus ); |
| 5118 | //Pkt will be freed up by the callback |
| 5119 | return eSIR_FAILURE; |
| 5120 | } |
| 5121 | |
| 5122 | return eSIR_SUCCESS; |
| 5123 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5124 | |
| 5125 | /** |
| 5126 | * \brief Send a VHT Channel Switch Announcement |
| 5127 | * |
| 5128 | * |
| 5129 | * \param pMac Pointer to the global MAC datastructure |
| 5130 | * |
| 5131 | * \param peer MAC address to which this frame will be sent |
| 5132 | * |
| 5133 | * \param nChanWidth |
| 5134 | * |
| 5135 | * \param nNewChannel |
| 5136 | * |
| 5137 | * |
| 5138 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5139 | * |
| 5140 | * |
| 5141 | */ |
| 5142 | |
| 5143 | tSirRetStatus |
| 5144 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5145 | tSirMacAddr peer, |
| 5146 | tANI_U8 nChanWidth, |
| 5147 | tANI_U8 nNewChannel, |
| 5148 | tANI_U8 ncbMode, |
| 5149 | tpPESession psessionEntry ) |
| 5150 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5151 | tDot11fChannelSwitch frm; |
| 5152 | tANI_U8 *pFrame; |
| 5153 | tSirRetStatus nSirStatus; |
| 5154 | tpSirMacMgmtHdr pMacHdr; |
| 5155 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5156 | void *pPacket; |
| 5157 | eHalStatus halstatus; |
| 5158 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5159 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5160 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5161 | |
| 5162 | |
| 5163 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5164 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5165 | frm.ChanSwitchAnn.switchMode = 1; |
| 5166 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5167 | frm.ChanSwitchAnn.switchCount = 1; |
| 5168 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5169 | frm.ExtChanSwitchAnn.present = 1; |
| 5170 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5171 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5172 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5173 | frm.ChanSwitchAnn.present = 1; |
| 5174 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5175 | |
| 5176 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5177 | if ( DOT11F_FAILED( nStatus ) ) |
| 5178 | { |
| 5179 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5180 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5181 | nStatus ); |
| 5182 | // We'll fall back on the worst case scenario: |
| 5183 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5184 | } |
| 5185 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5186 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5187 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5188 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5189 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5190 | } |
| 5191 | |
| 5192 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5193 | |
| 5194 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5195 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5196 | { |
| 5197 | 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] | 5198 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5199 | return eSIR_FAILURE; |
| 5200 | } |
| 5201 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5202 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5203 | |
| 5204 | // Next, we fill out the buffer descriptor: |
| 5205 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5206 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5207 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5208 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5209 | (tANI_U8 *) psessionEntry->bssId, |
| 5210 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5211 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5212 | { |
| 5213 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5214 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5215 | nSirStatus ); |
| 5216 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5217 | return eSIR_FAILURE; // just allocated... |
| 5218 | } |
| 5219 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5220 | sizeof(tSirMacMgmtHdr), |
| 5221 | nPayload, &nPayload ); |
| 5222 | if ( DOT11F_FAILED( nStatus ) ) |
| 5223 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5224 | 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] | 5225 | nStatus ); |
| 5226 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5227 | return eSIR_FAILURE; // allocated! |
| 5228 | } |
| 5229 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5230 | { |
| 5231 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5232 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5233 | } |
| 5234 | |
| 5235 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5236 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5237 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5238 | ) |
| 5239 | { |
| 5240 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5241 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5242 | |
| 5243 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5244 | psessionEntry->peSessionId, |
| 5245 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5246 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5247 | HAL_TXRX_FRM_802_11_MGMT, |
| 5248 | ANI_TXDIR_TODS, |
| 5249 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5250 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5251 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5252 | psessionEntry->peSessionId, |
| 5253 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5254 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5255 | { |
| 5256 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5257 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5258 | nSirStatus ); |
| 5259 | //Pkt will be freed up by the callback |
| 5260 | return eSIR_FAILURE; |
| 5261 | } |
| 5262 | |
| 5263 | return eSIR_SUCCESS; |
| 5264 | |
| 5265 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5266 | |
| 5267 | |
| 5268 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5269 | #endif |
| 5270 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5271 | /** |
| 5272 | * \brief Send an ADDBA Req Action Frame to peer |
| 5273 | * |
| 5274 | * \sa limSendAddBAReq |
| 5275 | * |
| 5276 | * \param pMac The global tpAniSirGlobal object |
| 5277 | * |
| 5278 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5279 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5280 | * Frame to the peer |
| 5281 | * |
| 5282 | * \return eSIR_SUCCESS if setup completes successfully |
| 5283 | * eSIR_FAILURE is some problem is encountered |
| 5284 | */ |
| 5285 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5286 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5287 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5288 | tDot11fAddBAReq frmAddBAReq; |
| 5289 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5290 | tpSirMacMgmtHdr pMacHdr; |
| 5291 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5292 | tSirRetStatus statusCode; |
| 5293 | eHalStatus halStatus; |
| 5294 | void *pPacket; |
| 5295 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5296 | |
| 5297 | if(NULL == psessionEntry) |
| 5298 | { |
| 5299 | return eSIR_FAILURE; |
| 5300 | } |
| 5301 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5302 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5303 | |
| 5304 | // Category - 3 (BA) |
| 5305 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5306 | |
| 5307 | // Action - 0 (ADDBA Req) |
| 5308 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5309 | |
| 5310 | // FIXME - Dialog Token, generalize this... |
| 5311 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5312 | |
| 5313 | // Fill the ADDBA Parameter Set |
| 5314 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5315 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5316 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5317 | |
| 5318 | // BA timeout |
| 5319 | // 0 - indicates no BA timeout |
| 5320 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5321 | |
| 5322 | // BA Starting Sequence Number |
| 5323 | // Fragment number will always be zero |
| 5324 | if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) { |
| 5325 | pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5326 | } |
| 5327 | |
| 5328 | frmAddBAReq.BAStartingSequenceControl.ssn = |
| 5329 | pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5330 | |
| 5331 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5332 | |
| 5333 | if( DOT11F_FAILED( nStatus )) |
| 5334 | { |
| 5335 | limLog( pMac, LOGW, |
| 5336 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5337 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5338 | nStatus ); |
| 5339 | |
| 5340 | // We'll fall back on the worst case scenario: |
| 5341 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5342 | } |
| 5343 | else if( DOT11F_WARNED( nStatus )) |
| 5344 | { |
| 5345 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5346 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5347 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5348 | nStatus ); |
| 5349 | } |
| 5350 | |
| 5351 | // Add the MGMT header to frame length |
| 5352 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5353 | |
| 5354 | // Need to allocate a buffer for ADDBA AF |
| 5355 | if( eHAL_STATUS_SUCCESS != |
| 5356 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5357 | HAL_TXRX_FRM_802_11_MGMT, |
| 5358 | (tANI_U16) frameLen, |
| 5359 | (void **) &pAddBAReqBuffer, |
| 5360 | (void **) &pPacket ))) |
| 5361 | { |
| 5362 | // Log error |
| 5363 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5364 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5365 | frameLen, |
| 5366 | halStatus ); |
| 5367 | |
| 5368 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5369 | goto returnAfterError; |
| 5370 | } |
| 5371 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5372 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5373 | |
| 5374 | // Copy necessary info to BD |
| 5375 | if( eSIR_SUCCESS != |
| 5376 | (statusCode = limPopulateMacHeader( pMac, |
| 5377 | pAddBAReqBuffer, |
| 5378 | SIR_MAC_MGMT_FRAME, |
| 5379 | SIR_MAC_MGMT_ACTION, |
| 5380 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5381 | goto returnAfterError; |
| 5382 | |
| 5383 | // Update A3 with the BSSID |
| 5384 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5385 | |
| 5386 | #if 0 |
| 5387 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5388 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5389 | WNI_CFG_BSSID, |
| 5390 | (tANI_U8 *) pMacHdr->bssId, |
| 5391 | &cfgLen )) |
| 5392 | { |
| 5393 | limLog( pMac, LOGP, |
| 5394 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5395 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5396 | |
| 5397 | // FIXME - Need to convert to tSirRetStatus |
| 5398 | statusCode = eSIR_FAILURE; |
| 5399 | goto returnAfterError; |
| 5400 | } |
| 5401 | #endif//TO SUPPORT BT-AMP |
| 5402 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5403 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5404 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5405 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5406 | #endif |
| 5407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5408 | // Now, we're ready to "pack" the frames |
| 5409 | nStatus = dot11fPackAddBAReq( pMac, |
| 5410 | &frmAddBAReq, |
| 5411 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5412 | nPayload, |
| 5413 | &nPayload ); |
| 5414 | |
| 5415 | if( DOT11F_FAILED( nStatus )) |
| 5416 | { |
| 5417 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5418 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5419 | nStatus ); |
| 5420 | |
| 5421 | // FIXME - Need to convert to tSirRetStatus |
| 5422 | statusCode = eSIR_FAILURE; |
| 5423 | goto returnAfterError; |
| 5424 | } |
| 5425 | else if( DOT11F_WARNED( nStatus )) |
| 5426 | { |
| 5427 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5428 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5429 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | } |
| 5431 | |
| 5432 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5433 | FL( "Sending an ADDBA REQ to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW ); |
| 5435 | |
| 5436 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5437 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5438 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5439 | ) |
| 5440 | { |
| 5441 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5442 | } |
| 5443 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5444 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5445 | psessionEntry->peSessionId, |
| 5446 | pMacHdr->fc.subType)); |
| 5447 | halStatus = halTxFrame( pMac, |
| 5448 | pPacket, |
| 5449 | (tANI_U16) frameLen, |
| 5450 | HAL_TXRX_FRM_802_11_MGMT, |
| 5451 | ANI_TXDIR_TODS, |
| 5452 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5453 | limTxComplete, |
| 5454 | pAddBAReqBuffer, txFlag ); |
| 5455 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5456 | psessionEntry->peSessionId, |
| 5457 | halStatus)); |
| 5458 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5459 | { |
| 5460 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5461 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5462 | halStatus ); |
| 5463 | |
| 5464 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5465 | statusCode = eSIR_FAILURE; |
| 5466 | //Pkt will be freed up by the callback |
| 5467 | return statusCode; |
| 5468 | } |
| 5469 | else |
| 5470 | return eSIR_SUCCESS; |
| 5471 | |
| 5472 | returnAfterError: |
| 5473 | |
| 5474 | // Release buffer, if allocated |
| 5475 | if( NULL != pAddBAReqBuffer ) |
| 5476 | palPktFree( pMac->hHdd, |
| 5477 | HAL_TXRX_FRM_802_11_MGMT, |
| 5478 | (void *) pAddBAReqBuffer, |
| 5479 | (void *) pPacket ); |
| 5480 | |
| 5481 | return statusCode; |
| 5482 | } |
| 5483 | |
| 5484 | /** |
| 5485 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5486 | * |
| 5487 | * \sa limSendAddBARsp |
| 5488 | * |
| 5489 | * \param pMac The global tpAniSirGlobal object |
| 5490 | * |
| 5491 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5492 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5493 | * Frame to the peer |
| 5494 | * |
| 5495 | * \return eSIR_SUCCESS if setup completes successfully |
| 5496 | * eSIR_FAILURE is some problem is encountered |
| 5497 | */ |
| 5498 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5499 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5500 | tpPESession psessionEntry) |
| 5501 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5502 | tDot11fAddBARsp frmAddBARsp; |
| 5503 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5504 | tpSirMacMgmtHdr pMacHdr; |
| 5505 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5506 | tSirRetStatus statusCode; |
| 5507 | eHalStatus halStatus; |
| 5508 | void *pPacket; |
| 5509 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | |
| 5511 | if(NULL == psessionEntry) |
| 5512 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5513 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5514 | return eSIR_FAILURE; |
| 5515 | } |
| 5516 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5517 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5518 | |
| 5519 | // Category - 3 (BA) |
| 5520 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5521 | // Action - 1 (ADDBA Rsp) |
| 5522 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5523 | |
| 5524 | // Should be same as the one we received in the ADDBA Req |
| 5525 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5526 | |
| 5527 | // ADDBA Req status |
| 5528 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5529 | |
| 5530 | // Fill the ADDBA Parameter Set as provided by caller |
| 5531 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5532 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5533 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5534 | |
| 5535 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5536 | { |
| 5537 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5538 | psessionEntry->amsduSupportedInBA; |
| 5539 | } |
| 5540 | else |
| 5541 | { |
| 5542 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5543 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5544 | |
| 5545 | // BA timeout |
| 5546 | // 0 - indicates no BA timeout |
| 5547 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5548 | |
| 5549 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5550 | |
| 5551 | if( DOT11F_FAILED( nStatus )) |
| 5552 | { |
| 5553 | limLog( pMac, LOGW, |
| 5554 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5555 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5556 | nStatus ); |
| 5557 | |
| 5558 | // We'll fall back on the worst case scenario: |
| 5559 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5560 | } |
| 5561 | else if( DOT11F_WARNED( nStatus )) |
| 5562 | { |
| 5563 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5564 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5565 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5566 | nStatus ); |
| 5567 | } |
| 5568 | |
| 5569 | // Need to allocate a buffer for ADDBA AF |
| 5570 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5571 | |
| 5572 | // Allocate shared memory |
| 5573 | if( eHAL_STATUS_SUCCESS != |
| 5574 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5575 | HAL_TXRX_FRM_802_11_MGMT, |
| 5576 | (tANI_U16) frameLen, |
| 5577 | (void **) &pAddBARspBuffer, |
| 5578 | (void **) &pPacket ))) |
| 5579 | { |
| 5580 | // Log error |
| 5581 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5582 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5583 | frameLen, |
| 5584 | halStatus ); |
| 5585 | |
| 5586 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5587 | goto returnAfterError; |
| 5588 | } |
| 5589 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5590 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5591 | |
| 5592 | // Copy necessary info to BD |
| 5593 | if( eSIR_SUCCESS != |
| 5594 | (statusCode = limPopulateMacHeader( pMac, |
| 5595 | pAddBARspBuffer, |
| 5596 | SIR_MAC_MGMT_FRAME, |
| 5597 | SIR_MAC_MGMT_ACTION, |
| 5598 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5599 | goto returnAfterError; |
| 5600 | |
| 5601 | // Update A3 with the BSSID |
| 5602 | |
| 5603 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5604 | |
| 5605 | #if 0 |
| 5606 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5607 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5608 | WNI_CFG_BSSID, |
| 5609 | (tANI_U8 *) pMacHdr->bssId, |
| 5610 | &cfgLen )) |
| 5611 | { |
| 5612 | limLog( pMac, LOGP, |
| 5613 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5614 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5615 | |
| 5616 | // FIXME - Need to convert to tSirRetStatus |
| 5617 | statusCode = eSIR_FAILURE; |
| 5618 | goto returnAfterError; |
| 5619 | } |
| 5620 | #endif // TO SUPPORT BT-AMP |
| 5621 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5622 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5623 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5624 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5625 | #endif |
| 5626 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5627 | // Now, we're ready to "pack" the frames |
| 5628 | nStatus = dot11fPackAddBARsp( pMac, |
| 5629 | &frmAddBARsp, |
| 5630 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5631 | nPayload, |
| 5632 | &nPayload ); |
| 5633 | |
| 5634 | if( DOT11F_FAILED( nStatus )) |
| 5635 | { |
| 5636 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5637 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5638 | nStatus ); |
| 5639 | |
| 5640 | // FIXME - Need to convert to tSirRetStatus |
| 5641 | statusCode = eSIR_FAILURE; |
| 5642 | goto returnAfterError; |
| 5643 | } |
| 5644 | else if( DOT11F_WARNED( nStatus )) |
| 5645 | { |
| 5646 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5647 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5648 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5649 | } |
| 5650 | |
| 5651 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5652 | FL( "Sending an ADDBA RSP to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5653 | limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW ); |
| 5654 | |
| 5655 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5656 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5657 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5658 | ) |
| 5659 | { |
| 5660 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5661 | } |
| 5662 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5663 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5664 | psessionEntry->peSessionId, |
| 5665 | pMacHdr->fc.subType)); |
| 5666 | halStatus = halTxFrame( pMac, |
| 5667 | pPacket, |
| 5668 | (tANI_U16) frameLen, |
| 5669 | HAL_TXRX_FRM_802_11_MGMT, |
| 5670 | ANI_TXDIR_TODS, |
| 5671 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5672 | limTxComplete, |
| 5673 | pAddBARspBuffer, txFlag ); |
| 5674 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5675 | psessionEntry->peSessionId, |
| 5676 | halStatus)); |
| 5677 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5678 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5679 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5680 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5681 | halStatus ); |
| 5682 | |
| 5683 | // FIXME - HAL error codes are different from PE error |
| 5684 | // codes!! And, this routine is returning tSirRetStatus |
| 5685 | statusCode = eSIR_FAILURE; |
| 5686 | //Pkt will be freed up by the callback |
| 5687 | return statusCode; |
| 5688 | } |
| 5689 | else |
| 5690 | return eSIR_SUCCESS; |
| 5691 | |
| 5692 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5693 | // Release buffer, if allocated |
| 5694 | if( NULL != pAddBARspBuffer ) |
| 5695 | palPktFree( pMac->hHdd, |
| 5696 | HAL_TXRX_FRM_802_11_MGMT, |
| 5697 | (void *) pAddBARspBuffer, |
| 5698 | (void *) pPacket ); |
| 5699 | |
| 5700 | return statusCode; |
| 5701 | } |
| 5702 | |
| 5703 | /** |
| 5704 | * \brief Send a DELBA Indication Action Frame to peer |
| 5705 | * |
| 5706 | * \sa limSendDelBAInd |
| 5707 | * |
| 5708 | * \param pMac The global tpAniSirGlobal object |
| 5709 | * |
| 5710 | * \param peerMacAddr MAC Address of peer |
| 5711 | * |
| 5712 | * \param reasonCode Reason for the DELBA notification |
| 5713 | * |
| 5714 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5715 | * This identifies the TID for which the BA session is |
| 5716 | * being deleted. |
| 5717 | * |
| 5718 | * \return eSIR_SUCCESS if setup completes successfully |
| 5719 | * eSIR_FAILURE is some problem is encountered |
| 5720 | */ |
| 5721 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5722 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5723 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5724 | tDot11fDelBAInd frmDelBAInd; |
| 5725 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5726 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5727 | tpSirMacMgmtHdr pMacHdr; |
| 5728 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5729 | tSirRetStatus statusCode; |
| 5730 | eHalStatus halStatus; |
| 5731 | void *pPacket; |
| 5732 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | |
| 5734 | if(NULL == psessionEntry) |
| 5735 | { |
| 5736 | return eSIR_FAILURE; |
| 5737 | } |
| 5738 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5739 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5740 | |
| 5741 | // Category - 3 (BA) |
| 5742 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5743 | // Action - 2 (DELBA) |
| 5744 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5745 | |
| 5746 | // Fill the DELBA Parameter Set as provided by caller |
| 5747 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5748 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5749 | |
| 5750 | // BA Starting Sequence Number |
| 5751 | // Fragment number will always be zero |
| 5752 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5753 | |
| 5754 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5755 | |
| 5756 | if( DOT11F_FAILED( nStatus )) |
| 5757 | { |
| 5758 | limLog( pMac, LOGW, |
| 5759 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5760 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5761 | nStatus ); |
| 5762 | |
| 5763 | // We'll fall back on the worst case scenario: |
| 5764 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5765 | } |
| 5766 | else if( DOT11F_WARNED( nStatus )) |
| 5767 | { |
| 5768 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5769 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5770 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5771 | nStatus ); |
| 5772 | } |
| 5773 | |
| 5774 | // Add the MGMT header to frame length |
| 5775 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5776 | |
| 5777 | // Allocate shared memory |
| 5778 | if( eHAL_STATUS_SUCCESS != |
| 5779 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5780 | HAL_TXRX_FRM_802_11_MGMT, |
| 5781 | (tANI_U16) frameLen, |
| 5782 | (void **) &pDelBAIndBuffer, |
| 5783 | (void **) &pPacket ))) |
| 5784 | { |
| 5785 | // Log error |
| 5786 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5787 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | frameLen, |
| 5789 | halStatus ); |
| 5790 | |
| 5791 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5792 | goto returnAfterError; |
| 5793 | } |
| 5794 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5795 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | |
| 5797 | // Copy necessary info to BD |
| 5798 | if( eSIR_SUCCESS != |
| 5799 | (statusCode = limPopulateMacHeader( pMac, |
| 5800 | pDelBAIndBuffer, |
| 5801 | SIR_MAC_MGMT_FRAME, |
| 5802 | SIR_MAC_MGMT_ACTION, |
| 5803 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5804 | goto returnAfterError; |
| 5805 | |
| 5806 | // Update A3 with the BSSID |
| 5807 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5808 | |
| 5809 | #if 0 |
| 5810 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5811 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5812 | WNI_CFG_BSSID, |
| 5813 | (tANI_U8 *) pMacHdr->bssId, |
| 5814 | &cfgLen )) |
| 5815 | { |
| 5816 | limLog( pMac, LOGP, |
| 5817 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5818 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5819 | |
| 5820 | // FIXME - Need to convert to tSirRetStatus |
| 5821 | statusCode = eSIR_FAILURE; |
| 5822 | goto returnAfterError; |
| 5823 | } |
| 5824 | #endif //TO SUPPORT BT-AMP |
| 5825 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5826 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5827 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5828 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5829 | #endif |
| 5830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5831 | // Now, we're ready to "pack" the frames |
| 5832 | nStatus = dot11fPackDelBAInd( pMac, |
| 5833 | &frmDelBAInd, |
| 5834 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5835 | nPayload, |
| 5836 | &nPayload ); |
| 5837 | |
| 5838 | if( DOT11F_FAILED( nStatus )) |
| 5839 | { |
| 5840 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5841 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5842 | nStatus ); |
| 5843 | |
| 5844 | // FIXME - Need to convert to tSirRetStatus |
| 5845 | statusCode = eSIR_FAILURE; |
| 5846 | goto returnAfterError; |
| 5847 | } |
| 5848 | else if( DOT11F_WARNED( nStatus )) |
| 5849 | { |
| 5850 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5851 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5852 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5853 | } |
| 5854 | |
| 5855 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5856 | FL( "Sending a DELBA IND to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5857 | limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW ); |
| 5858 | |
| 5859 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5861 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5862 | ) |
| 5863 | { |
| 5864 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5865 | } |
| 5866 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5867 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5868 | psessionEntry->peSessionId, |
| 5869 | pMacHdr->fc.subType)); |
| 5870 | halStatus = halTxFrame( pMac, |
| 5871 | pPacket, |
| 5872 | (tANI_U16) frameLen, |
| 5873 | HAL_TXRX_FRM_802_11_MGMT, |
| 5874 | ANI_TXDIR_TODS, |
| 5875 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5876 | limTxComplete, |
| 5877 | pDelBAIndBuffer, txFlag ); |
| 5878 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5879 | psessionEntry->peSessionId, |
| 5880 | halStatus)); |
| 5881 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5882 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5883 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5884 | statusCode = eSIR_FAILURE; |
| 5885 | //Pkt will be freed up by the callback |
| 5886 | return statusCode; |
| 5887 | } |
| 5888 | else |
| 5889 | return eSIR_SUCCESS; |
| 5890 | |
| 5891 | returnAfterError: |
| 5892 | |
| 5893 | // Release buffer, if allocated |
| 5894 | if( NULL != pDelBAIndBuffer ) |
| 5895 | palPktFree( pMac->hHdd, |
| 5896 | HAL_TXRX_FRM_802_11_MGMT, |
| 5897 | (void *) pDelBAIndBuffer, |
| 5898 | (void *) pPacket ); |
| 5899 | |
| 5900 | return statusCode; |
| 5901 | } |
| 5902 | |
| 5903 | #if defined WLAN_FEATURE_VOWIFI |
| 5904 | |
| 5905 | /** |
| 5906 | * \brief Send a Neighbor Report Request Action frame |
| 5907 | * |
| 5908 | * |
| 5909 | * \param pMac Pointer to the global MAC structure |
| 5910 | * |
| 5911 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5912 | * |
| 5913 | * \param peer mac address of peer station. |
| 5914 | * |
| 5915 | * \param psessionEntry address of session entry. |
| 5916 | * |
| 5917 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5918 | * |
| 5919 | * |
| 5920 | */ |
| 5921 | |
| 5922 | tSirRetStatus |
| 5923 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5924 | tpSirMacNeighborReportReq pNeighborReq, |
| 5925 | tSirMacAddr peer, |
| 5926 | tpPESession psessionEntry |
| 5927 | ) |
| 5928 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5929 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | tDot11fNeighborReportRequest frm; |
| 5931 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5932 | tpSirMacMgmtHdr pMacHdr; |
| 5933 | tANI_U32 nBytes, nPayload, nStatus; |
| 5934 | void *pPacket; |
| 5935 | eHalStatus halstatus; |
| 5936 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5937 | |
| 5938 | if ( psessionEntry == NULL ) |
| 5939 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5940 | 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] | 5941 | return eSIR_FAILURE; |
| 5942 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5943 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5944 | |
| 5945 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5946 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5947 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5948 | |
| 5949 | |
| 5950 | if( pNeighborReq->ssid_present ) |
| 5951 | { |
| 5952 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5953 | } |
| 5954 | |
| 5955 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5956 | if ( DOT11F_FAILED( nStatus ) ) |
| 5957 | { |
| 5958 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5959 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5960 | nStatus ); |
| 5961 | // We'll fall back on the worst case scenario: |
| 5962 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5963 | } |
| 5964 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5965 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5966 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5967 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5968 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5969 | } |
| 5970 | |
| 5971 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5972 | |
| 5973 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5974 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5975 | { |
| 5976 | 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] | 5977 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5978 | return eSIR_FAILURE; |
| 5979 | } |
| 5980 | |
| 5981 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5982 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5983 | |
| 5984 | // Copy necessary info to BD |
| 5985 | if( eSIR_SUCCESS != |
| 5986 | (statusCode = limPopulateMacHeader( pMac, |
| 5987 | pFrame, |
| 5988 | SIR_MAC_MGMT_FRAME, |
| 5989 | SIR_MAC_MGMT_ACTION, |
| 5990 | peer, psessionEntry->selfMacAddr))) |
| 5991 | goto returnAfterError; |
| 5992 | |
| 5993 | // Update A3 with the BSSID |
| 5994 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5995 | |
| 5996 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5997 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5998 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5999 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6000 | #endif |
| 6001 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6002 | // Now, we're ready to "pack" the frames |
| 6003 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 6004 | &frm, |
| 6005 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6006 | nPayload, |
| 6007 | &nPayload ); |
| 6008 | |
| 6009 | if( DOT11F_FAILED( nStatus )) |
| 6010 | { |
| 6011 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6012 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | nStatus ); |
| 6014 | |
| 6015 | // FIXME - Need to convert to tSirRetStatus |
| 6016 | statusCode = eSIR_FAILURE; |
| 6017 | goto returnAfterError; |
| 6018 | } |
| 6019 | else if( DOT11F_WARNED( nStatus )) |
| 6020 | { |
| 6021 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6022 | FL( "There were warnings while packing Neighbor Report " |
| 6023 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6024 | } |
| 6025 | |
| 6026 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6027 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6028 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6029 | |
| 6030 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6031 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6032 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6033 | ) |
| 6034 | { |
| 6035 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6036 | } |
| 6037 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6038 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6039 | psessionEntry->peSessionId, |
| 6040 | pMacHdr->fc.subType)); |
| 6041 | halstatus = halTxFrame( pMac, |
| 6042 | pPacket, |
| 6043 | (tANI_U16) nBytes, |
| 6044 | HAL_TXRX_FRM_802_11_MGMT, |
| 6045 | ANI_TXDIR_TODS, |
| 6046 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6047 | limTxComplete, |
| 6048 | pFrame, txFlag ); |
| 6049 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6050 | psessionEntry->peSessionId, |
| 6051 | halstatus)); |
| 6052 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6053 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6054 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6055 | statusCode = eSIR_FAILURE; |
| 6056 | //Pkt will be freed up by the callback |
| 6057 | return statusCode; |
| 6058 | } |
| 6059 | else |
| 6060 | return eSIR_SUCCESS; |
| 6061 | |
| 6062 | returnAfterError: |
| 6063 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6064 | |
| 6065 | return statusCode; |
| 6066 | } // End limSendNeighborReportRequestFrame. |
| 6067 | |
| 6068 | /** |
| 6069 | * \brief Send a Link Report Action frame |
| 6070 | * |
| 6071 | * |
| 6072 | * \param pMac Pointer to the global MAC structure |
| 6073 | * |
| 6074 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6075 | * |
| 6076 | * \param peer mac address of peer station. |
| 6077 | * |
| 6078 | * \param psessionEntry address of session entry. |
| 6079 | * |
| 6080 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6081 | * |
| 6082 | * |
| 6083 | */ |
| 6084 | |
| 6085 | tSirRetStatus |
| 6086 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6087 | tpSirMacLinkReport pLinkReport, |
| 6088 | tSirMacAddr peer, |
| 6089 | tpPESession psessionEntry |
| 6090 | ) |
| 6091 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6092 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6093 | tDot11fLinkMeasurementReport frm; |
| 6094 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6095 | tpSirMacMgmtHdr pMacHdr; |
| 6096 | tANI_U32 nBytes, nPayload, nStatus; |
| 6097 | void *pPacket; |
| 6098 | eHalStatus halstatus; |
| 6099 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6100 | |
| 6101 | |
| 6102 | if ( psessionEntry == NULL ) |
| 6103 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6104 | 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] | 6105 | return eSIR_FAILURE; |
| 6106 | } |
| 6107 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6108 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6109 | |
| 6110 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6111 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6112 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6113 | |
| 6114 | |
| 6115 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6116 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6117 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6118 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6119 | //such case this way than changing the frame parser. |
| 6120 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6121 | frm.TPCEleLen.TPCLen = 2; |
| 6122 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6123 | frm.LinkMargin.linkMargin = 0; |
| 6124 | |
| 6125 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6126 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6127 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6128 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6129 | |
| 6130 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6131 | if ( DOT11F_FAILED( nStatus ) ) |
| 6132 | { |
| 6133 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6134 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6135 | nStatus ); |
| 6136 | // We'll fall back on the worst case scenario: |
| 6137 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6138 | } |
| 6139 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6140 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6141 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6142 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6143 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6144 | } |
| 6145 | |
| 6146 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6147 | |
| 6148 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6149 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6150 | { |
| 6151 | 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] | 6152 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | return eSIR_FAILURE; |
| 6154 | } |
| 6155 | |
| 6156 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6157 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6158 | |
| 6159 | // Copy necessary info to BD |
| 6160 | if( eSIR_SUCCESS != |
| 6161 | (statusCode = limPopulateMacHeader( pMac, |
| 6162 | pFrame, |
| 6163 | SIR_MAC_MGMT_FRAME, |
| 6164 | SIR_MAC_MGMT_ACTION, |
| 6165 | peer, psessionEntry->selfMacAddr))) |
| 6166 | goto returnAfterError; |
| 6167 | |
| 6168 | // Update A3 with the BSSID |
| 6169 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6170 | |
| 6171 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6172 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6173 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6174 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6175 | #endif |
| 6176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6177 | // Now, we're ready to "pack" the frames |
| 6178 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6179 | &frm, |
| 6180 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6181 | nPayload, |
| 6182 | &nPayload ); |
| 6183 | |
| 6184 | if( DOT11F_FAILED( nStatus )) |
| 6185 | { |
| 6186 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6187 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6188 | nStatus ); |
| 6189 | |
| 6190 | // FIXME - Need to convert to tSirRetStatus |
| 6191 | statusCode = eSIR_FAILURE; |
| 6192 | goto returnAfterError; |
| 6193 | } |
| 6194 | else if( DOT11F_WARNED( nStatus )) |
| 6195 | { |
| 6196 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6197 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6198 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6199 | } |
| 6200 | |
| 6201 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6202 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6203 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6204 | |
| 6205 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6206 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6207 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6208 | ) |
| 6209 | { |
| 6210 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6211 | } |
| 6212 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6213 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6214 | psessionEntry->peSessionId, |
| 6215 | pMacHdr->fc.subType)); |
| 6216 | halstatus = halTxFrame( pMac, |
| 6217 | pPacket, |
| 6218 | (tANI_U16) nBytes, |
| 6219 | HAL_TXRX_FRM_802_11_MGMT, |
| 6220 | ANI_TXDIR_TODS, |
| 6221 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6222 | limTxComplete, |
| 6223 | pFrame, txFlag ); |
| 6224 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6225 | psessionEntry->peSessionId, |
| 6226 | halstatus)); |
| 6227 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6228 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6229 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6230 | statusCode = eSIR_FAILURE; |
| 6231 | //Pkt will be freed up by the callback |
| 6232 | return statusCode; |
| 6233 | } |
| 6234 | else |
| 6235 | return eSIR_SUCCESS; |
| 6236 | |
| 6237 | returnAfterError: |
| 6238 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6239 | |
| 6240 | return statusCode; |
| 6241 | } // End limSendLinkReportActionFrame. |
| 6242 | |
| 6243 | /** |
| 6244 | * \brief Send a Beacon Report Action frame |
| 6245 | * |
| 6246 | * |
| 6247 | * \param pMac Pointer to the global MAC structure |
| 6248 | * |
| 6249 | * \param dialog_token dialog token to be used in the action frame. |
| 6250 | * |
| 6251 | * \param num_report number of reports in pRRMReport. |
| 6252 | * |
| 6253 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6254 | * |
| 6255 | * \param peer mac address of peer station. |
| 6256 | * |
| 6257 | * \param psessionEntry address of session entry. |
| 6258 | * |
| 6259 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6260 | * |
| 6261 | * |
| 6262 | */ |
| 6263 | |
| 6264 | tSirRetStatus |
| 6265 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6266 | tANI_U8 dialog_token, |
| 6267 | tANI_U8 num_report, |
| 6268 | tpSirMacRadioMeasureReport pRRMReport, |
| 6269 | tSirMacAddr peer, |
| 6270 | tpPESession psessionEntry |
| 6271 | ) |
| 6272 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6273 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6274 | tANI_U8 *pFrame; |
| 6275 | tpSirMacMgmtHdr pMacHdr; |
| 6276 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6277 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6278 | eHalStatus halstatus; |
| 6279 | tANI_U8 i; |
| 6280 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6281 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6282 | tDot11fRadioMeasurementReport *frm = |
| 6283 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6284 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6285 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6286 | return eSIR_FAILURE; |
| 6287 | } |
| 6288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6289 | if ( psessionEntry == NULL ) |
| 6290 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6291 | 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] | 6292 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6293 | return eSIR_FAILURE; |
| 6294 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6295 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6296 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6297 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6298 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6299 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6300 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6301 | 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] | 6302 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6303 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6304 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6305 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6306 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6307 | 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] | 6308 | switch( pRRMReport[i].type ) |
| 6309 | { |
| 6310 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6311 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6312 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6313 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6314 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6315 | break; |
| 6316 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6317 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6318 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6319 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6320 | break; |
| 6321 | } |
| 6322 | } |
| 6323 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6324 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | if ( DOT11F_FAILED( nStatus ) ) |
| 6326 | { |
| 6327 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6328 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6329 | nStatus ); |
| 6330 | // We'll fall back on the worst case scenario: |
| 6331 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6332 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | return eSIR_FAILURE; |
| 6334 | } |
| 6335 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6336 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6337 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6338 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6339 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6340 | } |
| 6341 | |
| 6342 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6343 | |
| 6344 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6345 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6346 | { |
| 6347 | 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] | 6348 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6349 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6350 | return eSIR_FAILURE; |
| 6351 | } |
| 6352 | |
| 6353 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6354 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6355 | |
| 6356 | // Copy necessary info to BD |
| 6357 | if( eSIR_SUCCESS != |
| 6358 | (statusCode = limPopulateMacHeader( pMac, |
| 6359 | pFrame, |
| 6360 | SIR_MAC_MGMT_FRAME, |
| 6361 | SIR_MAC_MGMT_ACTION, |
| 6362 | peer, psessionEntry->selfMacAddr))) |
| 6363 | goto returnAfterError; |
| 6364 | |
| 6365 | // Update A3 with the BSSID |
| 6366 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6367 | |
| 6368 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6369 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6370 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6371 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6372 | #endif |
| 6373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6374 | // Now, we're ready to "pack" the frames |
| 6375 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6376 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6377 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6378 | nPayload, |
| 6379 | &nPayload ); |
| 6380 | |
| 6381 | if( DOT11F_FAILED( nStatus )) |
| 6382 | { |
| 6383 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6384 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | nStatus ); |
| 6386 | |
| 6387 | // FIXME - Need to convert to tSirRetStatus |
| 6388 | statusCode = eSIR_FAILURE; |
| 6389 | goto returnAfterError; |
| 6390 | } |
| 6391 | else if( DOT11F_WARNED( nStatus )) |
| 6392 | { |
| 6393 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6394 | FL( "There were warnings while packing Radio " |
| 6395 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6396 | } |
| 6397 | |
| 6398 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6399 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6400 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6401 | |
| 6402 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6403 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6404 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6405 | ) |
| 6406 | { |
| 6407 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6408 | } |
| 6409 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6410 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6411 | psessionEntry->peSessionId, |
| 6412 | pMacHdr->fc.subType)); |
| 6413 | halstatus = halTxFrame( pMac, |
| 6414 | pPacket, |
| 6415 | (tANI_U16) nBytes, |
| 6416 | HAL_TXRX_FRM_802_11_MGMT, |
| 6417 | ANI_TXDIR_TODS, |
| 6418 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6419 | limTxComplete, |
| 6420 | pFrame, txFlag ); |
| 6421 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6422 | psessionEntry->peSessionId, |
| 6423 | halstatus)); |
| 6424 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6425 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6426 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6427 | statusCode = eSIR_FAILURE; |
| 6428 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6429 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6430 | return statusCode; |
| 6431 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6432 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6433 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6434 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6436 | |
| 6437 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6438 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6439 | 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] | 6440 | return statusCode; |
| 6441 | } // End limSendBeaconReportActionFrame. |
| 6442 | |
| 6443 | #endif |
| 6444 | |
| 6445 | #ifdef WLAN_FEATURE_11W |
| 6446 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6447 | * \brief Send SA query request action frame to peer |
| 6448 | * |
| 6449 | * \sa limSendSaQueryRequestFrame |
| 6450 | * |
| 6451 | * |
| 6452 | * \param pMac The global tpAniSirGlobal object |
| 6453 | * |
| 6454 | * \param transId Transaction identifier |
| 6455 | * |
| 6456 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6457 | * |
| 6458 | * \param psessionEntry The PE session entry |
| 6459 | * |
| 6460 | * \return eSIR_SUCCESS if setup completes successfully |
| 6461 | * eSIR_FAILURE is some problem is encountered |
| 6462 | */ |
| 6463 | |
| 6464 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6465 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6466 | { |
| 6467 | |
| 6468 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6469 | tANI_U8 *pFrame; |
| 6470 | tSirRetStatus nSirStatus; |
| 6471 | tpSirMacMgmtHdr pMacHdr; |
| 6472 | tANI_U32 nBytes, nPayload, nStatus; |
| 6473 | void *pPacket; |
| 6474 | eHalStatus halstatus; |
| 6475 | tANI_U8 txFlag = 0; |
| 6476 | |
| 6477 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6478 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6479 | /* 11w action field is : |
| 6480 | action: 0 --> SA Query Request action frame |
| 6481 | action: 1 --> SA Query Response action frame */ |
| 6482 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6483 | /* 11w SA Query Request transId */ |
| 6484 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6485 | |
| 6486 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6487 | if ( DOT11F_FAILED( nStatus ) ) |
| 6488 | { |
| 6489 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6490 | "for an SA Query Request (0x%08x)."), |
| 6491 | nStatus ); |
| 6492 | // We'll fall back on the worst case scenario: |
| 6493 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6494 | } |
| 6495 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6496 | { |
| 6497 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6498 | "the packed size for an SA Query Request" |
| 6499 | " (0x%08x)."), nStatus ); |
| 6500 | } |
| 6501 | |
| 6502 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6503 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6504 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6505 | { |
| 6506 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6507 | "action frame"), nBytes ); |
| 6508 | return eSIR_FAILURE; |
| 6509 | } |
| 6510 | |
| 6511 | // Paranoia: |
| 6512 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6513 | |
| 6514 | // Copy necessary info to BD |
| 6515 | nSirStatus = limPopulateMacHeader( pMac, |
| 6516 | pFrame, |
| 6517 | SIR_MAC_MGMT_FRAME, |
| 6518 | SIR_MAC_MGMT_ACTION, |
| 6519 | peer, psessionEntry->selfMacAddr ); |
| 6520 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6521 | goto returnAfterError; |
| 6522 | |
| 6523 | // Update A3 with the BSSID |
| 6524 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6525 | |
| 6526 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6527 | |
| 6528 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6529 | // in the FC |
| 6530 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6531 | |
| 6532 | // Pack 11w SA Query Request frame |
| 6533 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6534 | &frm, |
| 6535 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6536 | nPayload, |
| 6537 | &nPayload ); |
| 6538 | |
| 6539 | if ( DOT11F_FAILED( nStatus )) |
| 6540 | { |
| 6541 | limLog( pMac, LOGE, |
| 6542 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6543 | nStatus ); |
| 6544 | // FIXME - Need to convert to tSirRetStatus |
| 6545 | nSirStatus = eSIR_FAILURE; |
| 6546 | goto returnAfterError; |
| 6547 | } |
| 6548 | else if ( DOT11F_WARNED( nStatus )) |
| 6549 | { |
| 6550 | limLog( pMac, LOGW, |
| 6551 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6552 | nStatus); |
| 6553 | } |
| 6554 | |
| 6555 | limLog( pMac, LOG1, |
| 6556 | FL( "Sending an SA Query Request to " )); |
| 6557 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6558 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6559 | limLog( pMac, LOGE, |
| 6560 | FL( "Sending an SA Query Request from " )); |
| 6561 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6562 | |
| 6563 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6564 | #ifdef WLAN_FEATURE_P2P |
| 6565 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6566 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6567 | #endif |
| 6568 | ) |
| 6569 | { |
| 6570 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6571 | } |
| 6572 | |
| 6573 | halstatus = halTxFrame( pMac, |
| 6574 | pPacket, |
| 6575 | (tANI_U16) nBytes, |
| 6576 | HAL_TXRX_FRM_802_11_MGMT, |
| 6577 | ANI_TXDIR_TODS, |
| 6578 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6579 | limTxComplete, |
| 6580 | pFrame, txFlag ); |
| 6581 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6582 | { |
| 6583 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6584 | nSirStatus = eSIR_FAILURE; |
| 6585 | //Pkt will be freed up by the callback |
| 6586 | return nSirStatus; |
| 6587 | } |
| 6588 | else { |
| 6589 | return eSIR_SUCCESS; |
| 6590 | } |
| 6591 | |
| 6592 | returnAfterError: |
| 6593 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6594 | return nSirStatus; |
| 6595 | } // End limSendSaQueryRequestFrame |
| 6596 | |
| 6597 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6598 | * \brief Send SA query response action frame to peer |
| 6599 | * |
| 6600 | * \sa limSendSaQueryResponseFrame |
| 6601 | * |
| 6602 | * |
| 6603 | * \param pMac The global tpAniSirGlobal object |
| 6604 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6605 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6606 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6607 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6608 | * |
| 6609 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6610 | * |
| 6611 | * \return eSIR_SUCCESS if setup completes successfully |
| 6612 | * eSIR_FAILURE is some problem is encountered |
| 6613 | */ |
| 6614 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6615 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6617 | { |
| 6618 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6619 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | tANI_U8 *pFrame; |
| 6621 | tSirRetStatus nSirStatus; |
| 6622 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6623 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6624 | void *pPacket; |
| 6625 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6626 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6627 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6628 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6629 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6630 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | action: 0 --> SA query request action frame |
| 6632 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6633 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6634 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6635 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6636 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6637 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6638 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6639 | if ( DOT11F_FAILED( nStatus ) ) |
| 6640 | { |
| 6641 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6642 | "or a SA Query Response (0x%08x)."), |
| 6643 | nStatus ); |
| 6644 | // We'll fall back on the worst case scenario: |
| 6645 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6646 | } |
| 6647 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6648 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6649 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6650 | "the packed size for an SA Query Response" |
| 6651 | " (0x%08x)."), nStatus ); |
| 6652 | } |
| 6653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6655 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6656 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6657 | { |
| 6658 | 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] | 6659 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | return eSIR_FAILURE; |
| 6661 | } |
| 6662 | |
| 6663 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6664 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6666 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6667 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6668 | pFrame, |
| 6669 | SIR_MAC_MGMT_FRAME, |
| 6670 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6671 | peer, psessionEntry->selfMacAddr ); |
| 6672 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6673 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6674 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6675 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6677 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6678 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6679 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6680 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6681 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6682 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6683 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6684 | // Pack 11w SA query response frame |
| 6685 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6686 | &frm, |
| 6687 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6688 | nPayload, |
| 6689 | &nPayload ); |
| 6690 | |
| 6691 | if ( DOT11F_FAILED( nStatus )) |
| 6692 | { |
| 6693 | limLog( pMac, LOGE, |
| 6694 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6695 | nStatus ); |
| 6696 | // FIXME - Need to convert to tSirRetStatus |
| 6697 | nSirStatus = eSIR_FAILURE; |
| 6698 | goto returnAfterError; |
| 6699 | } |
| 6700 | else if ( DOT11F_WARNED( nStatus )) |
| 6701 | { |
| 6702 | limLog( pMac, LOGW, |
| 6703 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6704 | nStatus); |
| 6705 | } |
| 6706 | |
| 6707 | limLog( pMac, LOG1, |
| 6708 | FL( "Sending a SA Query Response to " )); |
| 6709 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6710 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6711 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6712 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6713 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6714 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6715 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6716 | ) |
| 6717 | { |
| 6718 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6719 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6720 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6721 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6722 | psessionEntry->peSessionId, |
| 6723 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6724 | halstatus = halTxFrame( pMac, |
| 6725 | pPacket, |
| 6726 | (tANI_U16) nBytes, |
| 6727 | HAL_TXRX_FRM_802_11_MGMT, |
| 6728 | ANI_TXDIR_TODS, |
| 6729 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6730 | limTxComplete, |
| 6731 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6732 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6733 | psessionEntry->peSessionId, |
| 6734 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6735 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6736 | { |
| 6737 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6738 | nSirStatus = eSIR_FAILURE; |
| 6739 | //Pkt will be freed up by the callback |
| 6740 | return nSirStatus; |
| 6741 | } |
| 6742 | else { |
| 6743 | return eSIR_SUCCESS; |
| 6744 | } |
| 6745 | |
| 6746 | returnAfterError: |
| 6747 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6748 | return nSirStatus; |
| 6749 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6750 | #endif |