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; |
| 653 | tANI_U32 cfg, nPayload, nBytes, nStatus; |
| 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; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 674 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 675 | { |
| 676 | return; // in this case. |
| 677 | } |
| 678 | |
| 679 | if(NULL == psessionEntry) |
| 680 | { |
| 681 | return; |
| 682 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 683 | |
| 684 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 685 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 686 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 687 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 688 | return; |
| 689 | } |
| 690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | // Fill out 'frm', after which we'll just hand the struct off to |
| 692 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 693 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 694 | |
| 695 | // Timestamp to be updated by TFP, below. |
| 696 | |
| 697 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 698 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 699 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 700 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 701 | } |
| 702 | else |
| 703 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 704 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 705 | if (eSIR_SUCCESS != nSirStatus) |
| 706 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 707 | 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] | 708 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 709 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 710 | return; |
| 711 | } |
| 712 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 713 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 714 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 715 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 716 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 718 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 719 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 720 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 721 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 724 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 725 | { |
| 726 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 727 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 728 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | } |
| 730 | } |
| 731 | else |
| 732 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 733 | 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] | 734 | 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] | 735 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 736 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
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 | if (wpsApEnable) |
| 739 | { |
| 740 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 741 | } |
| 742 | |
| 743 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 744 | { |
| 745 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 746 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 747 | } |
| 748 | |
| 749 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 750 | { |
| 751 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 752 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 753 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 754 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 755 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 756 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 757 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 758 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 759 | |
| 760 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 761 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 762 | |
| 763 | |
| 764 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 765 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 766 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 767 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 768 | |
| 769 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 770 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 771 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 772 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 773 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 774 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 775 | #ifdef WLAN_FEATURE_11AC |
| 776 | if(psessionEntry->vhtCapability) |
| 777 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 778 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 779 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
| 780 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 781 | // we do not support multi users yet |
| 782 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 783 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 784 | } |
| 785 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 786 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | if ( psessionEntry->pLimStartBssReq ) |
| 789 | { |
| 790 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 791 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 792 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 793 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | } |
| 795 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 796 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | |
| 798 | #if defined(FEATURE_WLAN_WAPI) |
| 799 | if( psessionEntry->pLimStartBssReq ) |
| 800 | { |
| 801 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 802 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 803 | } |
| 804 | |
| 805 | #endif // defined(FEATURE_WLAN_WAPI) |
| 806 | |
| 807 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 808 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 809 | if ( DOT11F_FAILED( nStatus ) ) |
| 810 | { |
| 811 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 812 | "or a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | nStatus ); |
| 814 | // We'll fall back on the worst case scenario: |
| 815 | nPayload = sizeof( tDot11fProbeResponse ); |
| 816 | } |
| 817 | else if ( DOT11F_WARNED( nStatus ) ) |
| 818 | { |
| 819 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 820 | "the packed size for a Probe Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 821 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 825 | |
| 826 | addnIEPresent = false; |
| 827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 828 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 829 | { |
| 830 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 831 | } |
| 832 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 833 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 834 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 835 | { |
| 836 | |
| 837 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 838 | &addnIEPresent) != eSIR_SUCCESS) |
| 839 | { |
| 840 | 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] | 841 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 842 | return; |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | if (addnIEPresent) |
| 847 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 848 | |
| 849 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 850 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 851 | { |
| 852 | PELOGE(limLog(pMac, LOGE, |
| 853 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 854 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 855 | return; |
| 856 | } |
| 857 | |
| 858 | //Probe rsp IE available |
| 859 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 860 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 861 | { |
| 862 | 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] | 863 | vos_mem_free(addIE); |
| 864 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 865 | return; |
| 866 | } |
| 867 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 868 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 869 | { |
| 870 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 871 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 872 | &addnIE1Len) ) |
| 873 | { |
| 874 | limLog(pMac, LOGP, |
| 875 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 876 | vos_mem_free(addIE); |
| 877 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 878 | return; |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | //Probe rsp IE available |
| 883 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 884 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 885 | { |
| 886 | 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] | 887 | vos_mem_free(addIE); |
| 888 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | return; |
| 890 | } |
| 891 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 892 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 893 | { |
| 894 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 895 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 896 | &addnIE2Len) ) |
| 897 | { |
| 898 | limLog(pMac, LOGP, |
| 899 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 900 | vos_mem_free(addIE); |
| 901 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 902 | return; |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | //Probe rsp IE available |
| 907 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 908 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 909 | { |
| 910 | 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] | 911 | vos_mem_free(addIE); |
| 912 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 913 | return; |
| 914 | } |
| 915 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 916 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 917 | { |
| 918 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 919 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 920 | &addIE[addnIE1Len + addnIE2Len], |
| 921 | &addnIE3Len) ) |
| 922 | { |
| 923 | limLog(pMac, LOGP, |
| 924 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 925 | vos_mem_free(addIE); |
| 926 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 927 | return; |
| 928 | } |
| 929 | } |
| 930 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 931 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 933 | { |
| 934 | limLog(pMac, LOGP, |
| 935 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 936 | vos_mem_free(addIE); |
| 937 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | return; |
| 939 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 940 | |
| 941 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 942 | sizeof( tDot11fIEExtCap ), 0); |
| 943 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 944 | addIE, |
| 945 | &totalAddnIeLen, |
| 946 | &extractedExtCap ); |
| 947 | if(eSIR_SUCCESS != nSirStatus ) |
| 948 | { |
| 949 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 950 | limLog(pMac, LOG1, |
| 951 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 952 | } |
| 953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | nBytes = nBytes + totalAddnIeLen; |
| 955 | |
| 956 | if (probeReqP2pIe) |
| 957 | { |
| 958 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 959 | if (pP2pIe != NULL) |
| 960 | { |
| 961 | //get NoA attribute stream P2P IE |
| 962 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 963 | if (noaLen != 0) |
| 964 | { |
| 965 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 966 | &noaStream[0], noaLen); |
| 967 | nBytes = nBytes + total_noaLen; |
| 968 | } |
| 969 | } |
| 970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 971 | } |
| 972 | |
| 973 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 974 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 975 | ( void** ) &pPacket ); |
| 976 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 977 | { |
| 978 | 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] | 979 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | if ( addIE != NULL ) |
| 981 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 982 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 984 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | return; |
| 986 | } |
| 987 | |
| 988 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 989 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | |
| 991 | // Next, we fill out the buffer descriptor: |
| 992 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 993 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 994 | if ( eSIR_SUCCESS != nSirStatus ) |
| 995 | { |
| 996 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 997 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 998 | nSirStatus ); |
| 999 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1000 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1001 | if ( addIE != NULL ) |
| 1002 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1003 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1004 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1005 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1006 | return; |
| 1007 | } |
| 1008 | |
| 1009 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1010 | |
| 1011 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1012 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1013 | /*merge ExtCap IE*/ |
| 1014 | if (extractedExtCapFlag) |
| 1015 | { |
| 1016 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 1017 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1018 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1019 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1020 | nPayload, &nPayload ); |
| 1021 | if ( DOT11F_FAILED( nStatus ) ) |
| 1022 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1023 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1024 | nStatus ); |
| 1025 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1026 | if ( addIE != NULL ) |
| 1027 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1028 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1029 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1030 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1031 | return; // allocated! |
| 1032 | } |
| 1033 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1034 | { |
| 1035 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1036 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1037 | } |
| 1038 | |
| 1039 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1040 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1041 | |
| 1042 | pMac->sys.probeRespond++; |
| 1043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1045 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1046 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1047 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1049 | |
| 1050 | if ( addnIEPresent ) |
| 1051 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1052 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1053 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1054 | if (noaLen != 0) |
| 1055 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1056 | 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] | 1057 | { |
| 1058 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1059 | FL("Not able to insert NoA because of length constraint." |
| 1060 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1061 | vos_mem_free(addIE); |
| 1062 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1063 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1064 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1065 | return; |
| 1066 | } |
| 1067 | else |
| 1068 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1069 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1070 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | } |
| 1072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1073 | |
| 1074 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1075 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1076 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | ) |
| 1078 | { |
| 1079 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1080 | } |
| 1081 | |
| 1082 | // Queue Probe Response frame in high priority WQ |
| 1083 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1084 | ( tANI_U16 ) nBytes, |
| 1085 | HAL_TXRX_FRM_802_11_MGMT, |
| 1086 | ANI_TXDIR_TODS, |
| 1087 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1088 | limTxComplete, pFrame, txFlag ); |
| 1089 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1090 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1091 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1092 | //Pkt will be freed up by the callback |
| 1093 | } |
| 1094 | |
| 1095 | if ( addIE != NULL ) |
| 1096 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1097 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1098 | } |
| 1099 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1100 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1101 | return; |
| 1102 | |
| 1103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | } // End limSendProbeRspMgmtFrame. |
| 1105 | |
| 1106 | void |
| 1107 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1108 | tSirMacAddr peerMacAddr, |
| 1109 | tSirAddtsReqInfo *pAddTS, |
| 1110 | tpPESession psessionEntry) |
| 1111 | { |
| 1112 | tANI_U16 i; |
| 1113 | tANI_U8 *pFrame; |
| 1114 | tSirRetStatus nSirStatus; |
| 1115 | tDot11fAddTSRequest AddTSReq; |
| 1116 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1117 | tANI_U32 nPayload, nBytes, nStatus; |
| 1118 | tpSirMacMgmtHdr pMacHdr; |
| 1119 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1120 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | tANI_U32 phyMode; |
| 1122 | #endif |
| 1123 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1124 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1125 | |
| 1126 | if(NULL == psessionEntry) |
| 1127 | { |
| 1128 | return; |
| 1129 | } |
| 1130 | |
| 1131 | if ( ! pAddTS->wmeTspecPresent ) |
| 1132 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1133 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | |
| 1135 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1136 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1137 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1138 | if ( pAddTS->lleTspecPresent ) |
| 1139 | { |
| 1140 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1141 | } |
| 1142 | else |
| 1143 | { |
| 1144 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1145 | } |
| 1146 | |
| 1147 | if ( pAddTS->lleTspecPresent ) |
| 1148 | { |
| 1149 | AddTSReq.num_WMMTCLAS = 0; |
| 1150 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1151 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1152 | { |
| 1153 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1154 | &AddTSReq.TCLAS[i] ); |
| 1155 | } |
| 1156 | } |
| 1157 | else |
| 1158 | { |
| 1159 | AddTSReq.num_TCLAS = 0; |
| 1160 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1161 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1162 | { |
| 1163 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1164 | &AddTSReq.WMMTCLAS[i] ); |
| 1165 | } |
| 1166 | } |
| 1167 | |
| 1168 | if ( pAddTS->tclasProcPresent ) |
| 1169 | { |
| 1170 | if ( pAddTS->lleTspecPresent ) |
| 1171 | { |
| 1172 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1173 | AddTSReq.TCLASSPROC.present = 1; |
| 1174 | } |
| 1175 | else |
| 1176 | { |
| 1177 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1178 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1179 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1180 | } |
| 1181 | } |
| 1182 | |
| 1183 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1184 | if ( DOT11F_FAILED( nStatus ) ) |
| 1185 | { |
| 1186 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1187 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | nStatus ); |
| 1189 | // We'll fall back on the worst case scenario: |
| 1190 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1191 | } |
| 1192 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1193 | { |
| 1194 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1195 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1196 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1197 | } |
| 1198 | } |
| 1199 | else |
| 1200 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1201 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1202 | |
| 1203 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1204 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1205 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1206 | |
| 1207 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1208 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1209 | |
| 1210 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1211 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1212 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1213 | |
| 1214 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1215 | { |
| 1216 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1217 | } |
| 1218 | else |
| 1219 | { |
| 1220 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1221 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1222 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1223 | #endif |
| 1224 | // fillWmeTspecIE |
| 1225 | |
| 1226 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1227 | if ( DOT11F_FAILED( nStatus ) ) |
| 1228 | { |
| 1229 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1230 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | nStatus ); |
| 1232 | // We'll fall back on the worst case scenario: |
| 1233 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1234 | } |
| 1235 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1236 | { |
| 1237 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1238 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1239 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | } |
| 1241 | } |
| 1242 | |
| 1243 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1244 | |
| 1245 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1246 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1247 | ( void** ) &pPacket ); |
| 1248 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1249 | { |
| 1250 | 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] | 1251 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | return; |
| 1253 | } |
| 1254 | |
| 1255 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1256 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1257 | |
| 1258 | // Next, we fill out the buffer descriptor: |
| 1259 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1260 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1261 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1262 | { |
| 1263 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1264 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1265 | nSirStatus ); |
| 1266 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1267 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1268 | return; |
| 1269 | } |
| 1270 | |
| 1271 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1272 | |
| 1273 | #if 0 |
| 1274 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1275 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1276 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1277 | { |
| 1278 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1279 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1281 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1282 | return; |
| 1283 | } |
| 1284 | #endif //TO SUPPORT BT-AMP |
| 1285 | |
| 1286 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1287 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1288 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1289 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1290 | #endif |
| 1291 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1292 | // That done, pack the struct: |
| 1293 | if ( ! pAddTS->wmeTspecPresent ) |
| 1294 | { |
| 1295 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1296 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1297 | nPayload, &nPayload ); |
| 1298 | if ( DOT11F_FAILED( nStatus ) ) |
| 1299 | { |
| 1300 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1301 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | nStatus ); |
| 1303 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1304 | return; // allocated! |
| 1305 | } |
| 1306 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1307 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1308 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1309 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1310 | } |
| 1311 | } |
| 1312 | else |
| 1313 | { |
| 1314 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1315 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1316 | nPayload, &nPayload ); |
| 1317 | if ( DOT11F_FAILED( nStatus ) ) |
| 1318 | { |
| 1319 | 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] | 1320 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1321 | nStatus ); |
| 1322 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1323 | return; // allocated! |
| 1324 | } |
| 1325 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1326 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1327 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1328 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1329 | } |
| 1330 | } |
| 1331 | |
| 1332 | PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") ); |
| 1333 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1334 | |
| 1335 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1336 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1337 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1338 | ) |
| 1339 | { |
| 1340 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1341 | } |
| 1342 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1343 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1344 | psessionEntry->peSessionId, |
| 1345 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1346 | // Queue Addts Response frame in high priority WQ |
| 1347 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1348 | HAL_TXRX_FRM_802_11_MGMT, |
| 1349 | ANI_TXDIR_TODS, |
| 1350 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1351 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1352 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1353 | psessionEntry->peSessionId, |
| 1354 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1355 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1356 | { |
| 1357 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1358 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1359 | //Pkt will be freed up by the callback |
| 1360 | } |
| 1361 | |
| 1362 | } // End limSendAddtsReqActionFrame. |
| 1363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1364 | |
| 1365 | |
| 1366 | void |
| 1367 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1368 | tANI_U16 statusCode, |
| 1369 | tANI_U16 aid, |
| 1370 | tSirMacAddr peerMacAddr, |
| 1371 | tANI_U8 subType, |
| 1372 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1373 | { |
| 1374 | static tDot11fAssocResponse frm; |
| 1375 | tANI_U8 *pFrame, *macAddr; |
| 1376 | tpSirMacMgmtHdr pMacHdr; |
| 1377 | tSirRetStatus nSirStatus; |
| 1378 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1379 | tHalBitVal qosMode, wmeMode; |
| 1380 | tANI_U32 nPayload, nBytes, nStatus; |
| 1381 | void *pPacket; |
| 1382 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1383 | tUpdateBeaconParams beaconParams; |
| 1384 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1385 | tANI_U32 addnIEPresent = false; |
| 1386 | tANI_U32 addnIELen=0; |
| 1387 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1388 | tpSirAssocReq pAssocReq = NULL; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1389 | tANI_U16 addStripoffIELen = 0; |
| 1390 | tDot11fIEExtCap extractedExtCap; |
| 1391 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 1392 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1393 | #ifdef WLAN_FEATURE_11W |
| 1394 | tANI_U32 retryInterval; |
| 1395 | tANI_U32 maxRetries; |
| 1396 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1397 | |
| 1398 | if(NULL == psessionEntry) |
| 1399 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1400 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1401 | return; |
| 1402 | } |
| 1403 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1404 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | |
| 1406 | limGetQosMode(psessionEntry, &qosMode); |
| 1407 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1408 | |
| 1409 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1410 | // STA sent a traffic spec. |
| 1411 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1412 | |
| 1413 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1414 | |
| 1415 | frm.Status.status = statusCode; |
| 1416 | |
| 1417 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1418 | |
| 1419 | if ( NULL == pSta ) |
| 1420 | { |
| 1421 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1422 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1423 | } |
| 1424 | else |
| 1425 | { |
| 1426 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1427 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1428 | } |
| 1429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1430 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1431 | { |
| 1432 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1433 | { |
| 1434 | pAssocReq = |
| 1435 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1436 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1437 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1438 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1439 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1440 | } |
| 1441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1442 | |
| 1443 | if ( NULL != pSta ) |
| 1444 | { |
| 1445 | if ( eHAL_SET == qosMode ) |
| 1446 | { |
| 1447 | if ( pSta->lleEnabled ) |
| 1448 | { |
| 1449 | lleMode = 1; |
| 1450 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1451 | { |
| 1452 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1453 | |
| 1454 | // FramesToDo:... |
| 1455 | // if ( fAddTS ) |
| 1456 | // { |
| 1457 | // tANI_U8 *pAf = pBody; |
| 1458 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1459 | // tANI_U32 tlen; |
| 1460 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1461 | // &tlen, bufLen - frameLen); |
| 1462 | // } // End if on Add TS. |
| 1463 | } |
| 1464 | } // End if on .11e enabled in 'pSta'. |
| 1465 | } // End if on QOS Mode on. |
| 1466 | |
| 1467 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1468 | { |
| 1469 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1470 | { |
| 1471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1472 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1473 | |
| 1474 | if ( pSta->wsmEnabled ) |
| 1475 | { |
| 1476 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1477 | } |
| 1478 | } |
| 1479 | } |
| 1480 | |
| 1481 | if ( pSta->aniPeer ) |
| 1482 | { |
| 1483 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1484 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1485 | { |
| 1486 | edcaInclude = 1; |
| 1487 | } |
| 1488 | |
| 1489 | } // End if on Airgo peer. |
| 1490 | |
| 1491 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1492 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1493 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1494 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1495 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1497 | |
| 1498 | #ifdef WLAN_FEATURE_11AC |
| 1499 | if( pSta->mlmStaContext.vhtCapability && |
| 1500 | psessionEntry->vhtCapability ) |
| 1501 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1502 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1503 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
| 1504 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1505 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1506 | } |
| 1507 | #endif |
| 1508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1509 | } // End if on non-NULL 'pSta'. |
| 1510 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1511 | #ifdef WLAN_FEATURE_11W |
| 1512 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1513 | { |
| 1514 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1515 | &maxRetries ) != eSIR_SUCCESS ) |
| 1516 | limLog( pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1517 | else |
| 1518 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1519 | &retryInterval ) != eSIR_SUCCESS) |
| 1520 | limLog( pMac, LOGE, FL("Could not retrieve PMF SA Query timer interval value") ); |
| 1521 | else |
| 1522 | PopulateDot11fTimeoutInterval( |
| 1523 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1524 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
| 1525 | } |
| 1526 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1527 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1528 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1530 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1531 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1532 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1534 | |
| 1535 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1536 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1537 | |
| 1538 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1539 | |
| 1540 | //Send message to HAL about beacon parameter change. |
| 1541 | if(beaconParams.paramChangeBitmap) |
| 1542 | { |
| 1543 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1544 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1545 | } |
| 1546 | |
| 1547 | // Allocate a buffer for this frame: |
| 1548 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1549 | if ( DOT11F_FAILED( nStatus ) ) |
| 1550 | { |
| 1551 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1552 | "or an Association Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1553 | nStatus ); |
| 1554 | return; |
| 1555 | } |
| 1556 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1557 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1558 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1559 | "the packed size for an Association Re" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1560 | "sponse (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1561 | } |
| 1562 | |
| 1563 | nBytes = sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1564 | |
| 1565 | if ( pAssocReq != NULL ) |
| 1566 | { |
| 1567 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1568 | &addnIEPresent) != eSIR_SUCCESS) |
| 1569 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1570 | limLog(pMac, LOGP, FL("Unable to get " |
| 1571 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1572 | return; |
| 1573 | } |
| 1574 | |
| 1575 | if (addnIEPresent) |
| 1576 | { |
| 1577 | //Assoc rsp IE available |
| 1578 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1579 | &addnIELen) != eSIR_SUCCESS) |
| 1580 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1581 | limLog(pMac, LOGP, FL("Unable to get " |
| 1582 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1583 | return; |
| 1584 | } |
| 1585 | |
| 1586 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1587 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1588 | { |
| 1589 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1590 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1591 | { |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1592 | |
| 1593 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1594 | sizeof( tDot11fIEExtCap ), 0); |
| 1595 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1596 | &addIE[0], |
| 1597 | &addStripoffIELen, |
| 1598 | &extractedExtCap ); |
| 1599 | if(eSIR_SUCCESS != nSirStatus) |
| 1600 | { |
| 1601 | limLog(pMac, LOG1, |
| 1602 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1603 | } |
| 1604 | else |
| 1605 | { |
| 1606 | addnIELen = addStripoffIELen; |
| 1607 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1608 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1609 | nBytes = nBytes + addnIELen; |
| 1610 | } |
| 1611 | } |
| 1612 | } |
| 1613 | } |
| 1614 | |
| 1615 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1616 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1617 | ( void** ) &pPacket ); |
| 1618 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1619 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1620 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1621 | return; |
| 1622 | } |
| 1623 | |
| 1624 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1625 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1626 | |
| 1627 | // Next, we fill out the buffer descriptor: |
| 1628 | nSirStatus = limPopulateMacHeader( pMac, |
| 1629 | pFrame, |
| 1630 | SIR_MAC_MGMT_FRAME, |
| 1631 | ( LIM_ASSOC == subType ) ? |
| 1632 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1633 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1634 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1635 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1636 | { |
| 1637 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1638 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1639 | nSirStatus ); |
| 1640 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1641 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1642 | return; |
| 1643 | } |
| 1644 | |
| 1645 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1647 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1648 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1649 | /* merge the ExtCap struct*/ |
| 1650 | if (extractedExtCapFlag) |
| 1651 | { |
| 1652 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap); |
| 1653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1654 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1655 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1656 | nPayload, &nPayload ); |
| 1657 | if ( DOT11F_FAILED( nStatus ) ) |
| 1658 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1659 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1660 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1661 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1662 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1663 | return; // allocated! |
| 1664 | } |
| 1665 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1666 | { |
| 1667 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1668 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | } |
| 1670 | |
| 1671 | macAddr = pMacHdr->da; |
| 1672 | |
| 1673 | if (subType == LIM_ASSOC) |
| 1674 | { |
| 1675 | PELOG1(limLog(pMac, LOG1, |
| 1676 | FL("*** Sending Assoc Resp status %d aid %d to "), |
| 1677 | statusCode, aid);) |
| 1678 | } |
| 1679 | else{ |
| 1680 | PELOG1(limLog(pMac, LOG1, |
| 1681 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
| 1682 | statusCode, aid);) |
| 1683 | } |
| 1684 | PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1685 | |
| 1686 | if ( addnIEPresent ) |
| 1687 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1688 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1689 | } |
| 1690 | |
| 1691 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1692 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1693 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1694 | ) |
| 1695 | { |
| 1696 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1697 | } |
| 1698 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1699 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1700 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1701 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1702 | |
| 1703 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1704 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1705 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1706 | psessionEntry->peSessionId, |
| 1707 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1708 | /// Queue Association Response frame in high priority WQ |
| 1709 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1710 | HAL_TXRX_FRM_802_11_MGMT, |
| 1711 | ANI_TXDIR_TODS, |
| 1712 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1713 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1714 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1715 | psessionEntry->peSessionId, |
| 1716 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1717 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1718 | { |
| 1719 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1720 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1721 | nSirStatus); |
| 1722 | |
| 1723 | //Pkt will be freed up by the callback |
| 1724 | } |
| 1725 | |
| 1726 | // update the ANI peer station count |
| 1727 | //FIXME_PROTECTION : take care of different type of station |
| 1728 | // counter inside this function. |
| 1729 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1730 | |
| 1731 | } // End limSendAssocRspMgmtFrame. |
| 1732 | |
| 1733 | |
| 1734 | |
| 1735 | void |
| 1736 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1737 | tSirMacAddr peer, |
| 1738 | tANI_U16 nStatusCode, |
| 1739 | tSirAddtsReqInfo *pAddTS, |
| 1740 | tSirMacScheduleIE *pSchedule, |
| 1741 | tpPESession psessionEntry) |
| 1742 | { |
| 1743 | tANI_U8 *pFrame; |
| 1744 | tpSirMacMgmtHdr pMacHdr; |
| 1745 | tDot11fAddTSResponse AddTSRsp; |
| 1746 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1747 | tSirRetStatus nSirStatus; |
| 1748 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1749 | void *pPacket; |
| 1750 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1751 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1752 | |
| 1753 | if(NULL == psessionEntry) |
| 1754 | { |
| 1755 | return; |
| 1756 | } |
| 1757 | |
| 1758 | if ( ! pAddTS->wmeTspecPresent ) |
| 1759 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1760 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | |
| 1762 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1763 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1764 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1765 | AddTSRsp.Status.status = nStatusCode; |
| 1766 | |
| 1767 | // The TsDelay information element is only filled in for a specific |
| 1768 | // status code: |
| 1769 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1770 | { |
| 1771 | if ( pAddTS->wsmTspecPresent ) |
| 1772 | { |
| 1773 | AddTSRsp.WMMTSDelay.version = 1; |
| 1774 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1775 | AddTSRsp.WMMTSDelay.present = 1; |
| 1776 | } |
| 1777 | else |
| 1778 | { |
| 1779 | AddTSRsp.TSDelay.delay = 10; |
| 1780 | AddTSRsp.TSDelay.present = 1; |
| 1781 | } |
| 1782 | } |
| 1783 | |
| 1784 | if ( pAddTS->wsmTspecPresent ) |
| 1785 | { |
| 1786 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1787 | } |
| 1788 | else |
| 1789 | { |
| 1790 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1791 | } |
| 1792 | |
| 1793 | if ( pAddTS->wsmTspecPresent ) |
| 1794 | { |
| 1795 | AddTSRsp.num_WMMTCLAS = 0; |
| 1796 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1797 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1798 | { |
| 1799 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1800 | &AddTSRsp.TCLAS[i] ); |
| 1801 | } |
| 1802 | } |
| 1803 | else |
| 1804 | { |
| 1805 | AddTSRsp.num_TCLAS = 0; |
| 1806 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1807 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1808 | { |
| 1809 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1810 | &AddTSRsp.WMMTCLAS[i] ); |
| 1811 | } |
| 1812 | } |
| 1813 | |
| 1814 | if ( pAddTS->tclasProcPresent ) |
| 1815 | { |
| 1816 | if ( pAddTS->wsmTspecPresent ) |
| 1817 | { |
| 1818 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1819 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1820 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1821 | } |
| 1822 | else |
| 1823 | { |
| 1824 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1825 | AddTSRsp.TCLASSPROC.present = 1; |
| 1826 | } |
| 1827 | } |
| 1828 | |
| 1829 | // schedule element is included only if requested in the tspec and we are |
| 1830 | // using hcca (or both edca and hcca) |
| 1831 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1832 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1833 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1834 | // sta figure it out |
| 1835 | if ((pSchedule != NULL) && |
| 1836 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1837 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1838 | { |
| 1839 | if ( pAddTS->wsmTspecPresent ) |
| 1840 | { |
| 1841 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1842 | } |
| 1843 | else |
| 1844 | { |
| 1845 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1846 | } |
| 1847 | } |
| 1848 | |
| 1849 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1850 | if ( DOT11F_FAILED( nStatus ) ) |
| 1851 | { |
| 1852 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1853 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1854 | nStatus ); |
| 1855 | // We'll fall back on the worst case scenario: |
| 1856 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1857 | } |
| 1858 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1859 | { |
| 1860 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1861 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1862 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1863 | } |
| 1864 | } |
| 1865 | else |
| 1866 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1867 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1868 | |
| 1869 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1870 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1871 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1872 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1873 | |
| 1874 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1875 | |
| 1876 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1877 | if ( DOT11F_FAILED( nStatus ) ) |
| 1878 | { |
| 1879 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1880 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1881 | nStatus ); |
| 1882 | // We'll fall back on the worst case scenario: |
| 1883 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1884 | } |
| 1885 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1886 | { |
| 1887 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1888 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1889 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1890 | } |
| 1891 | } |
| 1892 | |
| 1893 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1894 | |
| 1895 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1896 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1897 | { |
| 1898 | 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] | 1899 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1900 | return; |
| 1901 | } |
| 1902 | |
| 1903 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1904 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1905 | |
| 1906 | // Next, we fill out the buffer descriptor: |
| 1907 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1908 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1909 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1910 | { |
| 1911 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1912 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1913 | nSirStatus ); |
| 1914 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1915 | return; // allocated! |
| 1916 | } |
| 1917 | |
| 1918 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1919 | |
| 1920 | |
| 1921 | #if 0 |
| 1922 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1923 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1924 | { |
| 1925 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1926 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1927 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1928 | return; // allocated! |
| 1929 | } |
| 1930 | #endif //TO SUPPORT BT-AMP |
| 1931 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1932 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1933 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1934 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1935 | #endif |
| 1936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1937 | // That done, pack the struct: |
| 1938 | if ( ! pAddTS->wmeTspecPresent ) |
| 1939 | { |
| 1940 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1941 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1942 | nPayload, &nPayload ); |
| 1943 | if ( DOT11F_FAILED( nStatus ) ) |
| 1944 | { |
| 1945 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1946 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1947 | nStatus ); |
| 1948 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1949 | return; |
| 1950 | } |
| 1951 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1952 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1953 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1954 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | } |
| 1956 | } |
| 1957 | else |
| 1958 | { |
| 1959 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1960 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1961 | nPayload, &nPayload ); |
| 1962 | if ( DOT11F_FAILED( nStatus ) ) |
| 1963 | { |
| 1964 | 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] | 1965 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1966 | nStatus ); |
| 1967 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1968 | return; |
| 1969 | } |
| 1970 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1971 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1972 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1973 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | } |
| 1975 | } |
| 1976 | |
| 1977 | PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
| 1978 | nStatusCode ); |
| 1979 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 1980 | |
| 1981 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1982 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1983 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1984 | ) |
| 1985 | { |
| 1986 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1987 | } |
| 1988 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1989 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1990 | psessionEntry->peSessionId, |
| 1991 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1992 | // Queue the frame in high priority WQ: |
| 1993 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1994 | HAL_TXRX_FRM_802_11_MGMT, |
| 1995 | ANI_TXDIR_TODS, |
| 1996 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1997 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1998 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1999 | psessionEntry->peSessionId, |
| 2000 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2002 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2003 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | nSirStatus ); |
| 2005 | //Pkt will be freed up by the callback |
| 2006 | } |
| 2007 | |
| 2008 | } // End limSendAddtsRspActionFrame. |
| 2009 | |
| 2010 | void |
| 2011 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 2012 | tSirMacAddr peer, |
| 2013 | tANI_U8 wmmTspecPresent, |
| 2014 | tSirMacTSInfo *pTsinfo, |
| 2015 | tSirMacTspecIE *pTspecIe, |
| 2016 | tpPESession psessionEntry) |
| 2017 | { |
| 2018 | tANI_U8 *pFrame; |
| 2019 | tpSirMacMgmtHdr pMacHdr; |
| 2020 | tDot11fDelTS DelTS; |
| 2021 | tDot11fWMMDelTS WMMDelTS; |
| 2022 | tSirRetStatus nSirStatus; |
| 2023 | tANI_U32 nBytes, nPayload, nStatus; |
| 2024 | void *pPacket; |
| 2025 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2026 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2027 | |
| 2028 | if(NULL == psessionEntry) |
| 2029 | { |
| 2030 | return; |
| 2031 | } |
| 2032 | |
| 2033 | if ( ! wmmTspecPresent ) |
| 2034 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2035 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | |
| 2037 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2038 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2039 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2040 | |
| 2041 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2042 | if ( DOT11F_FAILED( nStatus ) ) |
| 2043 | { |
| 2044 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2045 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2046 | nStatus ); |
| 2047 | // We'll fall back on the worst case scenario: |
| 2048 | nPayload = sizeof( tDot11fDelTS ); |
| 2049 | } |
| 2050 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2051 | { |
| 2052 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2053 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2054 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2055 | } |
| 2056 | } |
| 2057 | else |
| 2058 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2059 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2060 | |
| 2061 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2062 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2063 | WMMDelTS.DialogToken.token = 0; |
| 2064 | WMMDelTS.StatusCode.statusCode = 0; |
| 2065 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2066 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2067 | if ( DOT11F_FAILED( nStatus ) ) |
| 2068 | { |
| 2069 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2070 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2071 | nStatus ); |
| 2072 | // We'll fall back on the worst case scenario: |
| 2073 | nPayload = sizeof( tDot11fDelTS ); |
| 2074 | } |
| 2075 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2076 | { |
| 2077 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2078 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2079 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2084 | |
| 2085 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2086 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2087 | { |
| 2088 | 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] | 2089 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2090 | return; |
| 2091 | } |
| 2092 | |
| 2093 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2094 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2095 | |
| 2096 | // Next, we fill out the buffer descriptor: |
| 2097 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2098 | SIR_MAC_MGMT_ACTION, peer, |
| 2099 | psessionEntry->selfMacAddr); |
| 2100 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2101 | { |
| 2102 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2103 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2104 | nSirStatus ); |
| 2105 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2106 | return; // allocated! |
| 2107 | } |
| 2108 | |
| 2109 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2110 | |
| 2111 | #if 0 |
| 2112 | |
| 2113 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2114 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2115 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2116 | { |
| 2117 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2118 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2119 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2120 | return; // allocated! |
| 2121 | } |
| 2122 | #endif //TO SUPPORT BT-AMP |
| 2123 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2124 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2125 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2126 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2127 | #endif |
| 2128 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2129 | // That done, pack the struct: |
| 2130 | if ( !wmmTspecPresent ) |
| 2131 | { |
| 2132 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2133 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2134 | nPayload, &nPayload ); |
| 2135 | if ( DOT11F_FAILED( nStatus ) ) |
| 2136 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2137 | 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] | 2138 | nStatus ); |
| 2139 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2140 | return; // allocated! |
| 2141 | } |
| 2142 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2143 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2144 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2145 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2146 | } |
| 2147 | } |
| 2148 | else |
| 2149 | { |
| 2150 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2151 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2152 | nPayload, &nPayload ); |
| 2153 | if ( DOT11F_FAILED( nStatus ) ) |
| 2154 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2155 | 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] | 2156 | nStatus ); |
| 2157 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2158 | return; // allocated! |
| 2159 | } |
| 2160 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2161 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2162 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2163 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2164 | } |
| 2165 | } |
| 2166 | |
| 2167 | PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2168 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 2169 | |
| 2170 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2171 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2172 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2173 | ) |
| 2174 | { |
| 2175 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2176 | } |
| 2177 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2178 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2179 | psessionEntry->peSessionId, |
| 2180 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2181 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2182 | HAL_TXRX_FRM_802_11_MGMT, |
| 2183 | ANI_TXDIR_TODS, |
| 2184 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2185 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2186 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2187 | psessionEntry->peSessionId, |
| 2188 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2189 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2190 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2191 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2192 | nSirStatus ); |
| 2193 | //Pkt will be freed up by the callback |
| 2194 | } |
| 2195 | |
| 2196 | } // End limSendDeltsReqActionFrame. |
| 2197 | |
| 2198 | void |
| 2199 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2200 | tLimMlmAssocReq *pMlmAssocReq, |
| 2201 | tpPESession psessionEntry) |
| 2202 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2203 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2204 | tANI_U16 caps; |
| 2205 | tANI_U8 *pFrame; |
| 2206 | tSirRetStatus nSirStatus; |
| 2207 | tLimMlmAssocCnf mlmAssocCnf; |
| 2208 | tANI_U32 nBytes, nPayload, nStatus; |
| 2209 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2210 | void *pPacket; |
| 2211 | eHalStatus halstatus; |
| 2212 | tANI_U16 nAddIELen; |
| 2213 | tANI_U8 *pAddIE; |
| 2214 | tANI_U8 *wpsIe = NULL; |
| 2215 | #if defined WLAN_FEATURE_VOWIFI |
| 2216 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2217 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2218 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2219 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2220 | tDot11fIEExtCap extractedExtCap; |
| 2221 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2222 | |
| 2223 | if(NULL == psessionEntry) |
| 2224 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2225 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2226 | return; |
| 2227 | } |
| 2228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | /* check this early to avoid unncessary operation */ |
| 2230 | if(NULL == psessionEntry->pLimJoinReq) |
| 2231 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2232 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2233 | return; |
| 2234 | } |
| 2235 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2236 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2237 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2238 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2239 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2240 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2241 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2242 | return; |
| 2243 | } |
| 2244 | |
| 2245 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2246 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2248 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 2249 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
| 2250 | &nAddIELen, |
| 2251 | &extractedExtCap ); |
| 2252 | if(eSIR_SUCCESS != nSirStatus ) |
| 2253 | { |
| 2254 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2255 | limLog(pMac, LOG1, |
| 2256 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2257 | } |
| 2258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2259 | caps = pMlmAssocReq->capabilityInfo; |
| 2260 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2261 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2262 | #if defined(FEATURE_WLAN_WAPI) |
| 2263 | /* CR: 262463 : |
| 2264 | According to WAPI standard: |
| 2265 | 7.3.1.4 Capability Information field |
| 2266 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2267 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2268 | Reassociation management frames. */ |
| 2269 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2270 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2271 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2272 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2274 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2275 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2277 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2278 | |
| 2279 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2280 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2281 | |
| 2282 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2283 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2284 | |
| 2285 | // We prefer .11e asociations: |
| 2286 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2287 | |
| 2288 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2289 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2290 | |
| 2291 | if ( psessionEntry->lim11hEnable && |
| 2292 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2293 | { |
| 2294 | #if defined WLAN_FEATURE_VOWIFI |
| 2295 | PowerCapsPopulated = TRUE; |
| 2296 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2297 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2298 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2299 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2300 | |
| 2301 | } |
| 2302 | |
| 2303 | #if defined WLAN_FEATURE_VOWIFI |
| 2304 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2305 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2306 | { |
| 2307 | if (PowerCapsPopulated == FALSE) |
| 2308 | { |
| 2309 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2310 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2311 | } |
| 2312 | } |
| 2313 | #endif |
| 2314 | |
| 2315 | if ( fQosEnabled && |
| 2316 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2317 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2318 | |
| 2319 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2320 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2321 | |
| 2322 | #if defined WLAN_FEATURE_VOWIFI |
| 2323 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2324 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2325 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2326 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2327 | } |
| 2328 | #endif |
| 2329 | // The join request *should* contain zero or one of the WPA and RSN |
| 2330 | // IEs. The payload send along with the request is a |
| 2331 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2332 | |
| 2333 | // typedef struct sSirRSNie |
| 2334 | // { |
| 2335 | // tANI_U16 length; |
| 2336 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2337 | // } tSirRSNie, *tpSirRSNie; |
| 2338 | |
| 2339 | // So, we should be able to make the following two calls harmlessly, |
| 2340 | // since they do nothing if they don't find the given IE in the |
| 2341 | // bytestream with which they're provided. |
| 2342 | |
| 2343 | // The net effect of this will be to faithfully transmit whatever |
| 2344 | // security IE is in the join request. |
| 2345 | |
| 2346 | // *However*, if we're associating for the purpose of WPS |
| 2347 | // enrollment, and we've been configured to indicate that by |
| 2348 | // eliding the WPA or RSN IE, we just skip this: |
| 2349 | if( nAddIELen && pAddIE ) |
| 2350 | { |
| 2351 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2352 | } |
| 2353 | if ( NULL == wpsIe ) |
| 2354 | { |
| 2355 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2356 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2357 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2358 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | #if defined(FEATURE_WLAN_WAPI) |
| 2360 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2361 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2363 | } |
| 2364 | |
| 2365 | // include WME EDCA IE as well |
| 2366 | if ( fWmeEnabled ) |
| 2367 | { |
| 2368 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2369 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2370 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | } |
| 2372 | |
| 2373 | if ( fWsmEnabled && |
| 2374 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2375 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2376 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | } |
| 2378 | } |
| 2379 | |
| 2380 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2381 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2382 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2383 | pMac->lim.htCapabilityPresentInBeacon) |
| 2384 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2385 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2386 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2387 | |
| 2388 | /* |
| 2389 | * To resolve the interop problem with Broadcom AP, |
| 2390 | * where TQ STA could not pass traffic with GF enabled, |
| 2391 | * TQ STA will do Greenfield only with TQ AP, for |
| 2392 | * everybody else it will be turned off. |
| 2393 | */ |
| 2394 | |
| 2395 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2396 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2397 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2398 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2399 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2400 | } |
| 2401 | #endif |
| 2402 | |
| 2403 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2404 | #ifdef WLAN_FEATURE_11AC |
| 2405 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2406 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2407 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2408 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2409 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2410 | } |
| 2411 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2412 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | |
| 2414 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2415 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2416 | { |
| 2417 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2418 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2419 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2420 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2421 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2422 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2423 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2424 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2425 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2426 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2427 | { |
| 2428 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2429 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2430 | } |
| 2431 | #endif |
| 2432 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2433 | #ifdef FEATURE_WLAN_ESE |
| 2434 | /* For ESE Associations fill the ESE IEs */ |
| 2435 | if (psessionEntry->isESEconnection && |
| 2436 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2437 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2438 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2439 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2440 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2441 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2442 | } |
| 2443 | #endif |
| 2444 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2445 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2446 | if ( DOT11F_FAILED( nStatus ) ) |
| 2447 | { |
| 2448 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2449 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | nStatus ); |
| 2451 | // We'll fall back on the worst case scenario: |
| 2452 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2453 | } |
| 2454 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2455 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2456 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2457 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2458 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2459 | } |
| 2460 | |
| 2461 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2462 | |
| 2463 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2464 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2465 | ( void** ) &pPacket ); |
| 2466 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2467 | { |
| 2468 | 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] | 2469 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2470 | |
| 2471 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2472 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2473 | |
| 2474 | |
| 2475 | /* Update PE session id*/ |
| 2476 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2477 | |
| 2478 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2479 | |
| 2480 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2481 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2482 | |
| 2483 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2484 | ( tANI_U32* ) &mlmAssocCnf); |
| 2485 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2486 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2487 | return; |
| 2488 | } |
| 2489 | |
| 2490 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2491 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2492 | |
| 2493 | // Next, we fill out the buffer descriptor: |
| 2494 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2495 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2496 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2497 | { |
| 2498 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2499 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2500 | nSirStatus ); |
| 2501 | 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] | 2502 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2503 | return; |
| 2504 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2505 | /* merge the ExtCap struct*/ |
| 2506 | if (extractedExtCapFlag) |
| 2507 | { |
| 2508 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 2509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2510 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2511 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2512 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2513 | sizeof(tSirMacMgmtHdr), |
| 2514 | nPayload, &nPayload ); |
| 2515 | if ( DOT11F_FAILED( nStatus ) ) |
| 2516 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2517 | 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] | 2518 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2519 | nStatus ); |
| 2520 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2521 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2522 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2523 | return; |
| 2524 | } |
| 2525 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2526 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2527 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2528 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2529 | } |
| 2530 | |
| 2531 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2532 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2533 | nBytes );) |
| 2534 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2535 | |
| 2536 | if( psessionEntry->assocReq != NULL ) |
| 2537 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2538 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2539 | psessionEntry->assocReq = NULL; |
| 2540 | } |
| 2541 | |
| 2542 | if( nAddIELen ) |
| 2543 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2544 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2545 | pAddIE, |
| 2546 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2547 | nPayload += nAddIELen; |
| 2548 | } |
| 2549 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2550 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2551 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2553 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2554 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2555 | } |
| 2556 | else |
| 2557 | { |
| 2558 | //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] | 2559 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2560 | psessionEntry->assocReqLen = nPayload; |
| 2561 | } |
| 2562 | |
| 2563 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2564 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2565 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2566 | ) |
| 2567 | { |
| 2568 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2569 | } |
| 2570 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2571 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2572 | { |
| 2573 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2574 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2575 | |
| 2576 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2577 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2578 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2579 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2580 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2581 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2582 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2583 | psessionEntry->peSessionId, |
| 2584 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2585 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2586 | HAL_TXRX_FRM_802_11_MGMT, |
| 2587 | ANI_TXDIR_TODS, |
| 2588 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2589 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2590 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2591 | psessionEntry->peSessionId, |
| 2592 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2593 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2594 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2595 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2596 | halstatus ); |
| 2597 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2598 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2599 | return; |
| 2600 | } |
| 2601 | |
| 2602 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2603 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2604 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2605 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2606 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2607 | } // End limSendAssocReqMgmtFrame |
| 2608 | |
| 2609 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2610 | #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] | 2611 | /*------------------------------------------------------------------------------------ |
| 2612 | * |
| 2613 | * Send Reassoc Req with FTIEs. |
| 2614 | * |
| 2615 | *----------------------------------------------------------------------------------- |
| 2616 | */ |
| 2617 | void |
| 2618 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2619 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2620 | { |
| 2621 | static tDot11fReAssocRequest frm; |
| 2622 | tANI_U16 caps; |
| 2623 | tANI_U8 *pFrame; |
| 2624 | tSirRetStatus nSirStatus; |
| 2625 | tANI_U32 nBytes, nPayload, nStatus; |
| 2626 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2627 | void *pPacket; |
| 2628 | eHalStatus halstatus; |
| 2629 | #if defined WLAN_FEATURE_VOWIFI |
| 2630 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2631 | #endif |
| 2632 | tANI_U16 ft_ies_length = 0; |
| 2633 | tANI_U8 *pBody; |
| 2634 | tANI_U16 nAddIELen; |
| 2635 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2636 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2637 | tANI_U8 *wpsIe = NULL; |
| 2638 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2639 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2640 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2641 | |
| 2642 | if (NULL == psessionEntry) |
| 2643 | { |
| 2644 | return; |
| 2645 | } |
| 2646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2647 | /* check this early to avoid unncessary operation */ |
| 2648 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2649 | { |
| 2650 | return; |
| 2651 | } |
| 2652 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2653 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2654 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2655 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2656 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2657 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2658 | |
| 2659 | caps = pMlmReassocReq->capabilityInfo; |
| 2660 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2661 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2662 | #if defined(FEATURE_WLAN_WAPI) |
| 2663 | /* CR: 262463 : |
| 2664 | According to WAPI standard: |
| 2665 | 7.3.1.4 Capability Information field |
| 2666 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2667 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2668 | Reassociation management frames. */ |
| 2669 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2670 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2671 | #endif |
| 2672 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2673 | |
| 2674 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2675 | |
| 2676 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2677 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2678 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2679 | |
| 2680 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2681 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2682 | &frm.SuppRates,psessionEntry); |
| 2683 | |
| 2684 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2685 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2686 | |
| 2687 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2688 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2689 | |
| 2690 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2691 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2692 | |
| 2693 | if ( psessionEntry->lim11hEnable && |
| 2694 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2695 | { |
| 2696 | #if defined WLAN_FEATURE_VOWIFI |
| 2697 | PowerCapsPopulated = TRUE; |
| 2698 | |
| 2699 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2700 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2701 | #endif |
| 2702 | } |
| 2703 | |
| 2704 | #if defined WLAN_FEATURE_VOWIFI |
| 2705 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2706 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2707 | { |
| 2708 | if (PowerCapsPopulated == FALSE) |
| 2709 | { |
| 2710 | PowerCapsPopulated = TRUE; |
| 2711 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2712 | } |
| 2713 | } |
| 2714 | #endif |
| 2715 | |
| 2716 | if ( fQosEnabled && |
| 2717 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2718 | { |
| 2719 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2720 | } |
| 2721 | |
| 2722 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2723 | &frm.ExtSuppRates, psessionEntry ); |
| 2724 | |
| 2725 | #if defined WLAN_FEATURE_VOWIFI |
| 2726 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2727 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2728 | { |
| 2729 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2730 | } |
| 2731 | #endif |
| 2732 | |
| 2733 | // Ideally this should be enabled for 11r also. But 11r does |
| 2734 | // not follow the usual norm of using the Opaque object |
| 2735 | // for rsnie and fties. Instead we just add |
| 2736 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2737 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2738 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2739 | // |
| 2740 | // The join request *should* contain zero or one of the WPA and RSN |
| 2741 | // IEs. The payload send along with the request is a |
| 2742 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2743 | |
| 2744 | // typedef struct sSirRSNie |
| 2745 | // { |
| 2746 | // tANI_U16 length; |
| 2747 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2748 | // } tSirRSNie, *tpSirRSNie; |
| 2749 | |
| 2750 | // So, we should be able to make the following two calls harmlessly, |
| 2751 | // since they do nothing if they don't find the given IE in the |
| 2752 | // bytestream with which they're provided. |
| 2753 | |
| 2754 | // The net effect of this will be to faithfully transmit whatever |
| 2755 | // security IE is in the join request. |
| 2756 | |
| 2757 | // *However*, if we're associating for the purpose of WPS |
| 2758 | // enrollment, and we've been configured to indicate that by |
| 2759 | // eliding the WPA or RSN IE, we just skip this: |
| 2760 | if (!psessionEntry->is11Rconnection) |
| 2761 | { |
| 2762 | if( nAddIELen && pAddIE ) |
| 2763 | { |
| 2764 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2765 | } |
| 2766 | if ( NULL == wpsIe ) |
| 2767 | { |
| 2768 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2769 | &frm.RSNOpaque ); |
| 2770 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2771 | &frm.WPAOpaque ); |
| 2772 | } |
| 2773 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2774 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2775 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2776 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2777 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2778 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2779 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2780 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2781 | } |
| 2782 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2783 | #ifdef FEATURE_WLAN_ESE |
| 2784 | // For ESE Associations fill the ESE IEs |
| 2785 | if (psessionEntry->isESEconnection && |
| 2786 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2787 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2788 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2789 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2790 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2791 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2792 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2793 | #endif //FEATURE_WLAN_ESE |
| 2794 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2795 | |
| 2796 | // include WME EDCA IE as well |
| 2797 | if ( fWmeEnabled ) |
| 2798 | { |
| 2799 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2800 | { |
| 2801 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2802 | } |
| 2803 | |
| 2804 | if ( fWsmEnabled && |
| 2805 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2806 | { |
| 2807 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2808 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2809 | #ifdef FEATURE_WLAN_ESE |
| 2810 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2811 | { |
| 2812 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2813 | |
| 2814 | // 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] | 2815 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2816 | { |
| 2817 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2818 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2819 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2820 | |
| 2821 | tsrsIE.tsid = 0; |
| 2822 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2823 | { |
| 2824 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2825 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2826 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2827 | { |
| 2828 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2829 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2830 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2831 | } |
| 2832 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2833 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2834 | } |
| 2835 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2836 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2837 | pMac->lim.htCapabilityPresentInBeacon) |
| 2838 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2839 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2840 | } |
| 2841 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2842 | #if defined WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2843 | 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] | 2844 | #if defined FEATURE_WLAN_ESE |
| 2845 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2846 | #endif |
| 2847 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2848 | { |
| 2849 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2850 | } |
| 2851 | #endif |
| 2852 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2853 | #ifdef WLAN_FEATURE_11AC |
| 2854 | if ( psessionEntry->vhtCapability && |
| 2855 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2856 | { |
| 2857 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
| 2858 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2859 | } |
| 2860 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2861 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2863 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2864 | if ( DOT11F_FAILED( nStatus ) ) |
| 2865 | { |
| 2866 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2867 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | nStatus ); |
| 2869 | // We'll fall back on the worst case scenario: |
| 2870 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2871 | } |
| 2872 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2873 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2874 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2875 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2876 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | } |
| 2878 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2879 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | |
| 2881 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2882 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2883 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2884 | #endif |
| 2885 | |
| 2886 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2887 | if (psessionEntry->is11Rconnection) |
| 2888 | { |
| 2889 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2890 | } |
| 2891 | #endif |
| 2892 | |
| 2893 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2894 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2895 | ( void** ) &pPacket ); |
| 2896 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2897 | { |
| 2898 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2899 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2900 | 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] | 2901 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2902 | goto end; |
| 2903 | } |
| 2904 | |
| 2905 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2906 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2907 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2908 | #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] | 2909 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2910 | #endif |
| 2911 | // Next, we fill out the buffer descriptor: |
| 2912 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2913 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2914 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2915 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2916 | { |
| 2917 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2918 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2919 | nSirStatus ); |
| 2920 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2921 | goto end; |
| 2922 | } |
| 2923 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2924 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2925 | // That done, pack the ReAssoc Request: |
| 2926 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2927 | sizeof(tSirMacMgmtHdr), |
| 2928 | nPayload, &nPayload ); |
| 2929 | if ( DOT11F_FAILED( nStatus ) ) |
| 2930 | { |
| 2931 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2932 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2933 | nStatus ); |
| 2934 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2935 | goto end; |
| 2936 | } |
| 2937 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2938 | { |
| 2939 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2940 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2941 | } |
| 2942 | |
| 2943 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2944 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2945 | nBytes, nPayload );) |
| 2946 | if( psessionEntry->assocReq != NULL ) |
| 2947 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2948 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2949 | psessionEntry->assocReq = NULL; |
| 2950 | } |
| 2951 | |
| 2952 | if( nAddIELen ) |
| 2953 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2954 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2955 | pAddIE, |
| 2956 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2957 | nPayload += nAddIELen; |
| 2958 | } |
| 2959 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2960 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2961 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2962 | { |
| 2963 | 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] | 2964 | } |
| 2965 | else |
| 2966 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2967 | //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] | 2968 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2969 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | |
| 2972 | if (psessionEntry->is11Rconnection) |
| 2973 | { |
| 2974 | { |
| 2975 | int i = 0; |
| 2976 | |
| 2977 | pBody = pFrame + nBytes; |
| 2978 | for (i=0; i<ft_ies_length; i++) |
| 2979 | { |
| 2980 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2981 | pBody++; |
| 2982 | } |
| 2983 | } |
| 2984 | } |
| 2985 | |
| 2986 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2987 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2988 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2989 | (tANI_U8 *)pFrame, |
| 2990 | (nBytes + ft_ies_length));) |
| 2991 | #endif |
| 2992 | |
| 2993 | |
| 2994 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2995 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2996 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2997 | ) |
| 2998 | { |
| 2999 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3000 | } |
| 3001 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3002 | if( NULL != psessionEntry->assocReq ) |
| 3003 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3004 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3005 | psessionEntry->assocReq = NULL; |
| 3006 | } |
| 3007 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3008 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3009 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3010 | { |
| 3011 | 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] | 3012 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3013 | } |
| 3014 | else |
| 3015 | { |
| 3016 | //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] | 3017 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3018 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3019 | psessionEntry->assocReqLen = (ft_ies_length); |
| 3020 | } |
| 3021 | |
| 3022 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3023 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3024 | psessionEntry->peSessionId, |
| 3025 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3027 | HAL_TXRX_FRM_802_11_MGMT, |
| 3028 | ANI_TXDIR_TODS, |
| 3029 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3030 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3031 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3032 | psessionEntry->peSessionId, |
| 3033 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3034 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3035 | { |
| 3036 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3037 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3038 | nSirStatus ); |
| 3039 | //Pkt will be freed up by the callback |
| 3040 | goto end; |
| 3041 | } |
| 3042 | |
| 3043 | end: |
| 3044 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3045 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3046 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3047 | |
| 3048 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3049 | |
| 3050 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3051 | tLimMlmReassocReq *pMlmReassocReq, |
| 3052 | tpPESession psessionEntry) |
| 3053 | { |
| 3054 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3055 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 3056 | if(NULL == pTmpMlmReassocReq) |
| 3057 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3058 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3059 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3060 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3061 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3062 | } |
| 3063 | |
| 3064 | // Prepare and send Reassociation request frame |
| 3065 | // start reassoc timer. |
| 3066 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3067 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3068 | 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] | 3069 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3070 | != TX_SUCCESS) |
| 3071 | { |
| 3072 | // Could not start reassoc failure timer. |
| 3073 | // Log error |
| 3074 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3075 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3076 | // Return Reassoc confirm with |
| 3077 | // Resources Unavailable |
| 3078 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3079 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3080 | goto end; |
| 3081 | } |
| 3082 | |
| 3083 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3084 | return; |
| 3085 | |
| 3086 | end: |
| 3087 | // Free up buffer allocated for reassocReq |
| 3088 | if (pMlmReassocReq != NULL) |
| 3089 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3090 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3091 | pMlmReassocReq = NULL; |
| 3092 | } |
| 3093 | if (pTmpMlmReassocReq != NULL) |
| 3094 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3095 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3096 | pTmpMlmReassocReq = NULL; |
| 3097 | } |
| 3098 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3099 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3100 | /* Update PE sessio Id*/ |
| 3101 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3102 | |
| 3103 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3104 | } |
| 3105 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3106 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3107 | |
| 3108 | |
| 3109 | void |
| 3110 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3111 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3112 | { |
| 3113 | static tDot11fReAssocRequest frm; |
| 3114 | tANI_U16 caps; |
| 3115 | tANI_U8 *pFrame; |
| 3116 | tSirRetStatus nSirStatus; |
| 3117 | tANI_U32 nBytes, nPayload, nStatus; |
| 3118 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3119 | void *pPacket; |
| 3120 | eHalStatus halstatus; |
| 3121 | tANI_U16 nAddIELen; |
| 3122 | tANI_U8 *pAddIE; |
| 3123 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3124 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3125 | #if defined WLAN_FEATURE_VOWIFI |
| 3126 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3127 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3128 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3129 | |
| 3130 | if(NULL == psessionEntry) |
| 3131 | { |
| 3132 | return; |
| 3133 | } |
| 3134 | |
| 3135 | /* check this early to avoid unncessary operation */ |
| 3136 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3137 | { |
| 3138 | return; |
| 3139 | } |
| 3140 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3141 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3142 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3143 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3144 | |
| 3145 | caps = pMlmReassocReq->capabilityInfo; |
| 3146 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3147 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3148 | #if defined(FEATURE_WLAN_WAPI) |
| 3149 | /* CR: 262463 : |
| 3150 | According to WAPI standard: |
| 3151 | 7.3.1.4 Capability Information field |
| 3152 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3153 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3154 | Reassociation management frames. */ |
| 3155 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3156 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3157 | #endif |
| 3158 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3159 | |
| 3160 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3161 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3162 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3163 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3164 | |
| 3165 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3166 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3167 | &frm.SuppRates,psessionEntry); |
| 3168 | |
| 3169 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3170 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3171 | |
| 3172 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3173 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3174 | |
| 3175 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3176 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3177 | |
| 3178 | |
| 3179 | if ( psessionEntry->lim11hEnable && |
| 3180 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3181 | { |
| 3182 | #if defined WLAN_FEATURE_VOWIFI |
| 3183 | PowerCapsPopulated = TRUE; |
| 3184 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3185 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3186 | #endif |
| 3187 | } |
| 3188 | |
| 3189 | #if defined WLAN_FEATURE_VOWIFI |
| 3190 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3191 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3192 | { |
| 3193 | if (PowerCapsPopulated == FALSE) |
| 3194 | { |
| 3195 | PowerCapsPopulated = TRUE; |
| 3196 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3197 | } |
| 3198 | } |
| 3199 | #endif |
| 3200 | |
| 3201 | if ( fQosEnabled && |
| 3202 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3203 | { |
| 3204 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3205 | } |
| 3206 | |
| 3207 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3208 | &frm.ExtSuppRates, psessionEntry ); |
| 3209 | |
| 3210 | #if defined WLAN_FEATURE_VOWIFI |
| 3211 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3212 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3213 | { |
| 3214 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3215 | } |
| 3216 | #endif |
| 3217 | // The join request *should* contain zero or one of the WPA and RSN |
| 3218 | // IEs. The payload send along with the request is a |
| 3219 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3220 | |
| 3221 | // typedef struct sSirRSNie |
| 3222 | // { |
| 3223 | // tANI_U16 length; |
| 3224 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3225 | // } tSirRSNie, *tpSirRSNie; |
| 3226 | |
| 3227 | // So, we should be able to make the following two calls harmlessly, |
| 3228 | // since they do nothing if they don't find the given IE in the |
| 3229 | // bytestream with which they're provided. |
| 3230 | |
| 3231 | // The net effect of this will be to faithfully transmit whatever |
| 3232 | // security IE is in the join request. |
| 3233 | |
| 3234 | // *However*, if we're associating for the purpose of WPS |
| 3235 | // enrollment, and we've been configured to indicate that by |
| 3236 | // eliding the WPA or RSN IE, we just skip this: |
| 3237 | if( nAddIELen && pAddIE ) |
| 3238 | { |
| 3239 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3240 | } |
| 3241 | if ( NULL == wpsIe ) |
| 3242 | { |
| 3243 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3244 | &frm.RSNOpaque ); |
| 3245 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3246 | &frm.WPAOpaque ); |
| 3247 | #if defined(FEATURE_WLAN_WAPI) |
| 3248 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3249 | &frm.WAPIOpaque ); |
| 3250 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3251 | } |
| 3252 | |
| 3253 | // include WME EDCA IE as well |
| 3254 | if ( fWmeEnabled ) |
| 3255 | { |
| 3256 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3257 | { |
| 3258 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3259 | } |
| 3260 | |
| 3261 | if ( fWsmEnabled && |
| 3262 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3263 | { |
| 3264 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3265 | } |
| 3266 | } |
| 3267 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3268 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3269 | pMac->lim.htCapabilityPresentInBeacon) |
| 3270 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3271 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3272 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3273 | #ifdef WLAN_FEATURE_11AC |
| 3274 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3275 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3276 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3277 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3278 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3279 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3280 | } |
| 3281 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3282 | |
| 3283 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3284 | if ( DOT11F_FAILED( nStatus ) ) |
| 3285 | { |
| 3286 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3287 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | nStatus ); |
| 3289 | // We'll fall back on the worst case scenario: |
| 3290 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3291 | } |
| 3292 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3293 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3294 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3295 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3296 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3297 | } |
| 3298 | |
| 3299 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3300 | |
| 3301 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3302 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3303 | ( void** ) &pPacket ); |
| 3304 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3305 | { |
| 3306 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3307 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3308 | 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] | 3309 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3310 | goto end; |
| 3311 | } |
| 3312 | |
| 3313 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3314 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3315 | |
| 3316 | // Next, we fill out the buffer descriptor: |
| 3317 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3318 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3319 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3320 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3321 | { |
| 3322 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3323 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3324 | nSirStatus ); |
| 3325 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3326 | goto end; |
| 3327 | } |
| 3328 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3329 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3330 | // That done, pack the Probe Request: |
| 3331 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3332 | sizeof(tSirMacMgmtHdr), |
| 3333 | nPayload, &nPayload ); |
| 3334 | if ( DOT11F_FAILED( nStatus ) ) |
| 3335 | { |
| 3336 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3337 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3338 | nStatus ); |
| 3339 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3340 | goto end; |
| 3341 | } |
| 3342 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3343 | { |
| 3344 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3345 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3346 | } |
| 3347 | |
| 3348 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3349 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3350 | nBytes );) |
| 3351 | |
| 3352 | if( psessionEntry->assocReq != NULL ) |
| 3353 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3354 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3355 | psessionEntry->assocReq = NULL; |
| 3356 | } |
| 3357 | |
| 3358 | if( nAddIELen ) |
| 3359 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3360 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3361 | pAddIE, |
| 3362 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3363 | nPayload += nAddIELen; |
| 3364 | } |
| 3365 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3366 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3367 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3368 | { |
| 3369 | 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] | 3370 | } |
| 3371 | else |
| 3372 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3373 | //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] | 3374 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3375 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3376 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3377 | |
| 3378 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3379 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3380 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3381 | ) |
| 3382 | { |
| 3383 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3384 | } |
| 3385 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3386 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3387 | { |
| 3388 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3389 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3390 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3391 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3392 | psessionEntry->peSessionId, |
| 3393 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3394 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3395 | HAL_TXRX_FRM_802_11_MGMT, |
| 3396 | ANI_TXDIR_TODS, |
| 3397 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3398 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3399 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3400 | psessionEntry->peSessionId, |
| 3401 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3402 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3403 | { |
| 3404 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3405 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3406 | nSirStatus ); |
| 3407 | //Pkt will be freed up by the callback |
| 3408 | goto end; |
| 3409 | } |
| 3410 | |
| 3411 | end: |
| 3412 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3413 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3414 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3415 | |
| 3416 | } // limSendReassocReqMgmtFrame |
| 3417 | |
| 3418 | /** |
| 3419 | * \brief Send an Authentication frame |
| 3420 | * |
| 3421 | * |
| 3422 | * \param pMac Pointer to Global MAC structure |
| 3423 | * |
| 3424 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3425 | * to be sent |
| 3426 | * |
| 3427 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3428 | * frame is destined |
| 3429 | * |
| 3430 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3431 | * Authentication frame3 |
| 3432 | * |
| 3433 | * |
| 3434 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3435 | * is formatted and sent when this function is called. |
| 3436 | * |
| 3437 | * |
| 3438 | */ |
| 3439 | |
| 3440 | void |
| 3441 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3442 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3443 | tSirMacAddr peerMacAddr, |
| 3444 | tANI_U8 wepBit, |
| 3445 | tpPESession psessionEntry |
| 3446 | ) |
| 3447 | { |
| 3448 | tANI_U8 *pFrame, *pBody; |
| 3449 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3450 | tpSirMacMgmtHdr pMacHdr; |
| 3451 | tANI_U16 i; |
| 3452 | void *pPacket; |
| 3453 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3454 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3455 | |
| 3456 | if(NULL == psessionEntry) |
| 3457 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3458 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3459 | return; |
| 3460 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3461 | |
| 3462 | limLog(pMac, LOG1, |
| 3463 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3464 | pAuthFrameBody->authTransactionSeqNumber, |
| 3465 | pAuthFrameBody->authStatusCode, |
| 3466 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3467 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3468 | if (wepBit == LIM_WEP_IN_FC) |
| 3469 | { |
| 3470 | /// Auth frame3 to be sent with encrypted framebody |
| 3471 | /** |
| 3472 | * Allocate buffer for Authenticaton frame of size equal |
| 3473 | * to management frame header length plus 2 bytes each for |
| 3474 | * auth algorithm number, transaction number, status code, |
| 3475 | * 128 bytes for challenge text and 4 bytes each for |
| 3476 | * IV & ICV. |
| 3477 | */ |
| 3478 | |
| 3479 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3480 | |
| 3481 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3482 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3483 | else |
| 3484 | { |
| 3485 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3486 | { |
| 3487 | case SIR_MAC_AUTH_FRAME_1: |
| 3488 | /** |
| 3489 | * Allocate buffer for Authenticaton frame of size |
| 3490 | * equal to management frame header length plus 2 bytes |
| 3491 | * each for auth algorithm number, transaction number |
| 3492 | * and status code. |
| 3493 | */ |
| 3494 | |
| 3495 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3496 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3497 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3498 | |
| 3499 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3500 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3501 | { |
| 3502 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3503 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3504 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3505 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3506 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3507 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3508 | else |
| 3509 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3510 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3511 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3512 | frameLen += (2+SIR_MDIE_SIZE); |
| 3513 | } |
| 3514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3515 | #endif |
| 3516 | break; |
| 3517 | |
| 3518 | case SIR_MAC_AUTH_FRAME_2: |
| 3519 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3520 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3521 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3522 | { |
| 3523 | /** |
| 3524 | * Allocate buffer for Authenticaton frame of size |
| 3525 | * equal to management frame header length plus |
| 3526 | * 2 bytes each for auth algorithm number, |
| 3527 | * transaction number and status code. |
| 3528 | */ |
| 3529 | |
| 3530 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3531 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3532 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3533 | } |
| 3534 | else |
| 3535 | { |
| 3536 | // Shared Key algorithm with challenge text |
| 3537 | // to be sent |
| 3538 | /** |
| 3539 | * Allocate buffer for Authenticaton frame of size |
| 3540 | * equal to management frame header length plus |
| 3541 | * 2 bytes each for auth algorithm number, |
| 3542 | * transaction number, status code and 128 bytes |
| 3543 | * for challenge text. |
| 3544 | */ |
| 3545 | |
| 3546 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3547 | sizeof(tSirMacAuthFrame); |
| 3548 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3549 | } |
| 3550 | |
| 3551 | break; |
| 3552 | |
| 3553 | case SIR_MAC_AUTH_FRAME_3: |
| 3554 | /// Auth frame3 to be sent without encrypted framebody |
| 3555 | /** |
| 3556 | * Allocate buffer for Authenticaton frame of size equal |
| 3557 | * to management frame header length plus 2 bytes each |
| 3558 | * for auth algorithm number, transaction number and |
| 3559 | * status code. |
| 3560 | */ |
| 3561 | |
| 3562 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3563 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3564 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3565 | |
| 3566 | break; |
| 3567 | |
| 3568 | case SIR_MAC_AUTH_FRAME_4: |
| 3569 | /** |
| 3570 | * Allocate buffer for Authenticaton frame of size equal |
| 3571 | * to management frame header length plus 2 bytes each |
| 3572 | * for auth algorithm number, transaction number and |
| 3573 | * status code. |
| 3574 | */ |
| 3575 | |
| 3576 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3577 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3578 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3579 | |
| 3580 | break; |
| 3581 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3582 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3583 | |
| 3584 | |
| 3585 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3586 | |
| 3587 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3588 | { |
| 3589 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3590 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3591 | |
| 3592 | return; |
| 3593 | } |
| 3594 | |
| 3595 | for (i = 0; i < frameLen; i++) |
| 3596 | pFrame[i] = 0; |
| 3597 | |
| 3598 | // Prepare BD |
| 3599 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3600 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3601 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3602 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3603 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3604 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3605 | return; |
| 3606 | } |
| 3607 | |
| 3608 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3609 | pMacHdr->fc.wep = wepBit; |
| 3610 | |
| 3611 | // Prepare BSSId |
| 3612 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3613 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3614 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3615 | (tANI_U8 *) psessionEntry->bssId, |
| 3616 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3617 | } |
| 3618 | |
| 3619 | /// Prepare Authentication frame body |
| 3620 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3621 | |
| 3622 | if (wepBit == LIM_WEP_IN_FC) |
| 3623 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3624 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3625 | |
| 3626 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3627 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3628 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3629 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3630 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3632 | } |
| 3633 | else |
| 3634 | { |
| 3635 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3636 | pBody += sizeof(tANI_U16); |
| 3637 | bodyLen -= sizeof(tANI_U16); |
| 3638 | |
| 3639 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3640 | pBody += sizeof(tANI_U16); |
| 3641 | bodyLen -= sizeof(tANI_U16); |
| 3642 | |
| 3643 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3644 | pBody += sizeof(tANI_U16); |
| 3645 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3646 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3647 | sizeof (pAuthFrameBody->length) + |
| 3648 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3649 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | |
| 3651 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3652 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3653 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3654 | { |
| 3655 | |
| 3656 | { |
| 3657 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3658 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3659 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3660 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3661 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3662 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3663 | (tANI_U8 *)pBody, |
| 3664 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3666 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3667 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3668 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3669 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3670 | } |
| 3671 | } |
| 3672 | else |
| 3673 | { |
| 3674 | /* MDID attr is 54*/ |
| 3675 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3676 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3677 | *pBody = SIR_MDIE_SIZE; |
| 3678 | pBody++; |
| 3679 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3680 | { |
| 3681 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3682 | pBody++; |
| 3683 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3684 | } |
| 3685 | } |
| 3686 | } |
| 3687 | #endif |
| 3688 | |
| 3689 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3690 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3691 | pAuthFrameBody->authTransactionSeqNumber, |
| 3692 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3693 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3694 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3695 | } |
| 3696 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3697 | |
| 3698 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3699 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3700 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3701 | #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] | 3702 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3703 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3704 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3705 | ) |
| 3706 | { |
| 3707 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3708 | } |
| 3709 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3710 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3711 | { |
| 3712 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3713 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3714 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 3715 | limLog( pMac, LOG1, FL("Sending Auth Frame over WQ5 to "MAC_ADDRESS_STR |
| 3716 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 3717 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3718 | |
| 3719 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3720 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3721 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3722 | psessionEntry->peSessionId, |
| 3723 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3724 | /// Queue Authentication frame in high priority WQ |
| 3725 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3726 | HAL_TXRX_FRM_802_11_MGMT, |
| 3727 | ANI_TXDIR_TODS, |
| 3728 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3729 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3730 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3731 | psessionEntry->peSessionId, |
| 3732 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3733 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3734 | { |
| 3735 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3736 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3737 | halstatus); |
| 3738 | |
| 3739 | //Pkt will be freed up by the callback |
| 3740 | } |
| 3741 | |
| 3742 | return; |
| 3743 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3744 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3745 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3746 | { |
| 3747 | tANI_U16 aid; |
| 3748 | tpDphHashNode pStaDs; |
| 3749 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3750 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3751 | tpPESession psessionEntry; |
| 3752 | |
| 3753 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3754 | if (pMlmDeauthReq) |
| 3755 | { |
| 3756 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3757 | { |
| 3758 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3759 | } |
| 3760 | |
| 3761 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3762 | { |
| 3763 | |
| 3764 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3765 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3766 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3767 | goto end; |
| 3768 | } |
| 3769 | |
| 3770 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3771 | if (pStaDs == NULL) |
| 3772 | { |
| 3773 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3774 | goto end; |
| 3775 | } |
| 3776 | |
| 3777 | |
| 3778 | /// Receive path cleanup with dummy packet |
| 3779 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame^] | 3780 | |
| 3781 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3782 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
| 3783 | ( |
| 3784 | #ifdef FEATURE_WLAN_ESE |
| 3785 | (psessionEntry->isESEconnection ) || |
| 3786 | #endif |
| 3787 | #ifdef FEATURE_WLAN_LFR |
| 3788 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
| 3789 | #endif |
| 3790 | (psessionEntry->is11Rconnection ))) |
| 3791 | { |
| 3792 | PELOGE(limLog(pMac, LOGE, |
| 3793 | FL("FT Preauth Session (%p,%d) Cleanup" |
| 3794 | " Deauth reason %d Trigger = %d"), |
| 3795 | psessionEntry, psessionEntry->peSessionId, |
| 3796 | pMlmDeauthReq->reasonCode, |
| 3797 | pMlmDeauthReq->deauthTrigger);); |
| 3798 | limFTCleanup(pMac); |
| 3799 | } |
| 3800 | else |
| 3801 | { |
| 3802 | PELOGE(limLog(pMac, LOGE, |
| 3803 | FL("No FT Preauth Session Cleanup in role %d" |
| 3804 | #ifdef FEATURE_WLAN_ESE |
| 3805 | " isESE %d" |
| 3806 | #endif |
| 3807 | #ifdef FEATURE_WLAN_LFR |
| 3808 | " isLFR %d" |
| 3809 | #endif |
| 3810 | " is11r %d, Deauth reason %d Trigger = %d"), |
| 3811 | psessionEntry->limSystemRole, |
| 3812 | #ifdef FEATURE_WLAN_ESE |
| 3813 | psessionEntry->isESEconnection, |
| 3814 | #endif |
| 3815 | #ifdef FEATURE_WLAN_LFR |
| 3816 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3817 | #endif |
| 3818 | psessionEntry->is11Rconnection, |
| 3819 | pMlmDeauthReq->reasonCode, |
| 3820 | pMlmDeauthReq->deauthTrigger);); |
| 3821 | } |
| 3822 | #endif |
| 3823 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3824 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3825 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3826 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3827 | } |
| 3828 | return eHAL_STATUS_SUCCESS; |
| 3829 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3830 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3831 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3832 | sizeof(tSirMacAddr)); |
| 3833 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3834 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3835 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3836 | |
| 3837 | // Free up buffer allocated |
| 3838 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3839 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3840 | |
| 3841 | limPostSmeMessage(pMac, |
| 3842 | LIM_MLM_DEAUTH_CNF, |
| 3843 | (tANI_U32 *) &mlmDeauthCnf); |
| 3844 | return eHAL_STATUS_SUCCESS; |
| 3845 | } |
| 3846 | |
| 3847 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3848 | { |
| 3849 | tANI_U16 aid; |
| 3850 | tpDphHashNode pStaDs; |
| 3851 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3852 | tpPESession psessionEntry; |
| 3853 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3854 | |
| 3855 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3856 | if (pMlmDisassocReq) |
| 3857 | { |
| 3858 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3859 | { |
| 3860 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3861 | } |
| 3862 | |
| 3863 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3864 | { |
| 3865 | |
| 3866 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3867 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3868 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3869 | goto end; |
| 3870 | } |
| 3871 | |
| 3872 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3873 | if (pStaDs == NULL) |
| 3874 | { |
| 3875 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3876 | goto end; |
| 3877 | } |
| 3878 | |
| 3879 | /// Receive path cleanup with dummy packet |
| 3880 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3881 | { |
| 3882 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3883 | goto end; |
| 3884 | } |
| 3885 | |
| 3886 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3887 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3888 | ( |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3889 | #ifdef FEATURE_WLAN_ESE |
| 3890 | (psessionEntry->isESEconnection ) || |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3891 | #endif |
| 3892 | #ifdef FEATURE_WLAN_LFR |
| 3893 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3894 | #endif |
| 3895 | (psessionEntry->is11Rconnection )) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3896 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3897 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3898 | { |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3899 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3900 | FL("FT Preauth Session (%p,%d) Cleanup"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3901 | psessionEntry, psessionEntry->peSessionId);); |
| 3902 | limFTCleanup(pMac); |
| 3903 | } |
| 3904 | else |
| 3905 | { |
| 3906 | PELOGE(limLog(pMac, LOGE, |
| 3907 | FL("No FT Preauth Session Cleanup in role %d" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3908 | #ifdef FEATURE_WLAN_ESE |
| 3909 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3910 | #endif |
| 3911 | #ifdef FEATURE_WLAN_LFR |
| 3912 | " isLFR %d" |
| 3913 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3914 | " is11r %d reason %d"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3915 | psessionEntry->limSystemRole, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3916 | #ifdef FEATURE_WLAN_ESE |
| 3917 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3918 | #endif |
| 3919 | #ifdef FEATURE_WLAN_LFR |
| 3920 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3921 | #endif |
| 3922 | psessionEntry->is11Rconnection, |
| 3923 | pMlmDisassocReq->reasonCode);); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3924 | } |
| 3925 | #endif |
| 3926 | |
| 3927 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3928 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3929 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3930 | return eHAL_STATUS_SUCCESS; |
| 3931 | } |
| 3932 | else |
| 3933 | { |
| 3934 | return eHAL_STATUS_SUCCESS; |
| 3935 | } |
| 3936 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3937 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3938 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3939 | sizeof(tSirMacAddr)); |
| 3940 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3941 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3942 | |
| 3943 | /* Update PE session ID*/ |
| 3944 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3945 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3946 | if(pMlmDisassocReq != NULL) |
| 3947 | { |
| 3948 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3949 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3950 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3951 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3952 | |
| 3953 | limPostSmeMessage(pMac, |
| 3954 | LIM_MLM_DISASSOC_CNF, |
| 3955 | (tANI_U32 *) &mlmDisassocCnf); |
| 3956 | return eHAL_STATUS_SUCCESS; |
| 3957 | } |
| 3958 | |
| 3959 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3960 | { |
| 3961 | return limSendDisassocCnf(pMac); |
| 3962 | } |
| 3963 | |
| 3964 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3965 | { |
| 3966 | return limSendDeauthCnf(pMac); |
| 3967 | } |
| 3968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3969 | /** |
| 3970 | * \brief This function is called to send Disassociate frame. |
| 3971 | * |
| 3972 | * |
| 3973 | * \param pMac Pointer to Global MAC structure |
| 3974 | * |
| 3975 | * \param nReason Indicates the reason that need to be sent in |
| 3976 | * Disassociation frame |
| 3977 | * |
| 3978 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3979 | * sent |
| 3980 | * |
| 3981 | * |
| 3982 | */ |
| 3983 | |
| 3984 | void |
| 3985 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3986 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3987 | tSirMacAddr peer, |
| 3988 | tpPESession psessionEntry, |
| 3989 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3990 | { |
| 3991 | tDot11fDisassociation frm; |
| 3992 | tANI_U8 *pFrame; |
| 3993 | tSirRetStatus nSirStatus; |
| 3994 | tpSirMacMgmtHdr pMacHdr; |
| 3995 | tANI_U32 nBytes, nPayload, nStatus; |
| 3996 | void *pPacket; |
| 3997 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3998 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3999 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4000 | if(NULL == psessionEntry) |
| 4001 | { |
| 4002 | return; |
| 4003 | } |
| 4004 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4005 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4006 | |
| 4007 | frm.Reason.code = nReason; |
| 4008 | |
| 4009 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 4010 | if ( DOT11F_FAILED( nStatus ) ) |
| 4011 | { |
| 4012 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4013 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4014 | nStatus ); |
| 4015 | // We'll fall back on the worst case scenario: |
| 4016 | nPayload = sizeof( tDot11fDisassociation ); |
| 4017 | } |
| 4018 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4019 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4020 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4021 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4022 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4023 | } |
| 4024 | |
| 4025 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4026 | |
| 4027 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4028 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4029 | ( void** ) &pPacket ); |
| 4030 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4031 | { |
| 4032 | 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] | 4033 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4034 | return; |
| 4035 | } |
| 4036 | |
| 4037 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4038 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | |
| 4040 | // Next, we fill out the buffer descriptor: |
| 4041 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4042 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4043 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4044 | { |
| 4045 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4046 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4047 | nSirStatus ); |
| 4048 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4049 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4050 | return; // just allocated... |
| 4051 | } |
| 4052 | |
| 4053 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4054 | |
| 4055 | // Prepare the BSSID |
| 4056 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4057 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4058 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4059 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4060 | #endif |
| 4061 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4063 | sizeof(tSirMacMgmtHdr), |
| 4064 | nPayload, &nPayload ); |
| 4065 | if ( DOT11F_FAILED( nStatus ) ) |
| 4066 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4067 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | nStatus ); |
| 4069 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4070 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4071 | return; // allocated! |
| 4072 | } |
| 4073 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4074 | { |
| 4075 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4076 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4077 | } |
| 4078 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4079 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4080 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4081 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4082 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4083 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4084 | |
| 4085 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4086 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4087 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4088 | ) |
| 4089 | { |
| 4090 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4091 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4092 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4093 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4094 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4095 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4096 | { |
| 4097 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4098 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4099 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4100 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4101 | { |
| 4102 | /* This frame will be sent on air by firmware, |
| 4103 | which will ensure that this frame goes out |
| 4104 | even though DEL_STA is sent immediately */ |
| 4105 | /* Without this for DEL_STA command there is |
| 4106 | risk of flushing frame in BTQM queue without |
| 4107 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4108 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4109 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4110 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4111 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4112 | } |
| 4113 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4114 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4115 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4116 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4117 | psessionEntry->peSessionId, |
| 4118 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4119 | // Queue Disassociation frame in high priority WQ |
| 4120 | /* get the duration from the request */ |
| 4121 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4122 | HAL_TXRX_FRM_802_11_MGMT, |
| 4123 | ANI_TXDIR_TODS, |
| 4124 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4125 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 4126 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4127 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4128 | psessionEntry->peSessionId, |
| 4129 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4130 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4131 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4132 | if (tx_timer_change( |
| 4133 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4134 | != TX_SUCCESS) |
| 4135 | { |
| 4136 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4137 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4138 | return; |
| 4139 | } |
| 4140 | else if(TX_SUCCESS != tx_timer_activate( |
| 4141 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4142 | { |
| 4143 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4144 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4145 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4146 | return; |
| 4147 | } |
| 4148 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4149 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4150 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4151 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4152 | psessionEntry->peSessionId, |
| 4153 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4154 | // Queue Disassociation frame in high priority WQ |
| 4155 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4156 | HAL_TXRX_FRM_802_11_MGMT, |
| 4157 | ANI_TXDIR_TODS, |
| 4158 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4159 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4160 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4161 | psessionEntry->peSessionId, |
| 4162 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4163 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4164 | { |
| 4165 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4166 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4167 | nSirStatus ); |
| 4168 | //Pkt will be freed up by the callback |
| 4169 | return; |
| 4170 | } |
| 4171 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4172 | } // End limSendDisassocMgmtFrame. |
| 4173 | |
| 4174 | /** |
| 4175 | * \brief This function is called to send a Deauthenticate frame |
| 4176 | * |
| 4177 | * |
| 4178 | * \param pMac Pointer to global MAC structure |
| 4179 | * |
| 4180 | * \param nReason Indicates the reason that need to be sent in the |
| 4181 | * Deauthenticate frame |
| 4182 | * |
| 4183 | * \param peeer address of the STA to which the frame is to be sent |
| 4184 | * |
| 4185 | * |
| 4186 | */ |
| 4187 | |
| 4188 | void |
| 4189 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4190 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4191 | tSirMacAddr peer, |
| 4192 | tpPESession psessionEntry, |
| 4193 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4194 | { |
| 4195 | tDot11fDeAuth frm; |
| 4196 | tANI_U8 *pFrame; |
| 4197 | tSirRetStatus nSirStatus; |
| 4198 | tpSirMacMgmtHdr pMacHdr; |
| 4199 | tANI_U32 nBytes, nPayload, nStatus; |
| 4200 | void *pPacket; |
| 4201 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4202 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4203 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4204 | #ifdef FEATURE_WLAN_TDLS |
| 4205 | tANI_U16 aid; |
| 4206 | tpDphHashNode pStaDs; |
| 4207 | #endif |
| 4208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4209 | if(NULL == psessionEntry) |
| 4210 | { |
| 4211 | return; |
| 4212 | } |
| 4213 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4214 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4215 | |
| 4216 | frm.Reason.code = nReason; |
| 4217 | |
| 4218 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4219 | if ( DOT11F_FAILED( nStatus ) ) |
| 4220 | { |
| 4221 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4222 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4223 | nStatus ); |
| 4224 | // We'll fall back on the worst case scenario: |
| 4225 | nPayload = sizeof( tDot11fDeAuth ); |
| 4226 | } |
| 4227 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4228 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4229 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4230 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4231 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4232 | } |
| 4233 | |
| 4234 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4235 | |
| 4236 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4237 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4238 | ( void** ) &pPacket ); |
| 4239 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4240 | { |
| 4241 | 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] | 4242 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4243 | return; |
| 4244 | } |
| 4245 | |
| 4246 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4247 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4248 | |
| 4249 | // Next, we fill out the buffer descriptor: |
| 4250 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4251 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4252 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4253 | { |
| 4254 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4255 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4256 | nSirStatus ); |
| 4257 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4258 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4259 | return; // just allocated... |
| 4260 | } |
| 4261 | |
| 4262 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4263 | |
| 4264 | // Prepare the BSSID |
| 4265 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4266 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4267 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4268 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4269 | #endif |
| 4270 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4271 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4272 | sizeof(tSirMacMgmtHdr), |
| 4273 | nPayload, &nPayload ); |
| 4274 | if ( DOT11F_FAILED( nStatus ) ) |
| 4275 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4276 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4277 | nStatus ); |
| 4278 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4279 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4280 | return; |
| 4281 | } |
| 4282 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4283 | { |
| 4284 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4285 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4286 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4287 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4288 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4289 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4290 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4291 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4292 | |
| 4293 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4294 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4295 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4296 | ) |
| 4297 | { |
| 4298 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4299 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4300 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4301 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4302 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4303 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4304 | { |
| 4305 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4306 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4307 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4308 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4309 | { |
| 4310 | /* This frame will be sent on air by firmware, |
| 4311 | which will ensure that this frame goes out |
| 4312 | even though DEL_STA is sent immediately */ |
| 4313 | /* Without this for DEL_STA command there is |
| 4314 | risk of flushing frame in BTQM queue without |
| 4315 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4316 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4317 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4318 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4319 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4320 | } |
| 4321 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4322 | #ifdef FEATURE_WLAN_TDLS |
| 4323 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4324 | #endif |
| 4325 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4326 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4327 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4328 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4329 | psessionEntry->peSessionId, |
| 4330 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4331 | // Queue Disassociation frame in high priority WQ |
| 4332 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4333 | HAL_TXRX_FRM_802_11_MGMT, |
| 4334 | ANI_TXDIR_TODS, |
| 4335 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4336 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4337 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4338 | psessionEntry->peSessionId, |
| 4339 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4340 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4341 | { |
| 4342 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4343 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4344 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4345 | //Pkt will be freed up by the callback limTxComplete |
| 4346 | |
| 4347 | /*Call limProcessDeauthAckTimeout which will send |
| 4348 | * DeauthCnf for this frame |
| 4349 | */ |
| 4350 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4351 | return; |
| 4352 | } |
| 4353 | |
| 4354 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4355 | |
| 4356 | if (tx_timer_change( |
| 4357 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4358 | != TX_SUCCESS) |
| 4359 | { |
| 4360 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4361 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4362 | return; |
| 4363 | } |
| 4364 | else if(TX_SUCCESS != tx_timer_activate( |
| 4365 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4366 | { |
| 4367 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4368 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4369 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4370 | return; |
| 4371 | } |
| 4372 | } |
| 4373 | else |
| 4374 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4375 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4376 | psessionEntry->peSessionId, |
| 4377 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4378 | #ifdef FEATURE_WLAN_TDLS |
| 4379 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4380 | { |
| 4381 | // Queue Disassociation frame in high priority WQ |
| 4382 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4383 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4384 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4385 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4386 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4387 | } |
| 4388 | else |
| 4389 | { |
| 4390 | #endif |
| 4391 | // Queue Disassociation frame in high priority WQ |
| 4392 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4393 | HAL_TXRX_FRM_802_11_MGMT, |
| 4394 | ANI_TXDIR_TODS, |
| 4395 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4396 | limTxComplete, pFrame, txFlag ); |
| 4397 | #ifdef FEATURE_WLAN_TDLS |
| 4398 | } |
| 4399 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4400 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4401 | psessionEntry->peSessionId, |
| 4402 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4403 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4404 | { |
| 4405 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4406 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4407 | nSirStatus ); |
| 4408 | //Pkt will be freed up by the callback |
| 4409 | return; |
| 4410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4411 | } |
| 4412 | |
| 4413 | } // End limSendDeauthMgmtFrame. |
| 4414 | |
| 4415 | |
| 4416 | #ifdef ANI_SUPPORT_11H |
| 4417 | /** |
| 4418 | * \brief Send a Measurement Report Action frame |
| 4419 | * |
| 4420 | * |
| 4421 | * \param pMac Pointer to the global MAC structure |
| 4422 | * |
| 4423 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4424 | * |
| 4425 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4426 | * |
| 4427 | * |
| 4428 | */ |
| 4429 | |
| 4430 | tSirRetStatus |
| 4431 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4432 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4433 | tSirMacAddr peer) |
| 4434 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4435 | tDot11fMeasurementReport frm; |
| 4436 | tANI_U8 *pFrame; |
| 4437 | tSirRetStatus nSirStatus; |
| 4438 | tpSirMacMgmtHdr pMacHdr; |
| 4439 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4440 | void *pPacket; |
| 4441 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4442 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4443 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4444 | |
| 4445 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4446 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4447 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4448 | |
| 4449 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4450 | { |
| 4451 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4452 | nSirStatus = |
| 4453 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4454 | &frm.MeasurementReport ); |
| 4455 | break; |
| 4456 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4457 | nSirStatus = |
| 4458 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4459 | &frm.MeasurementReport ); |
| 4460 | break; |
| 4461 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4462 | nSirStatus = |
| 4463 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4464 | &frm.MeasurementReport ); |
| 4465 | break; |
| 4466 | default: |
| 4467 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4468 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4469 | pMeasReqFrame->measReqIE.measType ); |
| 4470 | return eSIR_FAILURE; |
| 4471 | } |
| 4472 | |
| 4473 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4474 | |
| 4475 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4476 | if ( DOT11F_FAILED( nStatus ) ) |
| 4477 | { |
| 4478 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4479 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | nStatus ); |
| 4481 | // We'll fall back on the worst case scenario: |
| 4482 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4483 | } |
| 4484 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4485 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4486 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4487 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4488 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4489 | } |
| 4490 | |
| 4491 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4492 | |
| 4493 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4494 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4495 | { |
| 4496 | 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] | 4497 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4498 | return eSIR_FAILURE; |
| 4499 | } |
| 4500 | |
| 4501 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4502 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4503 | |
| 4504 | // Next, we fill out the buffer descriptor: |
| 4505 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4506 | SIR_MAC_MGMT_ACTION, peer); |
| 4507 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4508 | { |
| 4509 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4510 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4511 | nSirStatus ); |
| 4512 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4513 | return eSIR_FAILURE; // just allocated... |
| 4514 | } |
| 4515 | |
| 4516 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4517 | |
| 4518 | nCfg = 6; |
| 4519 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4520 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4521 | { |
| 4522 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4523 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | nSirStatus ); |
| 4525 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4526 | return eSIR_FAILURE; // just allocated... |
| 4527 | } |
| 4528 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4529 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4530 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4531 | #endif |
| 4532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4533 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4534 | sizeof(tSirMacMgmtHdr), |
| 4535 | nPayload, &nPayload ); |
| 4536 | if ( DOT11F_FAILED( nStatus ) ) |
| 4537 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4538 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | nStatus ); |
| 4540 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4541 | return eSIR_FAILURE; // allocated! |
| 4542 | } |
| 4543 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4544 | { |
| 4545 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4546 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4547 | } |
| 4548 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4549 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4550 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4551 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4553 | HAL_TXRX_FRM_802_11_MGMT, |
| 4554 | ANI_TXDIR_TODS, |
| 4555 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4556 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4557 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4558 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4559 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4560 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4561 | { |
| 4562 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4563 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4564 | nSirStatus ); |
| 4565 | //Pkt will be freed up by the callback |
| 4566 | return eSIR_FAILURE; // just allocated... |
| 4567 | } |
| 4568 | |
| 4569 | return eSIR_SUCCESS; |
| 4570 | |
| 4571 | } // End limSendMeasReportFrame. |
| 4572 | |
| 4573 | |
| 4574 | /** |
| 4575 | * \brief Send a TPC Request Action frame |
| 4576 | * |
| 4577 | * |
| 4578 | * \param pMac Pointer to the global MAC datastructure |
| 4579 | * |
| 4580 | * \param peer MAC address to which the frame should be sent |
| 4581 | * |
| 4582 | * |
| 4583 | */ |
| 4584 | |
| 4585 | void |
| 4586 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4587 | tSirMacAddr peer) |
| 4588 | { |
| 4589 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4590 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4591 | tSirRetStatus nSirStatus; |
| 4592 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4593 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4594 | void *pPacket; |
| 4595 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4596 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4597 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4598 | |
| 4599 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4600 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4601 | frm.DialogToken.token = 1; |
| 4602 | frm.TPCRequest.present = 1; |
| 4603 | |
| 4604 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4605 | if ( DOT11F_FAILED( nStatus ) ) |
| 4606 | { |
| 4607 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4608 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4609 | nStatus ); |
| 4610 | // We'll fall back on the worst case scenario: |
| 4611 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4612 | } |
| 4613 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4614 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4615 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4617 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4618 | } |
| 4619 | |
| 4620 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4621 | |
| 4622 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4623 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4624 | { |
| 4625 | 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] | 4626 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4627 | return; |
| 4628 | } |
| 4629 | |
| 4630 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4631 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4632 | |
| 4633 | // Next, we fill out the buffer descriptor: |
| 4634 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4635 | SIR_MAC_MGMT_ACTION, peer); |
| 4636 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4637 | { |
| 4638 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4639 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4640 | nSirStatus ); |
| 4641 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4642 | return; // just allocated... |
| 4643 | } |
| 4644 | |
| 4645 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4646 | |
| 4647 | nCfg = 6; |
| 4648 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4649 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4650 | { |
| 4651 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4652 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4653 | nSirStatus ); |
| 4654 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4655 | return; // just allocated... |
| 4656 | } |
| 4657 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4658 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4659 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4660 | #endif |
| 4661 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4662 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4663 | sizeof(tSirMacMgmtHdr), |
| 4664 | nPayload, &nPayload ); |
| 4665 | if ( DOT11F_FAILED( nStatus ) ) |
| 4666 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4667 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4668 | nStatus ); |
| 4669 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4670 | return; // allocated! |
| 4671 | } |
| 4672 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4673 | { |
| 4674 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4675 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4676 | } |
| 4677 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4678 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4679 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4680 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4681 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4682 | HAL_TXRX_FRM_802_11_MGMT, |
| 4683 | ANI_TXDIR_TODS, |
| 4684 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4685 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4686 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4687 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4688 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4689 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4690 | { |
| 4691 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4692 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4693 | nSirStatus ); |
| 4694 | //Pkt will be freed up by the callback |
| 4695 | return; |
| 4696 | } |
| 4697 | |
| 4698 | } // End limSendTpcRequestFrame. |
| 4699 | |
| 4700 | |
| 4701 | /** |
| 4702 | * \brief Send a TPC Report Action frame |
| 4703 | * |
| 4704 | * |
| 4705 | * \param pMac Pointer to the global MAC datastructure |
| 4706 | * |
| 4707 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4708 | * |
| 4709 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4710 | * |
| 4711 | * |
| 4712 | */ |
| 4713 | |
| 4714 | tSirRetStatus |
| 4715 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4716 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4717 | tSirMacAddr peer) |
| 4718 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4719 | tDot11fTPCReport frm; |
| 4720 | tANI_U8 *pFrame; |
| 4721 | tSirRetStatus nSirStatus; |
| 4722 | tpSirMacMgmtHdr pMacHdr; |
| 4723 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4724 | void *pPacket; |
| 4725 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4727 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4728 | |
| 4729 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4730 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4731 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4732 | |
| 4733 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4734 | // "misplaced this function, need to replace: |
| 4735 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4736 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4737 | frm.TPCReport.tx_power = 0; |
| 4738 | frm.TPCReport.link_margin = 0; |
| 4739 | frm.TPCReport.present = 1; |
| 4740 | |
| 4741 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4742 | if ( DOT11F_FAILED( nStatus ) ) |
| 4743 | { |
| 4744 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4745 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4746 | nStatus ); |
| 4747 | // We'll fall back on the worst case scenario: |
| 4748 | nPayload = sizeof( tDot11fTPCReport ); |
| 4749 | } |
| 4750 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4751 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4752 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4753 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4754 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4755 | } |
| 4756 | |
| 4757 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4758 | |
| 4759 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4760 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4761 | { |
| 4762 | 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] | 4763 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4764 | return eSIR_FAILURE; |
| 4765 | } |
| 4766 | |
| 4767 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4768 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4769 | |
| 4770 | // Next, we fill out the buffer descriptor: |
| 4771 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4772 | SIR_MAC_MGMT_ACTION, peer); |
| 4773 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4774 | { |
| 4775 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4776 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4777 | nSirStatus ); |
| 4778 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4779 | return eSIR_FAILURE; // just allocated... |
| 4780 | } |
| 4781 | |
| 4782 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4783 | |
| 4784 | nCfg = 6; |
| 4785 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4786 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4787 | { |
| 4788 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4789 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4790 | nSirStatus ); |
| 4791 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4792 | return eSIR_FAILURE; // just allocated... |
| 4793 | } |
| 4794 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4795 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4796 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4797 | #endif |
| 4798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4799 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4800 | sizeof(tSirMacMgmtHdr), |
| 4801 | nPayload, &nPayload ); |
| 4802 | if ( DOT11F_FAILED( nStatus ) ) |
| 4803 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4804 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4805 | nStatus ); |
| 4806 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4807 | return eSIR_FAILURE; // allocated! |
| 4808 | } |
| 4809 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4810 | { |
| 4811 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4812 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4813 | } |
| 4814 | |
| 4815 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4816 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4817 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4818 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4819 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4820 | HAL_TXRX_FRM_802_11_MGMT, |
| 4821 | ANI_TXDIR_TODS, |
| 4822 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4823 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4824 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4825 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4826 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4827 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4828 | { |
| 4829 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4830 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4831 | nSirStatus ); |
| 4832 | //Pkt will be freed up by the callback |
| 4833 | return eSIR_FAILURE; // just allocated... |
| 4834 | } |
| 4835 | |
| 4836 | return eSIR_SUCCESS; |
| 4837 | |
| 4838 | } // End limSendTpcReportFrame. |
| 4839 | #endif //ANI_SUPPORT_11H |
| 4840 | |
| 4841 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | /** |
| 4843 | * \brief Send a Channel Switch Announcement |
| 4844 | * |
| 4845 | * |
| 4846 | * \param pMac Pointer to the global MAC datastructure |
| 4847 | * |
| 4848 | * \param peer MAC address to which this frame will be sent |
| 4849 | * |
| 4850 | * \param nMode |
| 4851 | * |
| 4852 | * \param nNewChannel |
| 4853 | * |
| 4854 | * \param nCount |
| 4855 | * |
| 4856 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4857 | * |
| 4858 | * |
| 4859 | */ |
| 4860 | |
| 4861 | tSirRetStatus |
| 4862 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4863 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4864 | tANI_U8 nMode, |
| 4865 | tANI_U8 nNewChannel, |
| 4866 | tANI_U8 nCount, |
| 4867 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4868 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4869 | tDot11fChannelSwitch frm; |
| 4870 | tANI_U8 *pFrame; |
| 4871 | tSirRetStatus nSirStatus; |
| 4872 | tpSirMacMgmtHdr pMacHdr; |
| 4873 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4874 | void *pPacket; |
| 4875 | eHalStatus halstatus; |
| 4876 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4877 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4878 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4879 | |
| 4880 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4881 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4882 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4883 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4884 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4885 | frm.ChanSwitchAnn.present = 1; |
| 4886 | |
| 4887 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4888 | if ( DOT11F_FAILED( nStatus ) ) |
| 4889 | { |
| 4890 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4891 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4892 | nStatus ); |
| 4893 | // We'll fall back on the worst case scenario: |
| 4894 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4895 | } |
| 4896 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4897 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4898 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4899 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4900 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4901 | } |
| 4902 | |
| 4903 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4904 | |
| 4905 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4906 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4907 | { |
| 4908 | 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] | 4909 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4910 | return eSIR_FAILURE; |
| 4911 | } |
| 4912 | |
| 4913 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4914 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4915 | |
| 4916 | // Next, we fill out the buffer descriptor: |
| 4917 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4918 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4919 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4920 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4921 | (tANI_U8 *) psessionEntry->bssId, |
| 4922 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4923 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4924 | { |
| 4925 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4926 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | nSirStatus ); |
| 4928 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4929 | return eSIR_FAILURE; // just allocated... |
| 4930 | } |
| 4931 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4932 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4933 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4934 | |
| 4935 | nCfg = 6; |
| 4936 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4937 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4938 | { |
| 4939 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4940 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4941 | nSirStatus ); |
| 4942 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4943 | return eSIR_FAILURE; // just allocated... |
| 4944 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4945 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4946 | |
| 4947 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4948 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4949 | #endif |
| 4950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4951 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4952 | sizeof(tSirMacMgmtHdr), |
| 4953 | nPayload, &nPayload ); |
| 4954 | if ( DOT11F_FAILED( nStatus ) ) |
| 4955 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4956 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4957 | nStatus ); |
| 4958 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4959 | return eSIR_FAILURE; // allocated! |
| 4960 | } |
| 4961 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4962 | { |
| 4963 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4964 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4965 | } |
| 4966 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4967 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4968 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4969 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4970 | ) |
| 4971 | { |
| 4972 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4973 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4974 | |
| 4975 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4976 | psessionEntry->peSessionId, |
| 4977 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4978 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4979 | HAL_TXRX_FRM_802_11_MGMT, |
| 4980 | ANI_TXDIR_TODS, |
| 4981 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4982 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4983 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4984 | psessionEntry->peSessionId, |
| 4985 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4987 | { |
| 4988 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4989 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4990 | nSirStatus ); |
| 4991 | //Pkt will be freed up by the callback |
| 4992 | return eSIR_FAILURE; |
| 4993 | } |
| 4994 | |
| 4995 | return eSIR_SUCCESS; |
| 4996 | |
| 4997 | } // End limSendChannelSwitchMgmtFrame. |
| 4998 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4999 | |
| 5000 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5001 | #ifdef WLAN_FEATURE_11AC |
| 5002 | tSirRetStatus |
| 5003 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 5004 | tSirMacAddr peer, |
| 5005 | tANI_U8 nMode, |
| 5006 | tpPESession psessionEntry ) |
| 5007 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5008 | tDot11fOperatingMode frm; |
| 5009 | tANI_U8 *pFrame; |
| 5010 | tSirRetStatus nSirStatus; |
| 5011 | tpSirMacMgmtHdr pMacHdr; |
| 5012 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 5013 | void *pPacket; |
| 5014 | eHalStatus halstatus; |
| 5015 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5016 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5017 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5018 | |
| 5019 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5020 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5021 | frm.OperatingMode.chanWidth = nMode; |
| 5022 | frm.OperatingMode.rxNSS = 0; |
| 5023 | frm.OperatingMode.rxNSSType = 0; |
| 5024 | |
| 5025 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5026 | if ( DOT11F_FAILED( nStatus ) ) |
| 5027 | { |
| 5028 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5029 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5030 | nStatus ); |
| 5031 | // We'll fall back on the worst case scenario: |
| 5032 | nPayload = sizeof( tDot11fOperatingMode); |
| 5033 | } |
| 5034 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5035 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5036 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5037 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5038 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5039 | } |
| 5040 | |
| 5041 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5042 | |
| 5043 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5044 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5045 | { |
| 5046 | 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] | 5047 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5048 | return eSIR_FAILURE; |
| 5049 | } |
| 5050 | |
| 5051 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5052 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5053 | |
| 5054 | |
| 5055 | // Next, we fill out the buffer descriptor: |
| 5056 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5057 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5058 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5059 | } else |
| 5060 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5061 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5062 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5063 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5064 | (tANI_U8 *) psessionEntry->bssId, |
| 5065 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5066 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5067 | { |
| 5068 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5069 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5070 | nSirStatus ); |
| 5071 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5072 | return eSIR_FAILURE; // just allocated... |
| 5073 | } |
| 5074 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5075 | sizeof(tSirMacMgmtHdr), |
| 5076 | nPayload, &nPayload ); |
| 5077 | if ( DOT11F_FAILED( nStatus ) ) |
| 5078 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5079 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5080 | nStatus ); |
| 5081 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5082 | return eSIR_FAILURE; // allocated! |
| 5083 | } |
| 5084 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5085 | { |
| 5086 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5087 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5088 | } |
| 5089 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5090 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5091 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5092 | ) |
| 5093 | { |
| 5094 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5095 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5096 | |
| 5097 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5098 | psessionEntry->peSessionId, |
| 5099 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5100 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5101 | HAL_TXRX_FRM_802_11_MGMT, |
| 5102 | ANI_TXDIR_TODS, |
| 5103 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5104 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5105 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5106 | psessionEntry->peSessionId, |
| 5107 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5108 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5109 | { |
| 5110 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5111 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5112 | nSirStatus ); |
| 5113 | //Pkt will be freed up by the callback |
| 5114 | return eSIR_FAILURE; |
| 5115 | } |
| 5116 | |
| 5117 | return eSIR_SUCCESS; |
| 5118 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5119 | |
| 5120 | /** |
| 5121 | * \brief Send a VHT Channel Switch Announcement |
| 5122 | * |
| 5123 | * |
| 5124 | * \param pMac Pointer to the global MAC datastructure |
| 5125 | * |
| 5126 | * \param peer MAC address to which this frame will be sent |
| 5127 | * |
| 5128 | * \param nChanWidth |
| 5129 | * |
| 5130 | * \param nNewChannel |
| 5131 | * |
| 5132 | * |
| 5133 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5134 | * |
| 5135 | * |
| 5136 | */ |
| 5137 | |
| 5138 | tSirRetStatus |
| 5139 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5140 | tSirMacAddr peer, |
| 5141 | tANI_U8 nChanWidth, |
| 5142 | tANI_U8 nNewChannel, |
| 5143 | tANI_U8 ncbMode, |
| 5144 | tpPESession psessionEntry ) |
| 5145 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5146 | tDot11fChannelSwitch frm; |
| 5147 | tANI_U8 *pFrame; |
| 5148 | tSirRetStatus nSirStatus; |
| 5149 | tpSirMacMgmtHdr pMacHdr; |
| 5150 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5151 | void *pPacket; |
| 5152 | eHalStatus halstatus; |
| 5153 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5154 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5155 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5156 | |
| 5157 | |
| 5158 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5159 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5160 | frm.ChanSwitchAnn.switchMode = 1; |
| 5161 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5162 | frm.ChanSwitchAnn.switchCount = 1; |
| 5163 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5164 | frm.ExtChanSwitchAnn.present = 1; |
| 5165 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5166 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5167 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5168 | frm.ChanSwitchAnn.present = 1; |
| 5169 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5170 | |
| 5171 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5172 | if ( DOT11F_FAILED( nStatus ) ) |
| 5173 | { |
| 5174 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5175 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5176 | nStatus ); |
| 5177 | // We'll fall back on the worst case scenario: |
| 5178 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5179 | } |
| 5180 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5181 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5182 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5183 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5184 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5185 | } |
| 5186 | |
| 5187 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5188 | |
| 5189 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5190 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5191 | { |
| 5192 | 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] | 5193 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5194 | return eSIR_FAILURE; |
| 5195 | } |
| 5196 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5197 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5198 | |
| 5199 | // Next, we fill out the buffer descriptor: |
| 5200 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5201 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5202 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5203 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5204 | (tANI_U8 *) psessionEntry->bssId, |
| 5205 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5206 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5207 | { |
| 5208 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5209 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5210 | nSirStatus ); |
| 5211 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5212 | return eSIR_FAILURE; // just allocated... |
| 5213 | } |
| 5214 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5215 | sizeof(tSirMacMgmtHdr), |
| 5216 | nPayload, &nPayload ); |
| 5217 | if ( DOT11F_FAILED( nStatus ) ) |
| 5218 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5219 | 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] | 5220 | nStatus ); |
| 5221 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5222 | return eSIR_FAILURE; // allocated! |
| 5223 | } |
| 5224 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5225 | { |
| 5226 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5227 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5228 | } |
| 5229 | |
| 5230 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5231 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5232 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5233 | ) |
| 5234 | { |
| 5235 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5236 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5237 | |
| 5238 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5239 | psessionEntry->peSessionId, |
| 5240 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5241 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5242 | HAL_TXRX_FRM_802_11_MGMT, |
| 5243 | ANI_TXDIR_TODS, |
| 5244 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5245 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5246 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5247 | psessionEntry->peSessionId, |
| 5248 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5249 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5250 | { |
| 5251 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5252 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5253 | nSirStatus ); |
| 5254 | //Pkt will be freed up by the callback |
| 5255 | return eSIR_FAILURE; |
| 5256 | } |
| 5257 | |
| 5258 | return eSIR_SUCCESS; |
| 5259 | |
| 5260 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5261 | |
| 5262 | |
| 5263 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5264 | #endif |
| 5265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5266 | /** |
| 5267 | * \brief Send an ADDBA Req Action Frame to peer |
| 5268 | * |
| 5269 | * \sa limSendAddBAReq |
| 5270 | * |
| 5271 | * \param pMac The global tpAniSirGlobal object |
| 5272 | * |
| 5273 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5274 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5275 | * Frame to the peer |
| 5276 | * |
| 5277 | * \return eSIR_SUCCESS if setup completes successfully |
| 5278 | * eSIR_FAILURE is some problem is encountered |
| 5279 | */ |
| 5280 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5281 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5282 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5283 | tDot11fAddBAReq frmAddBAReq; |
| 5284 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5285 | tpSirMacMgmtHdr pMacHdr; |
| 5286 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5287 | tSirRetStatus statusCode; |
| 5288 | eHalStatus halStatus; |
| 5289 | void *pPacket; |
| 5290 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5291 | |
| 5292 | if(NULL == psessionEntry) |
| 5293 | { |
| 5294 | return eSIR_FAILURE; |
| 5295 | } |
| 5296 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5297 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5298 | |
| 5299 | // Category - 3 (BA) |
| 5300 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5301 | |
| 5302 | // Action - 0 (ADDBA Req) |
| 5303 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5304 | |
| 5305 | // FIXME - Dialog Token, generalize this... |
| 5306 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5307 | |
| 5308 | // Fill the ADDBA Parameter Set |
| 5309 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5310 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5311 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5312 | |
| 5313 | // BA timeout |
| 5314 | // 0 - indicates no BA timeout |
| 5315 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5316 | |
| 5317 | // BA Starting Sequence Number |
| 5318 | // Fragment number will always be zero |
| 5319 | if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) { |
| 5320 | pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5321 | } |
| 5322 | |
| 5323 | frmAddBAReq.BAStartingSequenceControl.ssn = |
| 5324 | pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5325 | |
| 5326 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5327 | |
| 5328 | if( DOT11F_FAILED( nStatus )) |
| 5329 | { |
| 5330 | limLog( pMac, LOGW, |
| 5331 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5332 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5333 | nStatus ); |
| 5334 | |
| 5335 | // We'll fall back on the worst case scenario: |
| 5336 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5337 | } |
| 5338 | else if( DOT11F_WARNED( nStatus )) |
| 5339 | { |
| 5340 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5341 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5342 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5343 | nStatus ); |
| 5344 | } |
| 5345 | |
| 5346 | // Add the MGMT header to frame length |
| 5347 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5348 | |
| 5349 | // Need to allocate a buffer for ADDBA AF |
| 5350 | if( eHAL_STATUS_SUCCESS != |
| 5351 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5352 | HAL_TXRX_FRM_802_11_MGMT, |
| 5353 | (tANI_U16) frameLen, |
| 5354 | (void **) &pAddBAReqBuffer, |
| 5355 | (void **) &pPacket ))) |
| 5356 | { |
| 5357 | // Log error |
| 5358 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5359 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5360 | frameLen, |
| 5361 | halStatus ); |
| 5362 | |
| 5363 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5364 | goto returnAfterError; |
| 5365 | } |
| 5366 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5367 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | |
| 5369 | // Copy necessary info to BD |
| 5370 | if( eSIR_SUCCESS != |
| 5371 | (statusCode = limPopulateMacHeader( pMac, |
| 5372 | pAddBAReqBuffer, |
| 5373 | SIR_MAC_MGMT_FRAME, |
| 5374 | SIR_MAC_MGMT_ACTION, |
| 5375 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5376 | goto returnAfterError; |
| 5377 | |
| 5378 | // Update A3 with the BSSID |
| 5379 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5380 | |
| 5381 | #if 0 |
| 5382 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5383 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5384 | WNI_CFG_BSSID, |
| 5385 | (tANI_U8 *) pMacHdr->bssId, |
| 5386 | &cfgLen )) |
| 5387 | { |
| 5388 | limLog( pMac, LOGP, |
| 5389 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5390 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5391 | |
| 5392 | // FIXME - Need to convert to tSirRetStatus |
| 5393 | statusCode = eSIR_FAILURE; |
| 5394 | goto returnAfterError; |
| 5395 | } |
| 5396 | #endif//TO SUPPORT BT-AMP |
| 5397 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5398 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5399 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5400 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5401 | #endif |
| 5402 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5403 | // Now, we're ready to "pack" the frames |
| 5404 | nStatus = dot11fPackAddBAReq( pMac, |
| 5405 | &frmAddBAReq, |
| 5406 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5407 | nPayload, |
| 5408 | &nPayload ); |
| 5409 | |
| 5410 | if( DOT11F_FAILED( nStatus )) |
| 5411 | { |
| 5412 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5413 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5414 | nStatus ); |
| 5415 | |
| 5416 | // FIXME - Need to convert to tSirRetStatus |
| 5417 | statusCode = eSIR_FAILURE; |
| 5418 | goto returnAfterError; |
| 5419 | } |
| 5420 | else if( DOT11F_WARNED( nStatus )) |
| 5421 | { |
| 5422 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5423 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5424 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5425 | } |
| 5426 | |
| 5427 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5428 | FL( "Sending an ADDBA REQ to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5429 | limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW ); |
| 5430 | |
| 5431 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5432 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5433 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | ) |
| 5435 | { |
| 5436 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5437 | } |
| 5438 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5439 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5440 | psessionEntry->peSessionId, |
| 5441 | pMacHdr->fc.subType)); |
| 5442 | halStatus = halTxFrame( pMac, |
| 5443 | pPacket, |
| 5444 | (tANI_U16) frameLen, |
| 5445 | HAL_TXRX_FRM_802_11_MGMT, |
| 5446 | ANI_TXDIR_TODS, |
| 5447 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5448 | limTxComplete, |
| 5449 | pAddBAReqBuffer, txFlag ); |
| 5450 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5451 | psessionEntry->peSessionId, |
| 5452 | halStatus)); |
| 5453 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5454 | { |
| 5455 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5456 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5457 | halStatus ); |
| 5458 | |
| 5459 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5460 | statusCode = eSIR_FAILURE; |
| 5461 | //Pkt will be freed up by the callback |
| 5462 | return statusCode; |
| 5463 | } |
| 5464 | else |
| 5465 | return eSIR_SUCCESS; |
| 5466 | |
| 5467 | returnAfterError: |
| 5468 | |
| 5469 | // Release buffer, if allocated |
| 5470 | if( NULL != pAddBAReqBuffer ) |
| 5471 | palPktFree( pMac->hHdd, |
| 5472 | HAL_TXRX_FRM_802_11_MGMT, |
| 5473 | (void *) pAddBAReqBuffer, |
| 5474 | (void *) pPacket ); |
| 5475 | |
| 5476 | return statusCode; |
| 5477 | } |
| 5478 | |
| 5479 | /** |
| 5480 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5481 | * |
| 5482 | * \sa limSendAddBARsp |
| 5483 | * |
| 5484 | * \param pMac The global tpAniSirGlobal object |
| 5485 | * |
| 5486 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5487 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5488 | * Frame to the peer |
| 5489 | * |
| 5490 | * \return eSIR_SUCCESS if setup completes successfully |
| 5491 | * eSIR_FAILURE is some problem is encountered |
| 5492 | */ |
| 5493 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5494 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5495 | tpPESession psessionEntry) |
| 5496 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5497 | tDot11fAddBARsp frmAddBARsp; |
| 5498 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5499 | tpSirMacMgmtHdr pMacHdr; |
| 5500 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5501 | tSirRetStatus statusCode; |
| 5502 | eHalStatus halStatus; |
| 5503 | void *pPacket; |
| 5504 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5505 | |
| 5506 | if(NULL == psessionEntry) |
| 5507 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5508 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5509 | return eSIR_FAILURE; |
| 5510 | } |
| 5511 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5512 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5513 | |
| 5514 | // Category - 3 (BA) |
| 5515 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5516 | // Action - 1 (ADDBA Rsp) |
| 5517 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5518 | |
| 5519 | // Should be same as the one we received in the ADDBA Req |
| 5520 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5521 | |
| 5522 | // ADDBA Req status |
| 5523 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5524 | |
| 5525 | // Fill the ADDBA Parameter Set as provided by caller |
| 5526 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5527 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5528 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5529 | |
| 5530 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5531 | { |
| 5532 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5533 | psessionEntry->amsduSupportedInBA; |
| 5534 | } |
| 5535 | else |
| 5536 | { |
| 5537 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5539 | |
| 5540 | // BA timeout |
| 5541 | // 0 - indicates no BA timeout |
| 5542 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5543 | |
| 5544 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5545 | |
| 5546 | if( DOT11F_FAILED( nStatus )) |
| 5547 | { |
| 5548 | limLog( pMac, LOGW, |
| 5549 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5550 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5551 | nStatus ); |
| 5552 | |
| 5553 | // We'll fall back on the worst case scenario: |
| 5554 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5555 | } |
| 5556 | else if( DOT11F_WARNED( nStatus )) |
| 5557 | { |
| 5558 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5559 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5560 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5561 | nStatus ); |
| 5562 | } |
| 5563 | |
| 5564 | // Need to allocate a buffer for ADDBA AF |
| 5565 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5566 | |
| 5567 | // Allocate shared memory |
| 5568 | if( eHAL_STATUS_SUCCESS != |
| 5569 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5570 | HAL_TXRX_FRM_802_11_MGMT, |
| 5571 | (tANI_U16) frameLen, |
| 5572 | (void **) &pAddBARspBuffer, |
| 5573 | (void **) &pPacket ))) |
| 5574 | { |
| 5575 | // Log error |
| 5576 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5577 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5578 | frameLen, |
| 5579 | halStatus ); |
| 5580 | |
| 5581 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5582 | goto returnAfterError; |
| 5583 | } |
| 5584 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5585 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5586 | |
| 5587 | // Copy necessary info to BD |
| 5588 | if( eSIR_SUCCESS != |
| 5589 | (statusCode = limPopulateMacHeader( pMac, |
| 5590 | pAddBARspBuffer, |
| 5591 | SIR_MAC_MGMT_FRAME, |
| 5592 | SIR_MAC_MGMT_ACTION, |
| 5593 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5594 | goto returnAfterError; |
| 5595 | |
| 5596 | // Update A3 with the BSSID |
| 5597 | |
| 5598 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5599 | |
| 5600 | #if 0 |
| 5601 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5602 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5603 | WNI_CFG_BSSID, |
| 5604 | (tANI_U8 *) pMacHdr->bssId, |
| 5605 | &cfgLen )) |
| 5606 | { |
| 5607 | limLog( pMac, LOGP, |
| 5608 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5609 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5610 | |
| 5611 | // FIXME - Need to convert to tSirRetStatus |
| 5612 | statusCode = eSIR_FAILURE; |
| 5613 | goto returnAfterError; |
| 5614 | } |
| 5615 | #endif // TO SUPPORT BT-AMP |
| 5616 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5617 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5618 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5619 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5620 | #endif |
| 5621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5622 | // Now, we're ready to "pack" the frames |
| 5623 | nStatus = dot11fPackAddBARsp( pMac, |
| 5624 | &frmAddBARsp, |
| 5625 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5626 | nPayload, |
| 5627 | &nPayload ); |
| 5628 | |
| 5629 | if( DOT11F_FAILED( nStatus )) |
| 5630 | { |
| 5631 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5632 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | nStatus ); |
| 5634 | |
| 5635 | // FIXME - Need to convert to tSirRetStatus |
| 5636 | statusCode = eSIR_FAILURE; |
| 5637 | goto returnAfterError; |
| 5638 | } |
| 5639 | else if( DOT11F_WARNED( nStatus )) |
| 5640 | { |
| 5641 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5642 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5643 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5644 | } |
| 5645 | |
| 5646 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5647 | FL( "Sending an ADDBA RSP to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5648 | limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW ); |
| 5649 | |
| 5650 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5652 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5653 | ) |
| 5654 | { |
| 5655 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5656 | } |
| 5657 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5658 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5659 | psessionEntry->peSessionId, |
| 5660 | pMacHdr->fc.subType)); |
| 5661 | halStatus = halTxFrame( pMac, |
| 5662 | pPacket, |
| 5663 | (tANI_U16) frameLen, |
| 5664 | HAL_TXRX_FRM_802_11_MGMT, |
| 5665 | ANI_TXDIR_TODS, |
| 5666 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5667 | limTxComplete, |
| 5668 | pAddBARspBuffer, txFlag ); |
| 5669 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5670 | psessionEntry->peSessionId, |
| 5671 | halStatus)); |
| 5672 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5673 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5674 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5675 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5676 | halStatus ); |
| 5677 | |
| 5678 | // FIXME - HAL error codes are different from PE error |
| 5679 | // codes!! And, this routine is returning tSirRetStatus |
| 5680 | statusCode = eSIR_FAILURE; |
| 5681 | //Pkt will be freed up by the callback |
| 5682 | return statusCode; |
| 5683 | } |
| 5684 | else |
| 5685 | return eSIR_SUCCESS; |
| 5686 | |
| 5687 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5688 | // Release buffer, if allocated |
| 5689 | if( NULL != pAddBARspBuffer ) |
| 5690 | palPktFree( pMac->hHdd, |
| 5691 | HAL_TXRX_FRM_802_11_MGMT, |
| 5692 | (void *) pAddBARspBuffer, |
| 5693 | (void *) pPacket ); |
| 5694 | |
| 5695 | return statusCode; |
| 5696 | } |
| 5697 | |
| 5698 | /** |
| 5699 | * \brief Send a DELBA Indication Action Frame to peer |
| 5700 | * |
| 5701 | * \sa limSendDelBAInd |
| 5702 | * |
| 5703 | * \param pMac The global tpAniSirGlobal object |
| 5704 | * |
| 5705 | * \param peerMacAddr MAC Address of peer |
| 5706 | * |
| 5707 | * \param reasonCode Reason for the DELBA notification |
| 5708 | * |
| 5709 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5710 | * This identifies the TID for which the BA session is |
| 5711 | * being deleted. |
| 5712 | * |
| 5713 | * \return eSIR_SUCCESS if setup completes successfully |
| 5714 | * eSIR_FAILURE is some problem is encountered |
| 5715 | */ |
| 5716 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5717 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5718 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5719 | tDot11fDelBAInd frmDelBAInd; |
| 5720 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5721 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5722 | tpSirMacMgmtHdr pMacHdr; |
| 5723 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5724 | tSirRetStatus statusCode; |
| 5725 | eHalStatus halStatus; |
| 5726 | void *pPacket; |
| 5727 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5728 | |
| 5729 | if(NULL == psessionEntry) |
| 5730 | { |
| 5731 | return eSIR_FAILURE; |
| 5732 | } |
| 5733 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5734 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5735 | |
| 5736 | // Category - 3 (BA) |
| 5737 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5738 | // Action - 2 (DELBA) |
| 5739 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5740 | |
| 5741 | // Fill the DELBA Parameter Set as provided by caller |
| 5742 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5743 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5744 | |
| 5745 | // BA Starting Sequence Number |
| 5746 | // Fragment number will always be zero |
| 5747 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5748 | |
| 5749 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5750 | |
| 5751 | if( DOT11F_FAILED( nStatus )) |
| 5752 | { |
| 5753 | limLog( pMac, LOGW, |
| 5754 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5755 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5756 | nStatus ); |
| 5757 | |
| 5758 | // We'll fall back on the worst case scenario: |
| 5759 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5760 | } |
| 5761 | else if( DOT11F_WARNED( nStatus )) |
| 5762 | { |
| 5763 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5764 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5765 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5766 | nStatus ); |
| 5767 | } |
| 5768 | |
| 5769 | // Add the MGMT header to frame length |
| 5770 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5771 | |
| 5772 | // Allocate shared memory |
| 5773 | if( eHAL_STATUS_SUCCESS != |
| 5774 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5775 | HAL_TXRX_FRM_802_11_MGMT, |
| 5776 | (tANI_U16) frameLen, |
| 5777 | (void **) &pDelBAIndBuffer, |
| 5778 | (void **) &pPacket ))) |
| 5779 | { |
| 5780 | // Log error |
| 5781 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5782 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | frameLen, |
| 5784 | halStatus ); |
| 5785 | |
| 5786 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5787 | goto returnAfterError; |
| 5788 | } |
| 5789 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5790 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5791 | |
| 5792 | // Copy necessary info to BD |
| 5793 | if( eSIR_SUCCESS != |
| 5794 | (statusCode = limPopulateMacHeader( pMac, |
| 5795 | pDelBAIndBuffer, |
| 5796 | SIR_MAC_MGMT_FRAME, |
| 5797 | SIR_MAC_MGMT_ACTION, |
| 5798 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5799 | goto returnAfterError; |
| 5800 | |
| 5801 | // Update A3 with the BSSID |
| 5802 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5803 | |
| 5804 | #if 0 |
| 5805 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5806 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5807 | WNI_CFG_BSSID, |
| 5808 | (tANI_U8 *) pMacHdr->bssId, |
| 5809 | &cfgLen )) |
| 5810 | { |
| 5811 | limLog( pMac, LOGP, |
| 5812 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5813 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5814 | |
| 5815 | // FIXME - Need to convert to tSirRetStatus |
| 5816 | statusCode = eSIR_FAILURE; |
| 5817 | goto returnAfterError; |
| 5818 | } |
| 5819 | #endif //TO SUPPORT BT-AMP |
| 5820 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5821 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5822 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5823 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5824 | #endif |
| 5825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5826 | // Now, we're ready to "pack" the frames |
| 5827 | nStatus = dot11fPackDelBAInd( pMac, |
| 5828 | &frmDelBAInd, |
| 5829 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5830 | nPayload, |
| 5831 | &nPayload ); |
| 5832 | |
| 5833 | if( DOT11F_FAILED( nStatus )) |
| 5834 | { |
| 5835 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5836 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5837 | nStatus ); |
| 5838 | |
| 5839 | // FIXME - Need to convert to tSirRetStatus |
| 5840 | statusCode = eSIR_FAILURE; |
| 5841 | goto returnAfterError; |
| 5842 | } |
| 5843 | else if( DOT11F_WARNED( nStatus )) |
| 5844 | { |
| 5845 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5846 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5847 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5848 | } |
| 5849 | |
| 5850 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5851 | FL( "Sending a DELBA IND to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5852 | limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW ); |
| 5853 | |
| 5854 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5855 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5856 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5857 | ) |
| 5858 | { |
| 5859 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5860 | } |
| 5861 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5862 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5863 | psessionEntry->peSessionId, |
| 5864 | pMacHdr->fc.subType)); |
| 5865 | halStatus = halTxFrame( pMac, |
| 5866 | pPacket, |
| 5867 | (tANI_U16) frameLen, |
| 5868 | HAL_TXRX_FRM_802_11_MGMT, |
| 5869 | ANI_TXDIR_TODS, |
| 5870 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5871 | limTxComplete, |
| 5872 | pDelBAIndBuffer, txFlag ); |
| 5873 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5874 | psessionEntry->peSessionId, |
| 5875 | halStatus)); |
| 5876 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5877 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5878 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | statusCode = eSIR_FAILURE; |
| 5880 | //Pkt will be freed up by the callback |
| 5881 | return statusCode; |
| 5882 | } |
| 5883 | else |
| 5884 | return eSIR_SUCCESS; |
| 5885 | |
| 5886 | returnAfterError: |
| 5887 | |
| 5888 | // Release buffer, if allocated |
| 5889 | if( NULL != pDelBAIndBuffer ) |
| 5890 | palPktFree( pMac->hHdd, |
| 5891 | HAL_TXRX_FRM_802_11_MGMT, |
| 5892 | (void *) pDelBAIndBuffer, |
| 5893 | (void *) pPacket ); |
| 5894 | |
| 5895 | return statusCode; |
| 5896 | } |
| 5897 | |
| 5898 | #if defined WLAN_FEATURE_VOWIFI |
| 5899 | |
| 5900 | /** |
| 5901 | * \brief Send a Neighbor Report Request Action frame |
| 5902 | * |
| 5903 | * |
| 5904 | * \param pMac Pointer to the global MAC structure |
| 5905 | * |
| 5906 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5907 | * |
| 5908 | * \param peer mac address of peer station. |
| 5909 | * |
| 5910 | * \param psessionEntry address of session entry. |
| 5911 | * |
| 5912 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5913 | * |
| 5914 | * |
| 5915 | */ |
| 5916 | |
| 5917 | tSirRetStatus |
| 5918 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5919 | tpSirMacNeighborReportReq pNeighborReq, |
| 5920 | tSirMacAddr peer, |
| 5921 | tpPESession psessionEntry |
| 5922 | ) |
| 5923 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5924 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5925 | tDot11fNeighborReportRequest frm; |
| 5926 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5927 | tpSirMacMgmtHdr pMacHdr; |
| 5928 | tANI_U32 nBytes, nPayload, nStatus; |
| 5929 | void *pPacket; |
| 5930 | eHalStatus halstatus; |
| 5931 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | |
| 5933 | if ( psessionEntry == NULL ) |
| 5934 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5935 | 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] | 5936 | return eSIR_FAILURE; |
| 5937 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5938 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5939 | |
| 5940 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5941 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5942 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5943 | |
| 5944 | |
| 5945 | if( pNeighborReq->ssid_present ) |
| 5946 | { |
| 5947 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5948 | } |
| 5949 | |
| 5950 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5951 | if ( DOT11F_FAILED( nStatus ) ) |
| 5952 | { |
| 5953 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5954 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5955 | nStatus ); |
| 5956 | // We'll fall back on the worst case scenario: |
| 5957 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5958 | } |
| 5959 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5960 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5961 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5962 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5963 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5964 | } |
| 5965 | |
| 5966 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5967 | |
| 5968 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5969 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5970 | { |
| 5971 | 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] | 5972 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5973 | return eSIR_FAILURE; |
| 5974 | } |
| 5975 | |
| 5976 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5977 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5978 | |
| 5979 | // Copy necessary info to BD |
| 5980 | if( eSIR_SUCCESS != |
| 5981 | (statusCode = limPopulateMacHeader( pMac, |
| 5982 | pFrame, |
| 5983 | SIR_MAC_MGMT_FRAME, |
| 5984 | SIR_MAC_MGMT_ACTION, |
| 5985 | peer, psessionEntry->selfMacAddr))) |
| 5986 | goto returnAfterError; |
| 5987 | |
| 5988 | // Update A3 with the BSSID |
| 5989 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5990 | |
| 5991 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5992 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5993 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5994 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5995 | #endif |
| 5996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5997 | // Now, we're ready to "pack" the frames |
| 5998 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 5999 | &frm, |
| 6000 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6001 | nPayload, |
| 6002 | &nPayload ); |
| 6003 | |
| 6004 | if( DOT11F_FAILED( nStatus )) |
| 6005 | { |
| 6006 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6007 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6008 | nStatus ); |
| 6009 | |
| 6010 | // FIXME - Need to convert to tSirRetStatus |
| 6011 | statusCode = eSIR_FAILURE; |
| 6012 | goto returnAfterError; |
| 6013 | } |
| 6014 | else if( DOT11F_WARNED( nStatus )) |
| 6015 | { |
| 6016 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6017 | FL( "There were warnings while packing Neighbor Report " |
| 6018 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6019 | } |
| 6020 | |
| 6021 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6022 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6023 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6024 | |
| 6025 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6026 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6027 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6028 | ) |
| 6029 | { |
| 6030 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6031 | } |
| 6032 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6033 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6034 | psessionEntry->peSessionId, |
| 6035 | pMacHdr->fc.subType)); |
| 6036 | halstatus = halTxFrame( pMac, |
| 6037 | pPacket, |
| 6038 | (tANI_U16) nBytes, |
| 6039 | HAL_TXRX_FRM_802_11_MGMT, |
| 6040 | ANI_TXDIR_TODS, |
| 6041 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6042 | limTxComplete, |
| 6043 | pFrame, txFlag ); |
| 6044 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6045 | psessionEntry->peSessionId, |
| 6046 | halstatus)); |
| 6047 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6048 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6049 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6050 | statusCode = eSIR_FAILURE; |
| 6051 | //Pkt will be freed up by the callback |
| 6052 | return statusCode; |
| 6053 | } |
| 6054 | else |
| 6055 | return eSIR_SUCCESS; |
| 6056 | |
| 6057 | returnAfterError: |
| 6058 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6059 | |
| 6060 | return statusCode; |
| 6061 | } // End limSendNeighborReportRequestFrame. |
| 6062 | |
| 6063 | /** |
| 6064 | * \brief Send a Link Report Action frame |
| 6065 | * |
| 6066 | * |
| 6067 | * \param pMac Pointer to the global MAC structure |
| 6068 | * |
| 6069 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6070 | * |
| 6071 | * \param peer mac address of peer station. |
| 6072 | * |
| 6073 | * \param psessionEntry address of session entry. |
| 6074 | * |
| 6075 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6076 | * |
| 6077 | * |
| 6078 | */ |
| 6079 | |
| 6080 | tSirRetStatus |
| 6081 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6082 | tpSirMacLinkReport pLinkReport, |
| 6083 | tSirMacAddr peer, |
| 6084 | tpPESession psessionEntry |
| 6085 | ) |
| 6086 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6087 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6088 | tDot11fLinkMeasurementReport frm; |
| 6089 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6090 | tpSirMacMgmtHdr pMacHdr; |
| 6091 | tANI_U32 nBytes, nPayload, nStatus; |
| 6092 | void *pPacket; |
| 6093 | eHalStatus halstatus; |
| 6094 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6095 | |
| 6096 | |
| 6097 | if ( psessionEntry == NULL ) |
| 6098 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6099 | 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] | 6100 | return eSIR_FAILURE; |
| 6101 | } |
| 6102 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6103 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6104 | |
| 6105 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6106 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6107 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6108 | |
| 6109 | |
| 6110 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6111 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6112 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6113 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6114 | //such case this way than changing the frame parser. |
| 6115 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6116 | frm.TPCEleLen.TPCLen = 2; |
| 6117 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6118 | frm.LinkMargin.linkMargin = 0; |
| 6119 | |
| 6120 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6121 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6122 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6123 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6124 | |
| 6125 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6126 | if ( DOT11F_FAILED( nStatus ) ) |
| 6127 | { |
| 6128 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6129 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6130 | nStatus ); |
| 6131 | // We'll fall back on the worst case scenario: |
| 6132 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6133 | } |
| 6134 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6135 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6136 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6137 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6138 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6139 | } |
| 6140 | |
| 6141 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6142 | |
| 6143 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6144 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6145 | { |
| 6146 | 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] | 6147 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6148 | return eSIR_FAILURE; |
| 6149 | } |
| 6150 | |
| 6151 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6152 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | |
| 6154 | // Copy necessary info to BD |
| 6155 | if( eSIR_SUCCESS != |
| 6156 | (statusCode = limPopulateMacHeader( pMac, |
| 6157 | pFrame, |
| 6158 | SIR_MAC_MGMT_FRAME, |
| 6159 | SIR_MAC_MGMT_ACTION, |
| 6160 | peer, psessionEntry->selfMacAddr))) |
| 6161 | goto returnAfterError; |
| 6162 | |
| 6163 | // Update A3 with the BSSID |
| 6164 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6165 | |
| 6166 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6167 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6168 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6169 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6170 | #endif |
| 6171 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6172 | // Now, we're ready to "pack" the frames |
| 6173 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6174 | &frm, |
| 6175 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6176 | nPayload, |
| 6177 | &nPayload ); |
| 6178 | |
| 6179 | if( DOT11F_FAILED( nStatus )) |
| 6180 | { |
| 6181 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6182 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6183 | nStatus ); |
| 6184 | |
| 6185 | // FIXME - Need to convert to tSirRetStatus |
| 6186 | statusCode = eSIR_FAILURE; |
| 6187 | goto returnAfterError; |
| 6188 | } |
| 6189 | else if( DOT11F_WARNED( nStatus )) |
| 6190 | { |
| 6191 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6192 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6193 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6194 | } |
| 6195 | |
| 6196 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6197 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6198 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6199 | |
| 6200 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6201 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6202 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6203 | ) |
| 6204 | { |
| 6205 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6206 | } |
| 6207 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6208 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6209 | psessionEntry->peSessionId, |
| 6210 | pMacHdr->fc.subType)); |
| 6211 | halstatus = halTxFrame( pMac, |
| 6212 | pPacket, |
| 6213 | (tANI_U16) nBytes, |
| 6214 | HAL_TXRX_FRM_802_11_MGMT, |
| 6215 | ANI_TXDIR_TODS, |
| 6216 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6217 | limTxComplete, |
| 6218 | pFrame, txFlag ); |
| 6219 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6220 | psessionEntry->peSessionId, |
| 6221 | halstatus)); |
| 6222 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6223 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6224 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6225 | statusCode = eSIR_FAILURE; |
| 6226 | //Pkt will be freed up by the callback |
| 6227 | return statusCode; |
| 6228 | } |
| 6229 | else |
| 6230 | return eSIR_SUCCESS; |
| 6231 | |
| 6232 | returnAfterError: |
| 6233 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6234 | |
| 6235 | return statusCode; |
| 6236 | } // End limSendLinkReportActionFrame. |
| 6237 | |
| 6238 | /** |
| 6239 | * \brief Send a Beacon Report Action frame |
| 6240 | * |
| 6241 | * |
| 6242 | * \param pMac Pointer to the global MAC structure |
| 6243 | * |
| 6244 | * \param dialog_token dialog token to be used in the action frame. |
| 6245 | * |
| 6246 | * \param num_report number of reports in pRRMReport. |
| 6247 | * |
| 6248 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6249 | * |
| 6250 | * \param peer mac address of peer station. |
| 6251 | * |
| 6252 | * \param psessionEntry address of session entry. |
| 6253 | * |
| 6254 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6255 | * |
| 6256 | * |
| 6257 | */ |
| 6258 | |
| 6259 | tSirRetStatus |
| 6260 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6261 | tANI_U8 dialog_token, |
| 6262 | tANI_U8 num_report, |
| 6263 | tpSirMacRadioMeasureReport pRRMReport, |
| 6264 | tSirMacAddr peer, |
| 6265 | tpPESession psessionEntry |
| 6266 | ) |
| 6267 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6268 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6269 | tANI_U8 *pFrame; |
| 6270 | tpSirMacMgmtHdr pMacHdr; |
| 6271 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6272 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6273 | eHalStatus halstatus; |
| 6274 | tANI_U8 i; |
| 6275 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6277 | tDot11fRadioMeasurementReport *frm = |
| 6278 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6279 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6280 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6281 | return eSIR_FAILURE; |
| 6282 | } |
| 6283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | if ( psessionEntry == NULL ) |
| 6285 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6286 | 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] | 6287 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6288 | return eSIR_FAILURE; |
| 6289 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6290 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6291 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6292 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6293 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6294 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6295 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6296 | 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] | 6297 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6298 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6299 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6300 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6301 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6302 | 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] | 6303 | switch( pRRMReport[i].type ) |
| 6304 | { |
| 6305 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6306 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6307 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6308 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6309 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6310 | break; |
| 6311 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6312 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6313 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6314 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6315 | break; |
| 6316 | } |
| 6317 | } |
| 6318 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6319 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6320 | if ( DOT11F_FAILED( nStatus ) ) |
| 6321 | { |
| 6322 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6323 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6324 | nStatus ); |
| 6325 | // We'll fall back on the worst case scenario: |
| 6326 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6327 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6328 | return eSIR_FAILURE; |
| 6329 | } |
| 6330 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6331 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6332 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6334 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6335 | } |
| 6336 | |
| 6337 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6338 | |
| 6339 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6340 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6341 | { |
| 6342 | 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] | 6343 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6344 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6345 | return eSIR_FAILURE; |
| 6346 | } |
| 6347 | |
| 6348 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6349 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6350 | |
| 6351 | // Copy necessary info to BD |
| 6352 | if( eSIR_SUCCESS != |
| 6353 | (statusCode = limPopulateMacHeader( pMac, |
| 6354 | pFrame, |
| 6355 | SIR_MAC_MGMT_FRAME, |
| 6356 | SIR_MAC_MGMT_ACTION, |
| 6357 | peer, psessionEntry->selfMacAddr))) |
| 6358 | goto returnAfterError; |
| 6359 | |
| 6360 | // Update A3 with the BSSID |
| 6361 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6362 | |
| 6363 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6364 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6365 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6366 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6367 | #endif |
| 6368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6369 | // Now, we're ready to "pack" the frames |
| 6370 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6371 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6372 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6373 | nPayload, |
| 6374 | &nPayload ); |
| 6375 | |
| 6376 | if( DOT11F_FAILED( nStatus )) |
| 6377 | { |
| 6378 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6379 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6380 | nStatus ); |
| 6381 | |
| 6382 | // FIXME - Need to convert to tSirRetStatus |
| 6383 | statusCode = eSIR_FAILURE; |
| 6384 | goto returnAfterError; |
| 6385 | } |
| 6386 | else if( DOT11F_WARNED( nStatus )) |
| 6387 | { |
| 6388 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6389 | FL( "There were warnings while packing Radio " |
| 6390 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6391 | } |
| 6392 | |
| 6393 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6394 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6395 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6396 | |
| 6397 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6398 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6399 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6400 | ) |
| 6401 | { |
| 6402 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6403 | } |
| 6404 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6405 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6406 | psessionEntry->peSessionId, |
| 6407 | pMacHdr->fc.subType)); |
| 6408 | halstatus = halTxFrame( pMac, |
| 6409 | pPacket, |
| 6410 | (tANI_U16) nBytes, |
| 6411 | HAL_TXRX_FRM_802_11_MGMT, |
| 6412 | ANI_TXDIR_TODS, |
| 6413 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6414 | limTxComplete, |
| 6415 | pFrame, txFlag ); |
| 6416 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6417 | psessionEntry->peSessionId, |
| 6418 | halstatus)); |
| 6419 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6420 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6421 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6422 | statusCode = eSIR_FAILURE; |
| 6423 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6424 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6425 | return statusCode; |
| 6426 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6427 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6428 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6429 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6431 | |
| 6432 | returnAfterError: |
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 | 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] | 6435 | return statusCode; |
| 6436 | } // End limSendBeaconReportActionFrame. |
| 6437 | |
| 6438 | #endif |
| 6439 | |
| 6440 | #ifdef WLAN_FEATURE_11W |
| 6441 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6442 | * \brief Send SA query request action frame to peer |
| 6443 | * |
| 6444 | * \sa limSendSaQueryRequestFrame |
| 6445 | * |
| 6446 | * |
| 6447 | * \param pMac The global tpAniSirGlobal object |
| 6448 | * |
| 6449 | * \param transId Transaction identifier |
| 6450 | * |
| 6451 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6452 | * |
| 6453 | * \param psessionEntry The PE session entry |
| 6454 | * |
| 6455 | * \return eSIR_SUCCESS if setup completes successfully |
| 6456 | * eSIR_FAILURE is some problem is encountered |
| 6457 | */ |
| 6458 | |
| 6459 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6460 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6461 | { |
| 6462 | |
| 6463 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6464 | tANI_U8 *pFrame; |
| 6465 | tSirRetStatus nSirStatus; |
| 6466 | tpSirMacMgmtHdr pMacHdr; |
| 6467 | tANI_U32 nBytes, nPayload, nStatus; |
| 6468 | void *pPacket; |
| 6469 | eHalStatus halstatus; |
| 6470 | tANI_U8 txFlag = 0; |
| 6471 | |
| 6472 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6473 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6474 | /* 11w action field is : |
| 6475 | action: 0 --> SA Query Request action frame |
| 6476 | action: 1 --> SA Query Response action frame */ |
| 6477 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6478 | /* 11w SA Query Request transId */ |
| 6479 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6480 | |
| 6481 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6482 | if ( DOT11F_FAILED( nStatus ) ) |
| 6483 | { |
| 6484 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6485 | "for an SA Query Request (0x%08x)."), |
| 6486 | nStatus ); |
| 6487 | // We'll fall back on the worst case scenario: |
| 6488 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6489 | } |
| 6490 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6491 | { |
| 6492 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6493 | "the packed size for an SA Query Request" |
| 6494 | " (0x%08x)."), nStatus ); |
| 6495 | } |
| 6496 | |
| 6497 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6498 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6499 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6500 | { |
| 6501 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6502 | "action frame"), nBytes ); |
| 6503 | return eSIR_FAILURE; |
| 6504 | } |
| 6505 | |
| 6506 | // Paranoia: |
| 6507 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6508 | |
| 6509 | // Copy necessary info to BD |
| 6510 | nSirStatus = limPopulateMacHeader( pMac, |
| 6511 | pFrame, |
| 6512 | SIR_MAC_MGMT_FRAME, |
| 6513 | SIR_MAC_MGMT_ACTION, |
| 6514 | peer, psessionEntry->selfMacAddr ); |
| 6515 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6516 | goto returnAfterError; |
| 6517 | |
| 6518 | // Update A3 with the BSSID |
| 6519 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6520 | |
| 6521 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6522 | |
| 6523 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6524 | // in the FC |
| 6525 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6526 | |
| 6527 | // Pack 11w SA Query Request frame |
| 6528 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6529 | &frm, |
| 6530 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6531 | nPayload, |
| 6532 | &nPayload ); |
| 6533 | |
| 6534 | if ( DOT11F_FAILED( nStatus )) |
| 6535 | { |
| 6536 | limLog( pMac, LOGE, |
| 6537 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6538 | nStatus ); |
| 6539 | // FIXME - Need to convert to tSirRetStatus |
| 6540 | nSirStatus = eSIR_FAILURE; |
| 6541 | goto returnAfterError; |
| 6542 | } |
| 6543 | else if ( DOT11F_WARNED( nStatus )) |
| 6544 | { |
| 6545 | limLog( pMac, LOGW, |
| 6546 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6547 | nStatus); |
| 6548 | } |
| 6549 | |
| 6550 | limLog( pMac, LOG1, |
| 6551 | FL( "Sending an SA Query Request to " )); |
| 6552 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6553 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6554 | limLog( pMac, LOGE, |
| 6555 | FL( "Sending an SA Query Request from " )); |
| 6556 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6557 | |
| 6558 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6559 | #ifdef WLAN_FEATURE_P2P |
| 6560 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6561 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6562 | #endif |
| 6563 | ) |
| 6564 | { |
| 6565 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6566 | } |
| 6567 | |
| 6568 | halstatus = halTxFrame( pMac, |
| 6569 | pPacket, |
| 6570 | (tANI_U16) nBytes, |
| 6571 | HAL_TXRX_FRM_802_11_MGMT, |
| 6572 | ANI_TXDIR_TODS, |
| 6573 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6574 | limTxComplete, |
| 6575 | pFrame, txFlag ); |
| 6576 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6577 | { |
| 6578 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6579 | nSirStatus = eSIR_FAILURE; |
| 6580 | //Pkt will be freed up by the callback |
| 6581 | return nSirStatus; |
| 6582 | } |
| 6583 | else { |
| 6584 | return eSIR_SUCCESS; |
| 6585 | } |
| 6586 | |
| 6587 | returnAfterError: |
| 6588 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6589 | return nSirStatus; |
| 6590 | } // End limSendSaQueryRequestFrame |
| 6591 | |
| 6592 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6593 | * \brief Send SA query response action frame to peer |
| 6594 | * |
| 6595 | * \sa limSendSaQueryResponseFrame |
| 6596 | * |
| 6597 | * |
| 6598 | * \param pMac The global tpAniSirGlobal object |
| 6599 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6600 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6602 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6603 | * |
| 6604 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | * |
| 6606 | * \return eSIR_SUCCESS if setup completes successfully |
| 6607 | * eSIR_FAILURE is some problem is encountered |
| 6608 | */ |
| 6609 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6610 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6611 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6612 | { |
| 6613 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6614 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6615 | tANI_U8 *pFrame; |
| 6616 | tSirRetStatus nSirStatus; |
| 6617 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6618 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6619 | void *pPacket; |
| 6620 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6621 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6622 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6623 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6624 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6625 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | action: 0 --> SA query request action frame |
| 6627 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6628 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6629 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6631 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6632 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6633 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6634 | if ( DOT11F_FAILED( nStatus ) ) |
| 6635 | { |
| 6636 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6637 | "or a SA Query Response (0x%08x)."), |
| 6638 | nStatus ); |
| 6639 | // We'll fall back on the worst case scenario: |
| 6640 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6641 | } |
| 6642 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6643 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6644 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6645 | "the packed size for an SA Query Response" |
| 6646 | " (0x%08x)."), nStatus ); |
| 6647 | } |
| 6648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6649 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6650 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6651 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6652 | { |
| 6653 | 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] | 6654 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | return eSIR_FAILURE; |
| 6656 | } |
| 6657 | |
| 6658 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6659 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6661 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6662 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6663 | pFrame, |
| 6664 | SIR_MAC_MGMT_FRAME, |
| 6665 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6666 | peer, psessionEntry->selfMacAddr ); |
| 6667 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6668 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6669 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6670 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6672 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6673 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
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 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6676 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6677 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6678 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6679 | // Pack 11w SA query response frame |
| 6680 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6681 | &frm, |
| 6682 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6683 | nPayload, |
| 6684 | &nPayload ); |
| 6685 | |
| 6686 | if ( DOT11F_FAILED( nStatus )) |
| 6687 | { |
| 6688 | limLog( pMac, LOGE, |
| 6689 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6690 | nStatus ); |
| 6691 | // FIXME - Need to convert to tSirRetStatus |
| 6692 | nSirStatus = eSIR_FAILURE; |
| 6693 | goto returnAfterError; |
| 6694 | } |
| 6695 | else if ( DOT11F_WARNED( nStatus )) |
| 6696 | { |
| 6697 | limLog( pMac, LOGW, |
| 6698 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6699 | nStatus); |
| 6700 | } |
| 6701 | |
| 6702 | limLog( pMac, LOG1, |
| 6703 | FL( "Sending a SA Query Response to " )); |
| 6704 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6705 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6706 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6707 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6708 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6709 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6710 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6711 | ) |
| 6712 | { |
| 6713 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6714 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6715 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6716 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6717 | psessionEntry->peSessionId, |
| 6718 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6719 | halstatus = halTxFrame( pMac, |
| 6720 | pPacket, |
| 6721 | (tANI_U16) nBytes, |
| 6722 | HAL_TXRX_FRM_802_11_MGMT, |
| 6723 | ANI_TXDIR_TODS, |
| 6724 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6725 | limTxComplete, |
| 6726 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6727 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6728 | psessionEntry->peSessionId, |
| 6729 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6730 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6731 | { |
| 6732 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6733 | nSirStatus = eSIR_FAILURE; |
| 6734 | //Pkt will be freed up by the callback |
| 6735 | return nSirStatus; |
| 6736 | } |
| 6737 | else { |
| 6738 | return eSIR_SUCCESS; |
| 6739 | } |
| 6740 | |
| 6741 | returnAfterError: |
| 6742 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6743 | return nSirStatus; |
| 6744 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6745 | #endif |