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