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 | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 26 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | /** |
| 32 | * \file limSendManagementFrames.c |
| 33 | * |
| 34 | * \brief Code for preparing and sending 802.11 Management frames |
| 35 | * |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 36 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 37 | * |
| 38 | */ |
| 39 | |
| 40 | #include "sirApi.h" |
| 41 | #include "aniGlobal.h" |
| 42 | #include "sirMacProtDef.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | #include "cfgApi.h" |
| 44 | #include "utilsApi.h" |
| 45 | #include "limTypes.h" |
| 46 | #include "limUtils.h" |
| 47 | #include "limSecurityUtils.h" |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 48 | #include "limPropExtsUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | #include "dot11f.h" |
| 50 | #include "limStaHashApi.h" |
| 51 | #include "schApi.h" |
| 52 | #include "limSendMessages.h" |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 53 | #include "limAssocUtils.h" |
| 54 | #include "limFT.h" |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 55 | #ifdef WLAN_FEATURE_11W |
| 56 | #include "wniCfgAp.h" |
| 57 | #endif |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 58 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 59 | #if defined WLAN_FEATURE_VOWIFI |
| 60 | #include "rrmApi.h" |
| 61 | #endif |
| 62 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 63 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 64 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 65 | #define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 66 | //////////////////////////////////////////////////////////////////////// |
| 67 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 68 | tSirRetStatus limStripOffExtCapIE(tpAniSirGlobal pMac, |
| 69 | tANI_U8 *addIE, |
| 70 | tANI_U16 *addnIELen, |
| 71 | tANI_U8 *pExtractedExtCapIEBuf ) |
| 72 | { |
| 73 | tANI_U8* tempbuf = NULL; |
| 74 | tANI_U16 tempLen = 0; |
| 75 | int left = *addnIELen; |
| 76 | tANI_U8 *ptr = addIE; |
| 77 | tANI_U8 elem_id, elem_len; |
| 78 | |
| 79 | if (NULL == addIE) |
| 80 | { |
| 81 | PELOGE(limLog(pMac, LOG1, FL("NULL addIE pointer"));) |
| 82 | return eSIR_IGNORE_IE ; |
| 83 | } |
| 84 | |
| 85 | tempbuf = vos_mem_malloc(left); |
| 86 | if ( NULL == tempbuf ) |
| 87 | { |
| 88 | PELOGE(limLog(pMac, LOGE, |
| 89 | FL("Unable to allocate memory to store addn IE"));) |
| 90 | return eSIR_MEM_ALLOC_FAILED; |
| 91 | } |
| 92 | |
| 93 | while(left >= 2) |
| 94 | { |
| 95 | elem_id = ptr[0]; |
| 96 | elem_len = ptr[1]; |
| 97 | left -= 2; |
| 98 | if (elem_len > left) |
| 99 | { |
| 100 | limLog( pMac, LOGE, |
| 101 | FL("Invalid IEs eid = %d elem_len=%d left=%d"), |
| 102 | elem_id,elem_len,left); |
| 103 | vos_mem_free(tempbuf); |
| 104 | return eSIR_FAILURE; |
| 105 | } |
| 106 | if ( !(DOT11F_EID_EXTCAP == elem_id) ) |
| 107 | { |
| 108 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
| 109 | tempLen += (elem_len + 2); |
| 110 | } |
| 111 | else |
| 112 | { /*Est Cap present size is 8 + 2 byte at present*/ |
| 113 | if ( NULL != pExtractedExtCapIEBuf ) |
| 114 | { |
| 115 | vos_mem_set(pExtractedExtCapIEBuf, |
| 116 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 117 | if (elem_len <= DOT11F_IE_EXTCAP_MAX_LEN ) |
| 118 | { |
| 119 | vos_mem_copy (pExtractedExtCapIEBuf, &ptr[0], |
| 120 | elem_len + 2); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | left -= elem_len; |
| 125 | ptr += (elem_len + 2); |
| 126 | } |
| 127 | vos_mem_copy (addIE, tempbuf, tempLen); |
| 128 | *addnIELen = tempLen; |
| 129 | vos_mem_free(tempbuf); |
| 130 | return eSIR_SUCCESS; |
| 131 | } |
| 132 | |
| 133 | void limUpdateExtCapIEtoStruct(tpAniSirGlobal pMac, |
| 134 | tANI_U8 *pBuf, |
| 135 | tDot11fIEExtCap *pDst) |
| 136 | { |
| 137 | tANI_U8 pOut[DOT11F_IE_EXTCAP_MAX_LEN]; |
| 138 | |
| 139 | if ( NULL == pBuf ) |
| 140 | { |
| 141 | limLog( pMac, LOGE, |
| 142 | FL("Invalid Buffer Address")); |
| 143 | return; |
| 144 | } |
| 145 | if(NULL == pDst) |
| 146 | { |
| 147 | PELOGE(limLog(pMac, LOGE, |
| 148 | FL("NULL pDst pointer"));) |
| 149 | return ; |
| 150 | } |
| 151 | |
| 152 | if ( DOT11F_EID_EXTCAP != pBuf[0] || |
| 153 | pBuf[1] > DOT11F_IE_EXTCAP_MAX_LEN ) |
| 154 | { |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 155 | limLog( pMac, LOG1, |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 156 | FL("Invalid IEs eid = %d elem_len=%d "), |
| 157 | pBuf[0],pBuf[1]); |
| 158 | return; |
| 159 | } |
| 160 | vos_mem_set(( tANI_U8* )&pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, 0); |
| 161 | /* conversion should follow 4, 2, 2 byte order */ |
| 162 | limUtilsframeshtonl(pMac, &pOut[0],*((tANI_U32*)&pBuf[2]),0); |
| 163 | limUtilsframeshtons(pMac, &pOut[4],*((tANI_U16*)&pBuf[6]),0); |
| 164 | limUtilsframeshtons(pMac, &pOut[6],*((tANI_U16*)&pBuf[8]),0); |
| 165 | |
| 166 | if ( DOT11F_PARSE_SUCCESS != dot11fUnpackIeExtCap( pMac, |
| 167 | &pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, pDst) ) |
| 168 | { |
| 169 | limLog( pMac, LOGE, |
| 170 | FL("dot11fUnpackIeExtCap Parse Error ")); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | tSirRetStatus limStripOffExtCapIEAndUpdateStruct(tpAniSirGlobal pMac, |
| 175 | tANI_U8* addIE, |
| 176 | tANI_U16 *addnIELen, |
| 177 | tDot11fIEExtCap * pDst ) |
| 178 | { |
| 179 | tANI_U8 pExtractedExtCapIEBuf[DOT11F_IE_EXTCAP_MAX_LEN + 2]; |
| 180 | tSirRetStatus nSirStatus; |
| 181 | |
| 182 | vos_mem_set(( tANI_U8* )&pExtractedExtCapIEBuf[0], |
| 183 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 184 | nSirStatus = limStripOffExtCapIE(pMac, addIE, addnIELen, |
| 185 | pExtractedExtCapIEBuf); |
| 186 | if ( eSIR_SUCCESS != nSirStatus ) |
| 187 | { |
| 188 | limLog( pMac, LOG1, FL("Failed to strip off in" |
| 189 | "limStripOffExtCapIE status = (%d)."), |
| 190 | nSirStatus ); |
| 191 | return nSirStatus; |
| 192 | } |
| 193 | /* update the extracted ExtCap to struct*/ |
| 194 | limUpdateExtCapIEtoStruct(pMac, pExtractedExtCapIEBuf, pDst); |
| 195 | return nSirStatus; |
| 196 | } |
| 197 | |
| 198 | void limMergeExtCapIEStruct(tDot11fIEExtCap *pDst, |
| 199 | tDot11fIEExtCap *pSrc) |
| 200 | { |
| 201 | tANI_U8 *tempDst = (tANI_U8 *)pDst; |
| 202 | tANI_U8 *tempSrc = (tANI_U8 *)pSrc; |
| 203 | tANI_U8 structlen = sizeof(tDot11fIEExtCap); |
| 204 | |
| 205 | while(tempDst && tempSrc && structlen--) |
| 206 | { |
| 207 | *tempDst |= *tempSrc; |
| 208 | tempDst++; |
| 209 | tempSrc++; |
| 210 | } |
| 211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 212 | |
| 213 | /** |
| 214 | * |
| 215 | * \brief This function is called by various LIM modules to prepare the |
| 216 | * 802.11 frame MAC header |
| 217 | * |
| 218 | * |
| 219 | * \param pMac Pointer to Global MAC structure |
| 220 | * |
| 221 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 222 | * |
| 223 | * \param type Type of the frame |
| 224 | * |
| 225 | * \param subType Subtype of the frame |
| 226 | * |
| 227 | * \return eHalStatus |
| 228 | * |
| 229 | * |
| 230 | * The pFrameBuf argument points to the beginning of the frame buffer to |
| 231 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 232 | * will be the MGMT frame payload The payload itself is populated by the |
| 233 | * caller API |
| 234 | * |
| 235 | * |
| 236 | */ |
| 237 | |
| 238 | tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac, |
| 239 | tANI_U8* pBD, |
| 240 | tANI_U8 type, |
| 241 | tANI_U8 subType, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 242 | tSirMacAddr peerAddr, tSirMacAddr selfMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 243 | { |
| 244 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 245 | tpSirMacMgmtHdr pMacHdr; |
| 246 | |
| 247 | /// Prepare MAC management header |
| 248 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 249 | |
| 250 | // Prepare FC |
| 251 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 252 | pMacHdr->fc.type = type; |
| 253 | pMacHdr->fc.subType = subType; |
| 254 | |
| 255 | // Prepare Address 1 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 256 | vos_mem_copy( (tANI_U8 *) pMacHdr->da, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | (tANI_U8 *) peerAddr, |
| 258 | sizeof( tSirMacAddr )); |
| 259 | |
| 260 | // Prepare Address 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 262 | |
| 263 | // Prepare Address 3 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 264 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | (tANI_U8 *) peerAddr, |
| 266 | sizeof( tSirMacAddr )); |
| 267 | return statusCode; |
| 268 | } /*** end limPopulateMacHeader() ***/ |
| 269 | |
| 270 | /** |
| 271 | * \brief limSendProbeReqMgmtFrame |
| 272 | * |
| 273 | * |
| 274 | * \param pMac Pointer to Global MAC structure |
| 275 | * |
| 276 | * \param pSsid SSID to be sent in Probe Request frame |
| 277 | * |
| 278 | * \param bssid BSSID to be sent in Probe Request frame |
| 279 | * |
| 280 | * \param nProbeDelay probe delay to be used before sending Probe Request |
| 281 | * frame |
| 282 | * |
| 283 | * \param nChannelNum Channel # on which the Probe Request is going out |
| 284 | * |
| 285 | * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame |
| 286 | * |
| 287 | * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame |
| 288 | * |
| 289 | * This function is called by various LIM modules to send Probe Request frame |
| 290 | * during active scan/learn phase. |
| 291 | * Probe request is sent out in the following scenarios: |
| 292 | * --heartbeat failure: session needed |
| 293 | * --join req: session needed |
| 294 | * --foreground scan: no session |
| 295 | * --background scan: no session |
| 296 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 297 | * |
| 298 | * |
| 299 | */ |
| 300 | tSirRetStatus |
| 301 | limSendProbeReqMgmtFrame(tpAniSirGlobal pMac, |
| 302 | tSirMacSSid *pSsid, |
| 303 | tSirMacAddr bssid, |
| 304 | tANI_U8 nChannelNum, |
| 305 | tSirMacAddr SelfMacAddr, |
| 306 | tANI_U32 dot11mode, |
| 307 | tANI_U32 nAdditionalIELen, |
| 308 | tANI_U8 *pAdditionalIE) |
| 309 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 310 | tDot11fProbeRequest pr; |
| 311 | tANI_U32 nStatus, nBytes, nPayload; |
| 312 | tSirRetStatus nSirStatus; |
| 313 | tANI_U8 *pFrame; |
| 314 | void *pPacket; |
| 315 | eHalStatus halstatus; |
| 316 | tpPESession psessionEntry; |
| 317 | tANI_U8 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | tANI_U8 *p2pIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 319 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | |
| 321 | #ifndef GEN4_SCAN |
| 322 | return eSIR_FAILURE; |
| 323 | #endif |
| 324 | |
| 325 | #if defined ( ANI_DVT_DEBUG ) |
| 326 | return eSIR_FAILURE; |
| 327 | #endif |
| 328 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame] | 329 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 330 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 331 | * is false and dot11mode is 11ac set it to 11n. |
| 332 | */ |
| 333 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 334 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 335 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 336 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 337 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | /* |
| 339 | * session context may or may not be present, when probe request needs to be sent out. |
| 340 | * following cases exist: |
| 341 | * --heartbeat failure: session needed |
| 342 | * --join req: session needed |
| 343 | * --foreground scan: no session |
| 344 | * --background scan: no session |
| 345 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 346 | * If session context does not exist, some IEs will be populated from CFGs, |
| 347 | * e.g. Supported and Extended rate set IEs |
| 348 | */ |
| 349 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 350 | |
| 351 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 352 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 353 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 354 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | |
| 356 | // & delegating to assorted helpers: |
| 357 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | if( nAdditionalIELen && pAdditionalIE ) |
| 360 | { |
| 361 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 362 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 363 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 364 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 365 | ( p2pIe != NULL ) && |
| 366 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 367 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 368 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 369 | ( ( psessionEntry != NULL ) && |
| 370 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 371 | ) |
| 372 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 373 | { |
| 374 | /* In the below API pass channel number > 14, do that it fills only |
| 375 | * 11a rates in supported rates */ |
| 376 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 377 | } |
| 378 | else |
| 379 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 381 | &pr.SuppRates,psessionEntry); |
| 382 | |
| 383 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 384 | { |
| 385 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 386 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | |
| 389 | #if defined WLAN_FEATURE_VOWIFI |
| 390 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 391 | //DS params "can" be present in RRM is disabled and "is" present if |
| 392 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 393 | //RRM is not enabled. |
| 394 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 395 | //Call RRM module to get the tx power for management used. |
| 396 | { |
| 397 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 398 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 399 | } |
| 400 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | |
| 402 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 403 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 405 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 407 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 408 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 409 | } else { //psessionEntry == NULL |
| 410 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 411 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 412 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | } |
| 414 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 415 | |
Hardik Kantilal Patel | bca5b00 | 2015-01-19 15:30:18 +0530 | [diff] [blame] | 416 | if((nChannelNum <= SIR_11B_CHANNEL_END) |
| 417 | && (!IS_HT40_OBSS_SCAN_FEATURE_ENABLE) |
| 418 | && (!pMac->roam.configParam.channelBondingMode24GHz)) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 419 | { |
| 420 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 421 | pr.HTCaps.shortGI40MHz = 0; |
| 422 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 423 | #ifdef WLAN_FEATURE_11AC |
| 424 | if (psessionEntry != NULL ) { |
| 425 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 426 | //Include HT Capability IE |
| 427 | if (psessionEntry->vhtCapability) |
| 428 | { |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 429 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 430 | } |
| 431 | } else { |
| 432 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 433 | { |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 434 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 435 | } |
| 436 | } |
| 437 | #endif |
| 438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 439 | |
| 440 | // That's it-- now we pack it. First, how much space are we going to |
| 441 | // need? |
| 442 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 443 | if ( DOT11F_FAILED( nStatus ) ) |
| 444 | { |
| 445 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 446 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 447 | // We'll fall back on the worst case scenario: |
| 448 | nPayload = sizeof( tDot11fProbeRequest ); |
| 449 | } |
| 450 | else if ( DOT11F_WARNED( nStatus ) ) |
| 451 | { |
| 452 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 453 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 454 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 458 | |
| 459 | // Ok-- try to allocate some memory: |
| 460 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 461 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 462 | ( void** ) &pPacket ); |
| 463 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 464 | { |
| 465 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 466 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | return eSIR_MEM_ALLOC_FAILED; |
| 468 | } |
| 469 | |
| 470 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 471 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | |
| 473 | // Next, we fill out the buffer descriptor: |
| 474 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 475 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | if ( eSIR_SUCCESS != nSirStatus ) |
| 477 | { |
| 478 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 479 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 480 | nSirStatus ); |
| 481 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 482 | ( void* ) pFrame, ( void* ) pPacket ); |
| 483 | return nSirStatus; // allocated! |
| 484 | } |
| 485 | |
| 486 | // That done, pack the Probe Request: |
| 487 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 488 | sizeof( tSirMacMgmtHdr ), |
| 489 | nPayload, &nPayload ); |
| 490 | if ( DOT11F_FAILED( nStatus ) ) |
| 491 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 492 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | nStatus ); |
| 494 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 495 | return eSIR_FAILURE; // allocated! |
| 496 | } |
| 497 | else if ( DOT11F_WARNED( nStatus ) ) |
| 498 | { |
| 499 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 500 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | // Append any AddIE if present. |
| 504 | if( nAdditionalIELen ) |
| 505 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 506 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 507 | pAdditionalIE, nAdditionalIELen ); |
| 508 | nPayload += nAdditionalIELen; |
| 509 | } |
| 510 | |
| 511 | /* If this probe request is sent during P2P Search State, then we need |
| 512 | * to send it at OFDM rate. |
| 513 | */ |
| 514 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 515 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 516 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 517 | /* For unicast probe req mgmt from Join function |
| 518 | we don't set above variables. So we need to add |
| 519 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 520 | || ( ( psessionEntry != NULL ) && |
| 521 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 522 | ) |
| 523 | { |
| 524 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 525 | } |
| 526 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 527 | if( ( psessionEntry != NULL ) && ( psessionEntry->is11Gonly == true ) && |
| 528 | ( !IS_BROADCAST_MAC(bssid) ) ){ |
| 529 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 530 | } |
| 531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 533 | HAL_TXRX_FRM_802_11_MGMT, |
| 534 | ANI_TXDIR_TODS, |
| 535 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 536 | limTxComplete, pFrame, txFlag ); |
| 537 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 538 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 539 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | //Pkt will be freed up by the callback |
| 541 | return eSIR_FAILURE; |
| 542 | } |
| 543 | |
| 544 | return eSIR_SUCCESS; |
| 545 | } // End limSendProbeReqMgmtFrame. |
| 546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 547 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 548 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 549 | tANI_U8 probeReqP2pIe) |
| 550 | { |
| 551 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 552 | from additional IE */ |
| 553 | if(!probeReqP2pIe) |
| 554 | { |
| 555 | tANI_U8* tempbuf = NULL; |
| 556 | tANI_U16 tempLen = 0; |
| 557 | int left = *addnIELen; |
| 558 | v_U8_t *ptr = addIE; |
| 559 | v_U8_t elem_id, elem_len; |
| 560 | |
| 561 | if(NULL == addIE) |
| 562 | { |
| 563 | PELOGE(limLog(pMac, LOGE, |
| 564 | FL(" NULL addIE pointer"));) |
| 565 | return eSIR_FAILURE; |
| 566 | } |
| 567 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 568 | tempbuf = vos_mem_malloc(left); |
| 569 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 570 | { |
| 571 | PELOGE(limLog(pMac, LOGE, |
| 572 | FL("Unable to allocate memory to store addn IE"));) |
| 573 | return eSIR_MEM_ALLOC_FAILED; |
| 574 | } |
| 575 | |
| 576 | while(left >= 2) |
| 577 | { |
| 578 | elem_id = ptr[0]; |
| 579 | elem_len = ptr[1]; |
| 580 | left -= 2; |
| 581 | if(elem_len > left) |
| 582 | { |
| 583 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 584 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 586 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 587 | return eSIR_FAILURE; |
| 588 | } |
| 589 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 590 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 591 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 592 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 593 | tempLen += (elem_len + 2); |
| 594 | } |
| 595 | left -= elem_len; |
| 596 | ptr += (elem_len + 2); |
| 597 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 598 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 599 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 600 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 601 | } |
| 602 | return eSIR_SUCCESS; |
| 603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | |
| 605 | void |
| 606 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 607 | tSirMacAddr peerMacAddr, |
| 608 | tpAniSSID pSsid, |
| 609 | short nStaId, |
| 610 | tANI_U8 nKeepAlive, |
| 611 | tpPESession psessionEntry, |
| 612 | tANI_U8 probeReqP2pIe) |
| 613 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 614 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 615 | tSirRetStatus nSirStatus; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 616 | tANI_U32 cfg, nPayload, nStatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 617 | tpSirMacMgmtHdr pMacHdr; |
| 618 | tANI_U8 *pFrame; |
| 619 | void *pPacket; |
| 620 | eHalStatus halstatus; |
| 621 | tANI_U32 addnIEPresent; |
| 622 | tANI_U32 addnIE1Len=0; |
| 623 | tANI_U32 addnIE2Len=0; |
| 624 | tANI_U32 addnIE3Len=0; |
| 625 | tANI_U16 totalAddnIeLen = 0; |
| 626 | tANI_U32 wpsApEnable=0, tmp; |
| 627 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 628 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 629 | tANI_U8 *pP2pIe = NULL; |
| 630 | tANI_U8 noaLen = 0; |
| 631 | tANI_U8 total_noaLen = 0; |
| 632 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 634 | 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] | 635 | tDot11fIEExtCap extractedExtCap; |
| 636 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 637 | tANI_U32 nBytes = 0; |
| 638 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 639 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 640 | { |
| 641 | return; // in this case. |
| 642 | } |
| 643 | |
| 644 | if(NULL == psessionEntry) |
| 645 | { |
| 646 | return; |
| 647 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 648 | |
| 649 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 650 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 651 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 652 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 653 | return; |
| 654 | } |
| 655 | |
Girish Gowli | 0e82679 | 2014-05-17 17:56:44 +0530 | [diff] [blame] | 656 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 658 | // Fill out 'frm', after which we'll just hand the struct off to |
| 659 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 660 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 661 | |
| 662 | // Timestamp to be updated by TFP, below. |
| 663 | |
| 664 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 665 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 666 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 667 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 668 | } |
| 669 | else |
| 670 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 671 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 672 | if (eSIR_SUCCESS != nSirStatus) |
| 673 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 674 | 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] | 675 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 676 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 677 | return; |
| 678 | } |
| 679 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 681 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 682 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 683 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 684 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 685 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 686 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 687 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 688 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 692 | { |
| 693 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 694 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 695 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 696 | } |
| 697 | } |
| 698 | else |
| 699 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 700 | 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] | 701 | 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] | 702 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 703 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 704 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 705 | if (wpsApEnable) |
| 706 | { |
| 707 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 708 | } |
| 709 | |
| 710 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 711 | { |
| 712 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 713 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 714 | } |
| 715 | |
| 716 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 717 | { |
| 718 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 719 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 723 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 724 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 725 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 726 | |
| 727 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 728 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | |
| 730 | |
| 731 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 732 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 733 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 734 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 735 | |
| 736 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 737 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 738 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 739 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 740 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 741 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 742 | |
| 743 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 744 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 745 | * when operating in HT40 in 2.4GHz. |
| 746 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 747 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 748 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 749 | { |
| 750 | PopulateDot11fOBSSScanParameters( pMac, &pFrm->OBSSScanParameters, |
| 751 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 752 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 753 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 754 | * Mode in 40 MHz bit in HT capablity. |
| 755 | */ |
| 756 | pFrm->HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 757 | } |
| 758 | #endif |
| 759 | |
| 760 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
| 761 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 762 | #ifdef WLAN_FEATURE_11AC |
| 763 | if(psessionEntry->vhtCapability) |
| 764 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 765 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 766 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, eSIR_TRUE ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 767 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 768 | // we do not support multi users yet |
| 769 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
| 770 | } |
| 771 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 773 | |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 774 | if ( psessionEntry->pLimStartBssReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 775 | { |
| 776 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 777 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 778 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 779 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 780 | } |
| 781 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 782 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 783 | |
| 784 | #if defined(FEATURE_WLAN_WAPI) |
| 785 | if( psessionEntry->pLimStartBssReq ) |
| 786 | { |
| 787 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 788 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 789 | } |
| 790 | |
| 791 | #endif // defined(FEATURE_WLAN_WAPI) |
| 792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 793 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 795 | { |
| 796 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 797 | } |
| 798 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 799 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 800 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | { |
| 802 | |
| 803 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 804 | &addnIEPresent) != eSIR_SUCCESS) |
| 805 | { |
| 806 | 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] | 807 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 808 | return; |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | if (addnIEPresent) |
| 813 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 814 | |
| 815 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 816 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | { |
| 818 | PELOGE(limLog(pMac, LOGE, |
| 819 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 820 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 821 | return; |
| 822 | } |
| 823 | |
| 824 | //Probe rsp IE available |
| 825 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 826 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 827 | { |
| 828 | 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] | 829 | vos_mem_free(addIE); |
| 830 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | return; |
| 832 | } |
| 833 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 834 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 835 | { |
| 836 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 837 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 838 | &addnIE1Len) ) |
| 839 | { |
| 840 | limLog(pMac, LOGP, |
| 841 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 842 | vos_mem_free(addIE); |
| 843 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | return; |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | //Probe rsp IE available |
| 849 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 850 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 851 | { |
| 852 | 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] | 853 | vos_mem_free(addIE); |
| 854 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 855 | return; |
| 856 | } |
| 857 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 858 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 859 | { |
| 860 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 861 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 862 | &addnIE2Len) ) |
| 863 | { |
| 864 | limLog(pMac, LOGP, |
| 865 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 866 | vos_mem_free(addIE); |
| 867 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 868 | return; |
| 869 | } |
| 870 | } |
| 871 | |
| 872 | //Probe rsp IE available |
| 873 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 874 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 875 | { |
| 876 | 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] | 877 | vos_mem_free(addIE); |
| 878 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 879 | return; |
| 880 | } |
| 881 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 882 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 883 | { |
| 884 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 885 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 886 | &addIE[addnIE1Len + addnIE2Len], |
| 887 | &addnIE3Len) ) |
| 888 | { |
| 889 | limLog(pMac, LOGP, |
| 890 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 891 | vos_mem_free(addIE); |
| 892 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 893 | return; |
| 894 | } |
| 895 | } |
| 896 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 897 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 898 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 899 | { |
| 900 | limLog(pMac, LOGP, |
| 901 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 902 | vos_mem_free(addIE); |
| 903 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | return; |
| 905 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 906 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 907 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 908 | addIE, |
| 909 | &totalAddnIeLen, |
| 910 | &extractedExtCap ); |
| 911 | if(eSIR_SUCCESS != nSirStatus ) |
| 912 | { |
| 913 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 914 | limLog(pMac, LOG1, |
| 915 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 916 | } |
| 917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | nBytes = nBytes + totalAddnIeLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 919 | limLog(pMac, LOG1, |
| 920 | FL("probe rsp packet size is %d "), nBytes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 921 | if (probeReqP2pIe) |
| 922 | { |
| 923 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 924 | if (pP2pIe != NULL) |
| 925 | { |
| 926 | //get NoA attribute stream P2P IE |
| 927 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 928 | if (noaLen != 0) |
| 929 | { |
| 930 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 931 | &noaStream[0], noaLen); |
| 932 | nBytes = nBytes + total_noaLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 933 | limLog(pMac, LOG1, |
| 934 | FL("p2p probe rsp packet size is %d, noalength is %d"), |
| 935 | nBytes, total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 936 | } |
| 937 | } |
| 938 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 939 | } |
| 940 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 941 | /*merge ExtCap IE*/ |
| 942 | if (extractedExtCapFlag && extractedExtCap.present) |
| 943 | { |
| 944 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 945 | } |
| 946 | |
| 947 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 948 | if ( DOT11F_FAILED( nStatus ) ) |
| 949 | { |
| 950 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 951 | "or a Probe Response (0x%08x)."), |
| 952 | nStatus ); |
| 953 | // We'll fall back on the worst case scenario: |
| 954 | nPayload = sizeof( tDot11fProbeResponse ); |
| 955 | } |
| 956 | else if ( DOT11F_WARNED( nStatus ) ) |
| 957 | { |
| 958 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 959 | "the packed size for a Probe Response " |
| 960 | "(0x%08x)."), nStatus ); |
| 961 | } |
| 962 | |
| 963 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 965 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 966 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 967 | ( void** ) &pPacket ); |
| 968 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 969 | { |
| 970 | 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] | 971 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 972 | if ( addIE != NULL ) |
| 973 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 974 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 976 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 977 | return; |
| 978 | } |
| 979 | |
| 980 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 981 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | |
| 983 | // Next, we fill out the buffer descriptor: |
| 984 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 985 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 986 | if ( eSIR_SUCCESS != nSirStatus ) |
| 987 | { |
| 988 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 989 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | nSirStatus ); |
| 991 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 992 | ( void* ) pFrame, ( void* ) pPacket ); |
| 993 | if ( addIE != NULL ) |
| 994 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 995 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 996 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 997 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 998 | return; |
| 999 | } |
| 1000 | |
| 1001 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1002 | |
| 1003 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1004 | |
| 1005 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1006 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1007 | nPayload, &nPayload ); |
| 1008 | if ( DOT11F_FAILED( nStatus ) ) |
| 1009 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1010 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | nStatus ); |
| 1012 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1013 | if ( addIE != NULL ) |
| 1014 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1015 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1016 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1017 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1018 | return; // allocated! |
| 1019 | } |
| 1020 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1021 | { |
| 1022 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1023 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1024 | } |
| 1025 | |
| 1026 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1027 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1028 | |
| 1029 | pMac->sys.probeRespond++; |
| 1030 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1031 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1032 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1033 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1035 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | |
| 1037 | if ( addnIEPresent ) |
| 1038 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1039 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1041 | if (noaLen != 0) |
| 1042 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1043 | 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] | 1044 | { |
| 1045 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1046 | FL("Not able to insert NoA because of length constraint." |
| 1047 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1048 | vos_mem_free(addIE); |
| 1049 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1050 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1051 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1052 | return; |
| 1053 | } |
| 1054 | else |
| 1055 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1056 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1057 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1058 | } |
| 1059 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1060 | |
| 1061 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1062 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1063 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | ) |
| 1065 | { |
| 1066 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1067 | } |
| 1068 | |
| 1069 | // Queue Probe Response frame in high priority WQ |
| 1070 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1071 | ( tANI_U16 ) nBytes, |
| 1072 | HAL_TXRX_FRM_802_11_MGMT, |
| 1073 | ANI_TXDIR_TODS, |
| 1074 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1075 | limTxComplete, pFrame, txFlag ); |
| 1076 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1077 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1078 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1079 | //Pkt will be freed up by the callback |
| 1080 | } |
| 1081 | |
| 1082 | if ( addIE != NULL ) |
| 1083 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1084 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | } |
| 1086 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1087 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1088 | return; |
| 1089 | |
| 1090 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1091 | } // End limSendProbeRspMgmtFrame. |
| 1092 | |
| 1093 | void |
| 1094 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1095 | tSirMacAddr peerMacAddr, |
| 1096 | tSirAddtsReqInfo *pAddTS, |
| 1097 | tpPESession psessionEntry) |
| 1098 | { |
| 1099 | tANI_U16 i; |
| 1100 | tANI_U8 *pFrame; |
| 1101 | tSirRetStatus nSirStatus; |
| 1102 | tDot11fAddTSRequest AddTSReq; |
| 1103 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1104 | tANI_U32 nPayload, nBytes, nStatus; |
| 1105 | tpSirMacMgmtHdr pMacHdr; |
| 1106 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1107 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | tANI_U32 phyMode; |
| 1109 | #endif |
| 1110 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1111 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1112 | |
| 1113 | if(NULL == psessionEntry) |
| 1114 | { |
| 1115 | return; |
| 1116 | } |
| 1117 | |
| 1118 | if ( ! pAddTS->wmeTspecPresent ) |
| 1119 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1120 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | |
| 1122 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1123 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1124 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1125 | if ( pAddTS->lleTspecPresent ) |
| 1126 | { |
| 1127 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1128 | } |
| 1129 | else |
| 1130 | { |
| 1131 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1132 | } |
| 1133 | |
| 1134 | if ( pAddTS->lleTspecPresent ) |
| 1135 | { |
| 1136 | AddTSReq.num_WMMTCLAS = 0; |
| 1137 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1138 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1139 | { |
| 1140 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1141 | &AddTSReq.TCLAS[i] ); |
| 1142 | } |
| 1143 | } |
| 1144 | else |
| 1145 | { |
| 1146 | AddTSReq.num_TCLAS = 0; |
| 1147 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1148 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1149 | { |
| 1150 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1151 | &AddTSReq.WMMTCLAS[i] ); |
| 1152 | } |
| 1153 | } |
| 1154 | |
| 1155 | if ( pAddTS->tclasProcPresent ) |
| 1156 | { |
| 1157 | if ( pAddTS->lleTspecPresent ) |
| 1158 | { |
| 1159 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1160 | AddTSReq.TCLASSPROC.present = 1; |
| 1161 | } |
| 1162 | else |
| 1163 | { |
| 1164 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1165 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1166 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1167 | } |
| 1168 | } |
| 1169 | |
| 1170 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1171 | if ( DOT11F_FAILED( nStatus ) ) |
| 1172 | { |
| 1173 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1174 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1175 | nStatus ); |
| 1176 | // We'll fall back on the worst case scenario: |
| 1177 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1178 | } |
| 1179 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1180 | { |
| 1181 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1182 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1183 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1184 | } |
| 1185 | } |
| 1186 | else |
| 1187 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1188 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1189 | |
| 1190 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1191 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1192 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1193 | |
| 1194 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1195 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1196 | |
| 1197 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1198 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1199 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1200 | |
| 1201 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1202 | { |
| 1203 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1204 | } |
| 1205 | else |
| 1206 | { |
| 1207 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1208 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1209 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1210 | #endif |
| 1211 | // fillWmeTspecIE |
| 1212 | |
| 1213 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1214 | if ( DOT11F_FAILED( nStatus ) ) |
| 1215 | { |
| 1216 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1217 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1218 | nStatus ); |
| 1219 | // We'll fall back on the worst case scenario: |
| 1220 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1221 | } |
| 1222 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1223 | { |
| 1224 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1225 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1226 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1227 | } |
| 1228 | } |
| 1229 | |
| 1230 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1231 | |
| 1232 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1233 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1234 | ( void** ) &pPacket ); |
| 1235 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1236 | { |
| 1237 | 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] | 1238 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | return; |
| 1240 | } |
| 1241 | |
| 1242 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1243 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1244 | |
| 1245 | // Next, we fill out the buffer descriptor: |
| 1246 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1247 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1248 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1249 | { |
| 1250 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1251 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | nSirStatus ); |
| 1253 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1254 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1255 | return; |
| 1256 | } |
| 1257 | |
| 1258 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1259 | |
| 1260 | #if 0 |
| 1261 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1262 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1263 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1264 | { |
| 1265 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1266 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1267 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1268 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1269 | return; |
| 1270 | } |
| 1271 | #endif //TO SUPPORT BT-AMP |
| 1272 | |
| 1273 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1274 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1275 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1276 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1277 | #endif |
| 1278 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | // That done, pack the struct: |
| 1280 | if ( ! pAddTS->wmeTspecPresent ) |
| 1281 | { |
| 1282 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1283 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1284 | nPayload, &nPayload ); |
| 1285 | if ( DOT11F_FAILED( nStatus ) ) |
| 1286 | { |
| 1287 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1288 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1289 | nStatus ); |
| 1290 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1291 | return; // allocated! |
| 1292 | } |
| 1293 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1294 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1295 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1296 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1297 | } |
| 1298 | } |
| 1299 | else |
| 1300 | { |
| 1301 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1302 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1303 | nPayload, &nPayload ); |
| 1304 | if ( DOT11F_FAILED( nStatus ) ) |
| 1305 | { |
| 1306 | 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] | 1307 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1308 | nStatus ); |
| 1309 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1310 | return; // allocated! |
| 1311 | } |
| 1312 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1313 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1314 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1315 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | } |
| 1317 | } |
| 1318 | |
Abhishek Singh | 127a844 | 2014-12-15 17:31:27 +0530 | [diff] [blame] | 1319 | limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") ); |
| 1320 | limPrintMacAddr( pMac, peerMacAddr, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1321 | |
| 1322 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1324 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | ) |
| 1326 | { |
| 1327 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1328 | } |
| 1329 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1330 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1331 | psessionEntry->peSessionId, |
| 1332 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1333 | // Queue Addts Response frame in high priority WQ |
| 1334 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1335 | HAL_TXRX_FRM_802_11_MGMT, |
| 1336 | ANI_TXDIR_TODS, |
| 1337 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1338 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1339 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1340 | psessionEntry->peSessionId, |
| 1341 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1342 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1343 | { |
| 1344 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1345 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1346 | //Pkt will be freed up by the callback |
| 1347 | } |
| 1348 | |
| 1349 | } // End limSendAddtsReqActionFrame. |
| 1350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | |
| 1352 | |
| 1353 | void |
| 1354 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1355 | tANI_U16 statusCode, |
| 1356 | tANI_U16 aid, |
| 1357 | tSirMacAddr peerMacAddr, |
| 1358 | tANI_U8 subType, |
| 1359 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1360 | { |
| 1361 | static tDot11fAssocResponse frm; |
| 1362 | tANI_U8 *pFrame, *macAddr; |
| 1363 | tpSirMacMgmtHdr pMacHdr; |
| 1364 | tSirRetStatus nSirStatus; |
| 1365 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1366 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1367 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1368 | void *pPacket; |
| 1369 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1370 | tUpdateBeaconParams beaconParams; |
| 1371 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1372 | tANI_U32 addnIEPresent = false; |
| 1373 | tANI_U32 addnIELen=0; |
| 1374 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1375 | tpSirAssocReq pAssocReq = NULL; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1376 | tANI_U16 addStripoffIELen = 0; |
| 1377 | tDot11fIEExtCap extractedExtCap; |
| 1378 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1379 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1380 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1381 | #ifdef WLAN_FEATURE_11W |
| 1382 | tANI_U32 retryInterval; |
| 1383 | tANI_U32 maxRetries; |
| 1384 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1385 | |
| 1386 | if(NULL == psessionEntry) |
| 1387 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1388 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1389 | return; |
| 1390 | } |
| 1391 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1392 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1393 | |
| 1394 | limGetQosMode(psessionEntry, &qosMode); |
| 1395 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1396 | |
| 1397 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1398 | // STA sent a traffic spec. |
| 1399 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1400 | |
| 1401 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1402 | |
| 1403 | frm.Status.status = statusCode; |
| 1404 | |
| 1405 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1406 | |
| 1407 | if ( NULL == pSta ) |
| 1408 | { |
| 1409 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1410 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1411 | } |
| 1412 | else |
| 1413 | { |
| 1414 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1415 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1416 | } |
| 1417 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1419 | { |
| 1420 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1421 | { |
| 1422 | pAssocReq = |
| 1423 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1424 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1425 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1426 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1427 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1428 | } |
| 1429 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1430 | |
| 1431 | if ( NULL != pSta ) |
| 1432 | { |
| 1433 | if ( eHAL_SET == qosMode ) |
| 1434 | { |
| 1435 | if ( pSta->lleEnabled ) |
| 1436 | { |
| 1437 | lleMode = 1; |
| 1438 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1439 | { |
| 1440 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1441 | |
| 1442 | // FramesToDo:... |
| 1443 | // if ( fAddTS ) |
| 1444 | // { |
| 1445 | // tANI_U8 *pAf = pBody; |
| 1446 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1447 | // tANI_U32 tlen; |
| 1448 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1449 | // &tlen, bufLen - frameLen); |
| 1450 | // } // End if on Add TS. |
| 1451 | } |
| 1452 | } // End if on .11e enabled in 'pSta'. |
| 1453 | } // End if on QOS Mode on. |
| 1454 | |
| 1455 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1456 | { |
| 1457 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1458 | { |
| 1459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1460 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1461 | |
| 1462 | if ( pSta->wsmEnabled ) |
| 1463 | { |
| 1464 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1465 | } |
| 1466 | } |
| 1467 | } |
| 1468 | |
| 1469 | if ( pSta->aniPeer ) |
| 1470 | { |
| 1471 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1472 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1473 | { |
| 1474 | edcaInclude = 1; |
| 1475 | } |
| 1476 | |
| 1477 | } // End if on Airgo peer. |
| 1478 | |
| 1479 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1480 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1481 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1482 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Sachin Ahuja | c3a2623 | 2014-09-23 22:27:30 +0530 | [diff] [blame] | 1483 | /* |
| 1484 | *Check the STA capability and update the HTCaps accordingly |
| 1485 | */ |
| 1486 | frm.HTCaps.supportedChannelWidthSet = |
| 1487 | (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ? |
| 1488 | pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ; |
| 1489 | |
| 1490 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1491 | frm.HTCaps.shortGI40MHz = 0; |
| 1492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1493 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1494 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1495 | |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1496 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1497 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 1498 | * when operating in HT40 in 2.4GHz. |
| 1499 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 1500 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 1501 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1502 | { |
| 1503 | PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters, |
| 1504 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 1505 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 1506 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 1507 | * Mode in 40 MHz bit in HT capablity. |
| 1508 | */ |
| 1509 | frm.HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1510 | } |
| 1511 | #endif |
| 1512 | |
| 1513 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1514 | #ifdef WLAN_FEATURE_11AC |
| 1515 | if( pSta->mlmStaContext.vhtCapability && |
| 1516 | psessionEntry->vhtCapability ) |
| 1517 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1518 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 1519 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1520 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
| 1521 | } |
| 1522 | #endif |
| 1523 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1524 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1525 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1526 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1527 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1528 | &maxRetries ) != eSIR_SUCCESS ) |
| 1529 | limLog( pMac, LOGE, |
| 1530 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1531 | else |
| 1532 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1533 | &retryInterval ) != eSIR_SUCCESS) |
| 1534 | limLog( pMac, LOGE, |
| 1535 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1536 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1537 | PopulateDot11fTimeoutInterval( |
| 1538 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1539 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1540 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1541 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1542 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1543 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1544 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1545 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1547 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1548 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1549 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | |
| 1551 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1552 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1553 | |
| 1554 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1555 | |
| 1556 | //Send message to HAL about beacon parameter change. |
| 1557 | if(beaconParams.paramChangeBitmap) |
| 1558 | { |
| 1559 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1560 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1561 | } |
| 1562 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1563 | if ( pAssocReq != NULL ) |
| 1564 | { |
| 1565 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1566 | &addnIEPresent) != eSIR_SUCCESS) |
| 1567 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1568 | limLog(pMac, LOGP, FL("Unable to get " |
| 1569 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1570 | return; |
| 1571 | } |
| 1572 | |
| 1573 | if (addnIEPresent) |
| 1574 | { |
| 1575 | //Assoc rsp IE available |
| 1576 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1577 | &addnIELen) != eSIR_SUCCESS) |
| 1578 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1579 | limLog(pMac, LOGP, FL("Unable to get " |
| 1580 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1581 | return; |
| 1582 | } |
| 1583 | |
| 1584 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1585 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1586 | { |
| 1587 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1588 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1589 | { |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1590 | |
| 1591 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1592 | sizeof( tDot11fIEExtCap ), 0); |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 1593 | addStripoffIELen = addnIELen; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1594 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1595 | &addIE[0], |
| 1596 | &addStripoffIELen, |
| 1597 | &extractedExtCap ); |
| 1598 | if(eSIR_SUCCESS != nSirStatus) |
| 1599 | { |
| 1600 | limLog(pMac, LOG1, |
| 1601 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1602 | } |
| 1603 | else |
| 1604 | { |
| 1605 | addnIELen = addStripoffIELen; |
| 1606 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1607 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | nBytes = nBytes + addnIELen; |
| 1609 | } |
| 1610 | } |
| 1611 | } |
| 1612 | } |
| 1613 | |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1614 | /* merge the ExtCap struct*/ |
| 1615 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1616 | { |
| 1617 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap); |
| 1618 | } |
| 1619 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1620 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1621 | if ( DOT11F_FAILED( nStatus ) ) |
| 1622 | { |
| 1623 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1624 | "or an Association Response (0x%08x)."), |
| 1625 | nStatus ); |
| 1626 | return; |
| 1627 | } |
| 1628 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1629 | { |
| 1630 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1631 | "the packed size for an Association Re" |
| 1632 | "sponse (0x%08x)."), nStatus ); |
| 1633 | } |
| 1634 | |
| 1635 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1636 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1637 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1638 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1639 | ( void** ) &pPacket ); |
| 1640 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1641 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1642 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1643 | return; |
| 1644 | } |
| 1645 | |
| 1646 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1647 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1648 | |
| 1649 | // Next, we fill out the buffer descriptor: |
| 1650 | nSirStatus = limPopulateMacHeader( pMac, |
| 1651 | pFrame, |
| 1652 | SIR_MAC_MGMT_FRAME, |
| 1653 | ( LIM_ASSOC == subType ) ? |
| 1654 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1655 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1656 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1657 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1658 | { |
| 1659 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1660 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1661 | nSirStatus ); |
| 1662 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1663 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1664 | return; |
| 1665 | } |
| 1666 | |
| 1667 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1668 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1670 | |
| 1671 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1672 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1673 | nPayload, &nPayload ); |
| 1674 | if ( DOT11F_FAILED( nStatus ) ) |
| 1675 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1676 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1677 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1678 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1679 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1680 | return; // allocated! |
| 1681 | } |
| 1682 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1683 | { |
| 1684 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1685 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1686 | } |
| 1687 | |
| 1688 | macAddr = pMacHdr->da; |
| 1689 | |
| 1690 | if (subType == LIM_ASSOC) |
| 1691 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1692 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1693 | FL("*** Sending Assoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1694 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1695 | } |
| 1696 | else{ |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1697 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1699 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | } |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1701 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1702 | |
| 1703 | if ( addnIEPresent ) |
| 1704 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1705 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1706 | } |
| 1707 | |
| 1708 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1709 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1710 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1711 | ) |
| 1712 | { |
| 1713 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1714 | } |
| 1715 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1716 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1717 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1718 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1719 | |
| 1720 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1721 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1722 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1723 | psessionEntry->peSessionId, |
| 1724 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1725 | /// Queue Association Response frame in high priority WQ |
| 1726 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1727 | HAL_TXRX_FRM_802_11_MGMT, |
| 1728 | ANI_TXDIR_TODS, |
| 1729 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1730 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1731 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1732 | psessionEntry->peSessionId, |
| 1733 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1734 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1735 | { |
| 1736 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1737 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1738 | nSirStatus); |
| 1739 | |
| 1740 | //Pkt will be freed up by the callback |
| 1741 | } |
| 1742 | |
| 1743 | // update the ANI peer station count |
| 1744 | //FIXME_PROTECTION : take care of different type of station |
| 1745 | // counter inside this function. |
| 1746 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1747 | |
| 1748 | } // End limSendAssocRspMgmtFrame. |
| 1749 | |
| 1750 | |
| 1751 | |
| 1752 | void |
| 1753 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1754 | tSirMacAddr peer, |
| 1755 | tANI_U16 nStatusCode, |
| 1756 | tSirAddtsReqInfo *pAddTS, |
| 1757 | tSirMacScheduleIE *pSchedule, |
| 1758 | tpPESession psessionEntry) |
| 1759 | { |
| 1760 | tANI_U8 *pFrame; |
| 1761 | tpSirMacMgmtHdr pMacHdr; |
| 1762 | tDot11fAddTSResponse AddTSRsp; |
| 1763 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1764 | tSirRetStatus nSirStatus; |
| 1765 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1766 | void *pPacket; |
| 1767 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1768 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1769 | |
| 1770 | if(NULL == psessionEntry) |
| 1771 | { |
| 1772 | return; |
| 1773 | } |
| 1774 | |
| 1775 | if ( ! pAddTS->wmeTspecPresent ) |
| 1776 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1777 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1778 | |
| 1779 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1780 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1781 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1782 | AddTSRsp.Status.status = nStatusCode; |
| 1783 | |
| 1784 | // The TsDelay information element is only filled in for a specific |
| 1785 | // status code: |
| 1786 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1787 | { |
| 1788 | if ( pAddTS->wsmTspecPresent ) |
| 1789 | { |
| 1790 | AddTSRsp.WMMTSDelay.version = 1; |
| 1791 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1792 | AddTSRsp.WMMTSDelay.present = 1; |
| 1793 | } |
| 1794 | else |
| 1795 | { |
| 1796 | AddTSRsp.TSDelay.delay = 10; |
| 1797 | AddTSRsp.TSDelay.present = 1; |
| 1798 | } |
| 1799 | } |
| 1800 | |
| 1801 | if ( pAddTS->wsmTspecPresent ) |
| 1802 | { |
| 1803 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1804 | } |
| 1805 | else |
| 1806 | { |
| 1807 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1808 | } |
| 1809 | |
| 1810 | if ( pAddTS->wsmTspecPresent ) |
| 1811 | { |
| 1812 | AddTSRsp.num_WMMTCLAS = 0; |
| 1813 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1814 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1815 | { |
| 1816 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1817 | &AddTSRsp.TCLAS[i] ); |
| 1818 | } |
| 1819 | } |
| 1820 | else |
| 1821 | { |
| 1822 | AddTSRsp.num_TCLAS = 0; |
| 1823 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1824 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1825 | { |
| 1826 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1827 | &AddTSRsp.WMMTCLAS[i] ); |
| 1828 | } |
| 1829 | } |
| 1830 | |
| 1831 | if ( pAddTS->tclasProcPresent ) |
| 1832 | { |
| 1833 | if ( pAddTS->wsmTspecPresent ) |
| 1834 | { |
| 1835 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1836 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1837 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1838 | } |
| 1839 | else |
| 1840 | { |
| 1841 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1842 | AddTSRsp.TCLASSPROC.present = 1; |
| 1843 | } |
| 1844 | } |
| 1845 | |
| 1846 | // schedule element is included only if requested in the tspec and we are |
| 1847 | // using hcca (or both edca and hcca) |
| 1848 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1849 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1850 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1851 | // sta figure it out |
| 1852 | if ((pSchedule != NULL) && |
| 1853 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1854 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1855 | { |
| 1856 | if ( pAddTS->wsmTspecPresent ) |
| 1857 | { |
| 1858 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1859 | } |
| 1860 | else |
| 1861 | { |
| 1862 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1863 | } |
| 1864 | } |
| 1865 | |
| 1866 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1867 | if ( DOT11F_FAILED( nStatus ) ) |
| 1868 | { |
| 1869 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1870 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1871 | nStatus ); |
| 1872 | // We'll fall back on the worst case scenario: |
| 1873 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1874 | } |
| 1875 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1876 | { |
| 1877 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1878 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1879 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1880 | } |
| 1881 | } |
| 1882 | else |
| 1883 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1884 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1885 | |
| 1886 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1887 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1888 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1889 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1890 | |
| 1891 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1892 | |
| 1893 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1894 | if ( DOT11F_FAILED( nStatus ) ) |
| 1895 | { |
| 1896 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1897 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1898 | nStatus ); |
| 1899 | // We'll fall back on the worst case scenario: |
| 1900 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1901 | } |
| 1902 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1903 | { |
| 1904 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1905 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1906 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1907 | } |
| 1908 | } |
| 1909 | |
| 1910 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1911 | |
| 1912 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1913 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1914 | { |
| 1915 | 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] | 1916 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1917 | return; |
| 1918 | } |
| 1919 | |
| 1920 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1921 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | |
| 1923 | // Next, we fill out the buffer descriptor: |
| 1924 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1925 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1926 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1927 | { |
| 1928 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1929 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1930 | nSirStatus ); |
| 1931 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1932 | return; // allocated! |
| 1933 | } |
| 1934 | |
| 1935 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1936 | |
| 1937 | |
| 1938 | #if 0 |
| 1939 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1940 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1941 | { |
| 1942 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1943 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1944 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1945 | return; // allocated! |
| 1946 | } |
| 1947 | #endif //TO SUPPORT BT-AMP |
| 1948 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1949 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1950 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1951 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1952 | #endif |
| 1953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1954 | // That done, pack the struct: |
| 1955 | if ( ! pAddTS->wmeTspecPresent ) |
| 1956 | { |
| 1957 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1958 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1959 | nPayload, &nPayload ); |
| 1960 | if ( DOT11F_FAILED( nStatus ) ) |
| 1961 | { |
| 1962 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1963 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1964 | nStatus ); |
| 1965 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1966 | return; |
| 1967 | } |
| 1968 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1969 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1970 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1971 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1972 | } |
| 1973 | } |
| 1974 | else |
| 1975 | { |
| 1976 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1977 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1978 | nPayload, &nPayload ); |
| 1979 | if ( DOT11F_FAILED( nStatus ) ) |
| 1980 | { |
| 1981 | 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] | 1982 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1983 | nStatus ); |
| 1984 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1985 | return; |
| 1986 | } |
| 1987 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1988 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1989 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1990 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1991 | } |
| 1992 | } |
| 1993 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1994 | limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1995 | nStatusCode ); |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1996 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1997 | |
| 1998 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1999 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2000 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | ) |
| 2002 | { |
| 2003 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2004 | } |
| 2005 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2006 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2007 | psessionEntry->peSessionId, |
| 2008 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2009 | // Queue the frame in high priority WQ: |
| 2010 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2011 | HAL_TXRX_FRM_802_11_MGMT, |
| 2012 | ANI_TXDIR_TODS, |
| 2013 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2014 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2015 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2016 | psessionEntry->peSessionId, |
| 2017 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2018 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2019 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2020 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | nSirStatus ); |
| 2022 | //Pkt will be freed up by the callback |
| 2023 | } |
| 2024 | |
| 2025 | } // End limSendAddtsRspActionFrame. |
| 2026 | |
| 2027 | void |
| 2028 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 2029 | tSirMacAddr peer, |
| 2030 | tANI_U8 wmmTspecPresent, |
| 2031 | tSirMacTSInfo *pTsinfo, |
| 2032 | tSirMacTspecIE *pTspecIe, |
| 2033 | tpPESession psessionEntry) |
| 2034 | { |
| 2035 | tANI_U8 *pFrame; |
| 2036 | tpSirMacMgmtHdr pMacHdr; |
| 2037 | tDot11fDelTS DelTS; |
| 2038 | tDot11fWMMDelTS WMMDelTS; |
| 2039 | tSirRetStatus nSirStatus; |
| 2040 | tANI_U32 nBytes, nPayload, nStatus; |
| 2041 | void *pPacket; |
| 2042 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2043 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2044 | |
| 2045 | if(NULL == psessionEntry) |
| 2046 | { |
| 2047 | return; |
| 2048 | } |
| 2049 | |
| 2050 | if ( ! wmmTspecPresent ) |
| 2051 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2052 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | |
| 2054 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2055 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2056 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2057 | |
| 2058 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2059 | if ( DOT11F_FAILED( nStatus ) ) |
| 2060 | { |
| 2061 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2062 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | nStatus ); |
| 2064 | // We'll fall back on the worst case scenario: |
| 2065 | nPayload = sizeof( tDot11fDelTS ); |
| 2066 | } |
| 2067 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2068 | { |
| 2069 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2070 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2071 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | } |
| 2073 | } |
| 2074 | else |
| 2075 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2076 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2077 | |
| 2078 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2079 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2080 | WMMDelTS.DialogToken.token = 0; |
| 2081 | WMMDelTS.StatusCode.statusCode = 0; |
| 2082 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2083 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2084 | if ( DOT11F_FAILED( nStatus ) ) |
| 2085 | { |
| 2086 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2087 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2088 | nStatus ); |
| 2089 | // We'll fall back on the worst case scenario: |
| 2090 | nPayload = sizeof( tDot11fDelTS ); |
| 2091 | } |
| 2092 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2093 | { |
| 2094 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2095 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2096 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2097 | } |
| 2098 | } |
| 2099 | |
| 2100 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2101 | |
| 2102 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2103 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2104 | { |
| 2105 | 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] | 2106 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2107 | return; |
| 2108 | } |
| 2109 | |
| 2110 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2111 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2112 | |
| 2113 | // Next, we fill out the buffer descriptor: |
| 2114 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2115 | SIR_MAC_MGMT_ACTION, peer, |
| 2116 | psessionEntry->selfMacAddr); |
| 2117 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2118 | { |
| 2119 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2120 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2121 | nSirStatus ); |
| 2122 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2123 | return; // allocated! |
| 2124 | } |
| 2125 | |
| 2126 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2127 | |
| 2128 | #if 0 |
| 2129 | |
| 2130 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2131 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2132 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2133 | { |
| 2134 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2135 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2136 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2137 | return; // allocated! |
| 2138 | } |
| 2139 | #endif //TO SUPPORT BT-AMP |
| 2140 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2141 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2142 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2143 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2144 | #endif |
| 2145 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2146 | // That done, pack the struct: |
| 2147 | if ( !wmmTspecPresent ) |
| 2148 | { |
| 2149 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2150 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2151 | nPayload, &nPayload ); |
| 2152 | if ( DOT11F_FAILED( nStatus ) ) |
| 2153 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2154 | 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] | 2155 | nStatus ); |
| 2156 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2157 | return; // allocated! |
| 2158 | } |
| 2159 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2160 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2161 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2162 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2163 | } |
| 2164 | } |
| 2165 | else |
| 2166 | { |
| 2167 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2168 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2169 | nPayload, &nPayload ); |
| 2170 | if ( DOT11F_FAILED( nStatus ) ) |
| 2171 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2172 | 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] | 2173 | nStatus ); |
| 2174 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2175 | return; // allocated! |
| 2176 | } |
| 2177 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2178 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2179 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2180 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2181 | } |
| 2182 | } |
| 2183 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2184 | limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2185 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2186 | |
| 2187 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2189 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2190 | ) |
| 2191 | { |
| 2192 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2193 | } |
| 2194 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2195 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2196 | psessionEntry->peSessionId, |
| 2197 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2198 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2199 | HAL_TXRX_FRM_802_11_MGMT, |
| 2200 | ANI_TXDIR_TODS, |
| 2201 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2202 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2203 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2204 | psessionEntry->peSessionId, |
| 2205 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2206 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2207 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2208 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | nSirStatus ); |
| 2210 | //Pkt will be freed up by the callback |
| 2211 | } |
| 2212 | |
| 2213 | } // End limSendDeltsReqActionFrame. |
| 2214 | |
| 2215 | void |
| 2216 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2217 | tLimMlmAssocReq *pMlmAssocReq, |
| 2218 | tpPESession psessionEntry) |
| 2219 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2220 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2221 | tANI_U16 caps; |
| 2222 | tANI_U8 *pFrame; |
| 2223 | tSirRetStatus nSirStatus; |
| 2224 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2225 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2226 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2227 | void *pPacket; |
| 2228 | eHalStatus halstatus; |
| 2229 | tANI_U16 nAddIELen; |
| 2230 | tANI_U8 *pAddIE; |
| 2231 | tANI_U8 *wpsIe = NULL; |
| 2232 | #if defined WLAN_FEATURE_VOWIFI |
| 2233 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2234 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2235 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2236 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2237 | tDot11fIEExtCap extractedExtCap; |
| 2238 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2239 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2240 | |
| 2241 | if(NULL == psessionEntry) |
| 2242 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2243 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2244 | return; |
| 2245 | } |
| 2246 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | /* check this early to avoid unncessary operation */ |
| 2248 | if(NULL == psessionEntry->pLimJoinReq) |
| 2249 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2250 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | return; |
| 2252 | } |
| 2253 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2254 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2255 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2256 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2257 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2258 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2259 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2260 | return; |
| 2261 | } |
| 2262 | |
| 2263 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2264 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2265 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2266 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 2267 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
| 2268 | &nAddIELen, |
| 2269 | &extractedExtCap ); |
| 2270 | if(eSIR_SUCCESS != nSirStatus ) |
| 2271 | { |
| 2272 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2273 | limLog(pMac, LOG1, |
| 2274 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2275 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2276 | /* TODO:remove this code once driver provides the call back function |
| 2277 | * to supplicant for set_qos_map |
| 2278 | */ |
| 2279 | else |
| 2280 | { |
| 2281 | if(extractedExtCap.interworkingService) |
| 2282 | { |
| 2283 | extractedExtCap.qosMap = 1; |
| 2284 | } |
| 2285 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2287 | caps = pMlmAssocReq->capabilityInfo; |
| 2288 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2289 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2290 | #if defined(FEATURE_WLAN_WAPI) |
| 2291 | /* CR: 262463 : |
| 2292 | According to WAPI standard: |
| 2293 | 7.3.1.4 Capability Information field |
| 2294 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2295 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2296 | Reassociation management frames. */ |
| 2297 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2298 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2299 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2300 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2301 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2302 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2303 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2304 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2305 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2306 | |
| 2307 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2308 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2309 | |
| 2310 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2311 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2312 | |
| 2313 | // We prefer .11e asociations: |
| 2314 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2315 | |
| 2316 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2317 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2318 | |
| 2319 | if ( psessionEntry->lim11hEnable && |
| 2320 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2321 | { |
| 2322 | #if defined WLAN_FEATURE_VOWIFI |
| 2323 | PowerCapsPopulated = TRUE; |
| 2324 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2325 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2326 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2327 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2328 | |
| 2329 | } |
| 2330 | |
| 2331 | #if defined WLAN_FEATURE_VOWIFI |
| 2332 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2333 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2334 | { |
| 2335 | if (PowerCapsPopulated == FALSE) |
| 2336 | { |
| 2337 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2338 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2339 | } |
| 2340 | } |
| 2341 | #endif |
| 2342 | |
| 2343 | if ( fQosEnabled && |
| 2344 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2345 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2346 | |
| 2347 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2348 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2349 | |
| 2350 | #if defined WLAN_FEATURE_VOWIFI |
| 2351 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2352 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2353 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2354 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2355 | } |
| 2356 | #endif |
| 2357 | // The join request *should* contain zero or one of the WPA and RSN |
| 2358 | // IEs. The payload send along with the request is a |
| 2359 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2360 | |
| 2361 | // typedef struct sSirRSNie |
| 2362 | // { |
| 2363 | // tANI_U16 length; |
| 2364 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2365 | // } tSirRSNie, *tpSirRSNie; |
| 2366 | |
| 2367 | // So, we should be able to make the following two calls harmlessly, |
| 2368 | // since they do nothing if they don't find the given IE in the |
| 2369 | // bytestream with which they're provided. |
| 2370 | |
| 2371 | // The net effect of this will be to faithfully transmit whatever |
| 2372 | // security IE is in the join request. |
| 2373 | |
| 2374 | // *However*, if we're associating for the purpose of WPS |
| 2375 | // enrollment, and we've been configured to indicate that by |
| 2376 | // eliding the WPA or RSN IE, we just skip this: |
| 2377 | if( nAddIELen && pAddIE ) |
| 2378 | { |
| 2379 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2380 | } |
| 2381 | if ( NULL == wpsIe ) |
| 2382 | { |
| 2383 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2384 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2385 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2386 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | #if defined(FEATURE_WLAN_WAPI) |
| 2388 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2389 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2390 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2391 | } |
| 2392 | |
| 2393 | // include WME EDCA IE as well |
| 2394 | if ( fWmeEnabled ) |
| 2395 | { |
| 2396 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2397 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2398 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2399 | } |
| 2400 | |
| 2401 | if ( fWsmEnabled && |
| 2402 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2403 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2404 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2405 | } |
| 2406 | } |
| 2407 | |
| 2408 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2409 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2410 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2411 | pMac->lim.htCapabilityPresentInBeacon) |
| 2412 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2413 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2414 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2415 | |
| 2416 | /* |
| 2417 | * To resolve the interop problem with Broadcom AP, |
| 2418 | * where TQ STA could not pass traffic with GF enabled, |
| 2419 | * TQ STA will do Greenfield only with TQ AP, for |
| 2420 | * everybody else it will be turned off. |
| 2421 | */ |
| 2422 | |
| 2423 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2424 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2425 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2426 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2427 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2428 | } |
| 2429 | #endif |
| 2430 | |
| 2431 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2432 | #ifdef WLAN_FEATURE_11AC |
| 2433 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2434 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2435 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2436 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 2437 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2438 | } |
| 2439 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2440 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2441 | |
| 2442 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2443 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2444 | { |
| 2445 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2446 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2447 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2448 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2449 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2450 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2451 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2452 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2454 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2455 | { |
| 2456 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2457 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | } |
| 2459 | #endif |
| 2460 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2461 | #ifdef FEATURE_WLAN_ESE |
| 2462 | /* For ESE Associations fill the ESE IEs */ |
| 2463 | if (psessionEntry->isESEconnection && |
| 2464 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2466 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2467 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2468 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2469 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2470 | } |
| 2471 | #endif |
| 2472 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2473 | /* merge the ExtCap struct*/ |
| 2474 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2475 | { |
| 2476 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 2477 | } |
| 2478 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2479 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2480 | if ( DOT11F_FAILED( nStatus ) ) |
| 2481 | { |
| 2482 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2483 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2484 | nStatus ); |
| 2485 | // We'll fall back on the worst case scenario: |
| 2486 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2487 | } |
| 2488 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2489 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2490 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2491 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2492 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2493 | } |
| 2494 | |
| 2495 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2496 | |
| 2497 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2498 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2499 | ( void** ) &pPacket ); |
| 2500 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2501 | { |
| 2502 | 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] | 2503 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2504 | |
| 2505 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2506 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2507 | |
| 2508 | |
| 2509 | /* Update PE session id*/ |
| 2510 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2511 | |
| 2512 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2513 | |
| 2514 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2515 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2516 | |
| 2517 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2518 | ( tANI_U32* ) &mlmAssocCnf); |
| 2519 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2520 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2521 | return; |
| 2522 | } |
| 2523 | |
| 2524 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2525 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2526 | |
| 2527 | // Next, we fill out the buffer descriptor: |
| 2528 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2529 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2530 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2531 | { |
| 2532 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2533 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2534 | nSirStatus ); |
| 2535 | 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] | 2536 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2537 | return; |
| 2538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2539 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2540 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2541 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2542 | sizeof(tSirMacMgmtHdr), |
| 2543 | nPayload, &nPayload ); |
| 2544 | if ( DOT11F_FAILED( nStatus ) ) |
| 2545 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2546 | 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] | 2547 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2548 | nStatus ); |
| 2549 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2550 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2551 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | return; |
| 2553 | } |
| 2554 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2555 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2556 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2557 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2558 | } |
| 2559 | |
| 2560 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2561 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2562 | nBytes );) |
| 2563 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2564 | |
| 2565 | if( psessionEntry->assocReq != NULL ) |
| 2566 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2567 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2568 | psessionEntry->assocReq = NULL; |
| 2569 | } |
| 2570 | |
| 2571 | if( nAddIELen ) |
| 2572 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2573 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2574 | pAddIE, |
| 2575 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2576 | nPayload += nAddIELen; |
| 2577 | } |
| 2578 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2579 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2580 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2581 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2582 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2583 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2584 | } |
| 2585 | else |
| 2586 | { |
| 2587 | //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] | 2588 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2589 | psessionEntry->assocReqLen = nPayload; |
| 2590 | } |
| 2591 | |
| 2592 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2593 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2594 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2595 | ) |
| 2596 | { |
| 2597 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2598 | } |
| 2599 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2600 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2601 | { |
| 2602 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2603 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2604 | |
| 2605 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2606 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2607 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2608 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2609 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2610 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2611 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2612 | psessionEntry->peSessionId, |
| 2613 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 2614 | |
| 2615 | // enable caching |
| 2616 | WLANTL_EnableCaching(psessionEntry->staId); |
| 2617 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 2618 | if( ( psessionEntry->is11Gonly == true ) && |
| 2619 | ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){ |
| 2620 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2621 | } |
| 2622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2623 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2624 | HAL_TXRX_FRM_802_11_MGMT, |
| 2625 | ANI_TXDIR_TODS, |
| 2626 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2627 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2628 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2629 | psessionEntry->peSessionId, |
| 2630 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2631 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2632 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2633 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2634 | halstatus ); |
| 2635 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2636 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2637 | return; |
| 2638 | } |
| 2639 | |
| 2640 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2641 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2642 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2643 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2644 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2645 | } // End limSendAssocReqMgmtFrame |
| 2646 | |
| 2647 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2648 | #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] | 2649 | /*------------------------------------------------------------------------------------ |
| 2650 | * |
| 2651 | * Send Reassoc Req with FTIEs. |
| 2652 | * |
| 2653 | *----------------------------------------------------------------------------------- |
| 2654 | */ |
| 2655 | void |
| 2656 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2657 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2658 | { |
| 2659 | static tDot11fReAssocRequest frm; |
| 2660 | tANI_U16 caps; |
| 2661 | tANI_U8 *pFrame; |
| 2662 | tSirRetStatus nSirStatus; |
| 2663 | tANI_U32 nBytes, nPayload, nStatus; |
| 2664 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2665 | void *pPacket; |
| 2666 | eHalStatus halstatus; |
| 2667 | #if defined WLAN_FEATURE_VOWIFI |
| 2668 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2669 | #endif |
| 2670 | tANI_U16 ft_ies_length = 0; |
| 2671 | tANI_U8 *pBody; |
| 2672 | tANI_U16 nAddIELen; |
| 2673 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2674 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2675 | tANI_U8 *wpsIe = NULL; |
| 2676 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2677 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2678 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2679 | |
| 2680 | if (NULL == psessionEntry) |
| 2681 | { |
| 2682 | return; |
| 2683 | } |
| 2684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2685 | /* check this early to avoid unncessary operation */ |
| 2686 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2687 | { |
| 2688 | return; |
| 2689 | } |
| 2690 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2691 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2692 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2693 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2694 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2695 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | |
| 2697 | caps = pMlmReassocReq->capabilityInfo; |
| 2698 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2699 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2700 | #if defined(FEATURE_WLAN_WAPI) |
| 2701 | /* CR: 262463 : |
| 2702 | According to WAPI standard: |
| 2703 | 7.3.1.4 Capability Information field |
| 2704 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2705 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2706 | Reassociation management frames. */ |
| 2707 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2708 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2709 | #endif |
| 2710 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2711 | |
| 2712 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2713 | |
| 2714 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2715 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2717 | |
| 2718 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2719 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2720 | &frm.SuppRates,psessionEntry); |
| 2721 | |
| 2722 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2723 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2724 | |
| 2725 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2726 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2727 | |
| 2728 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2729 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2730 | |
| 2731 | if ( psessionEntry->lim11hEnable && |
| 2732 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2733 | { |
| 2734 | #if defined WLAN_FEATURE_VOWIFI |
| 2735 | PowerCapsPopulated = TRUE; |
| 2736 | |
| 2737 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2738 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2739 | #endif |
| 2740 | } |
| 2741 | |
| 2742 | #if defined WLAN_FEATURE_VOWIFI |
| 2743 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2744 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2745 | { |
| 2746 | if (PowerCapsPopulated == FALSE) |
| 2747 | { |
| 2748 | PowerCapsPopulated = TRUE; |
| 2749 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2750 | } |
| 2751 | } |
| 2752 | #endif |
| 2753 | |
| 2754 | if ( fQosEnabled && |
| 2755 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2756 | { |
| 2757 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2758 | } |
| 2759 | |
| 2760 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2761 | &frm.ExtSuppRates, psessionEntry ); |
| 2762 | |
| 2763 | #if defined WLAN_FEATURE_VOWIFI |
| 2764 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2765 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2766 | { |
| 2767 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2768 | } |
| 2769 | #endif |
| 2770 | |
| 2771 | // Ideally this should be enabled for 11r also. But 11r does |
| 2772 | // not follow the usual norm of using the Opaque object |
| 2773 | // for rsnie and fties. Instead we just add |
| 2774 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2775 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2776 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2777 | // |
| 2778 | // The join request *should* contain zero or one of the WPA and RSN |
| 2779 | // IEs. The payload send along with the request is a |
| 2780 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2781 | |
| 2782 | // typedef struct sSirRSNie |
| 2783 | // { |
| 2784 | // tANI_U16 length; |
| 2785 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2786 | // } tSirRSNie, *tpSirRSNie; |
| 2787 | |
| 2788 | // So, we should be able to make the following two calls harmlessly, |
| 2789 | // since they do nothing if they don't find the given IE in the |
| 2790 | // bytestream with which they're provided. |
| 2791 | |
| 2792 | // The net effect of this will be to faithfully transmit whatever |
| 2793 | // security IE is in the join request. |
| 2794 | |
| 2795 | // *However*, if we're associating for the purpose of WPS |
| 2796 | // enrollment, and we've been configured to indicate that by |
| 2797 | // eliding the WPA or RSN IE, we just skip this: |
| 2798 | if (!psessionEntry->is11Rconnection) |
| 2799 | { |
| 2800 | if( nAddIELen && pAddIE ) |
| 2801 | { |
| 2802 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2803 | } |
| 2804 | if ( NULL == wpsIe ) |
| 2805 | { |
| 2806 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2807 | &frm.RSNOpaque ); |
| 2808 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2809 | &frm.WPAOpaque ); |
| 2810 | } |
| 2811 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2812 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2813 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2814 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2815 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2816 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2817 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2818 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2819 | } |
| 2820 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2821 | #ifdef FEATURE_WLAN_ESE |
| 2822 | // For ESE Associations fill the ESE IEs |
| 2823 | if (psessionEntry->isESEconnection && |
| 2824 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2825 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2826 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2827 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2828 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2829 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2830 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2831 | #endif //FEATURE_WLAN_ESE |
| 2832 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | |
| 2834 | // include WME EDCA IE as well |
| 2835 | if ( fWmeEnabled ) |
| 2836 | { |
| 2837 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2838 | { |
| 2839 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2840 | } |
| 2841 | |
| 2842 | if ( fWsmEnabled && |
| 2843 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2844 | { |
| 2845 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2846 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2847 | #ifdef FEATURE_WLAN_ESE |
| 2848 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2849 | { |
| 2850 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2851 | |
| 2852 | // 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] | 2853 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2854 | { |
| 2855 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2856 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2857 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2858 | |
| 2859 | tsrsIE.tsid = 0; |
| 2860 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2861 | { |
| 2862 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2863 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2864 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2865 | { |
| 2866 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2867 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2868 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2869 | } |
| 2870 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2871 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2872 | } |
| 2873 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2874 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2875 | pMac->lim.htCapabilityPresentInBeacon) |
| 2876 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2877 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2878 | } |
| 2879 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2880 | #if defined WLAN_FEATURE_VOWIFI_11R |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 2881 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && |
| 2882 | (pMac->ft.ftSmeContext.addMDIE == TRUE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2883 | #if defined FEATURE_WLAN_ESE |
| 2884 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2885 | #endif |
| 2886 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2887 | { |
| 2888 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2889 | } |
| 2890 | #endif |
| 2891 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2892 | #ifdef WLAN_FEATURE_11AC |
| 2893 | if ( psessionEntry->vhtCapability && |
| 2894 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2895 | { |
| 2896 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 2897 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_FALSE ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2898 | } |
| 2899 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2900 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2901 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2902 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2903 | if ( DOT11F_FAILED( nStatus ) ) |
| 2904 | { |
| 2905 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2906 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2907 | nStatus ); |
| 2908 | // We'll fall back on the worst case scenario: |
| 2909 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2910 | } |
| 2911 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2912 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2913 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2914 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2915 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2916 | } |
| 2917 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2918 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2919 | |
| 2920 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2921 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2922 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2923 | #endif |
| 2924 | |
| 2925 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2926 | if (psessionEntry->is11Rconnection) |
| 2927 | { |
| 2928 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2929 | } |
| 2930 | #endif |
| 2931 | |
| 2932 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2933 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2934 | ( void** ) &pPacket ); |
| 2935 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2936 | { |
| 2937 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2938 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2939 | 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] | 2940 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2941 | goto end; |
| 2942 | } |
| 2943 | |
| 2944 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2945 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2946 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2947 | #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] | 2948 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2949 | #endif |
| 2950 | // Next, we fill out the buffer descriptor: |
| 2951 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2952 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2953 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2954 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2955 | { |
| 2956 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2957 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2958 | nSirStatus ); |
| 2959 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2960 | goto end; |
| 2961 | } |
| 2962 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2963 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2964 | // That done, pack the ReAssoc Request: |
| 2965 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2966 | sizeof(tSirMacMgmtHdr), |
| 2967 | nPayload, &nPayload ); |
| 2968 | if ( DOT11F_FAILED( nStatus ) ) |
| 2969 | { |
| 2970 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2971 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2972 | nStatus ); |
| 2973 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2974 | goto end; |
| 2975 | } |
| 2976 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2977 | { |
| 2978 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2979 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | } |
| 2981 | |
| 2982 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2983 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2984 | nBytes, nPayload );) |
| 2985 | if( psessionEntry->assocReq != NULL ) |
| 2986 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2987 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2988 | psessionEntry->assocReq = NULL; |
| 2989 | } |
| 2990 | |
| 2991 | if( nAddIELen ) |
| 2992 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2993 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2994 | pAddIE, |
| 2995 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2996 | nPayload += nAddIELen; |
| 2997 | } |
| 2998 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2999 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3000 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3001 | { |
| 3002 | 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] | 3003 | } |
| 3004 | else |
| 3005 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3006 | //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] | 3007 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3008 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3009 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3010 | |
| 3011 | if (psessionEntry->is11Rconnection) |
| 3012 | { |
| 3013 | { |
| 3014 | int i = 0; |
| 3015 | |
| 3016 | pBody = pFrame + nBytes; |
| 3017 | for (i=0; i<ft_ies_length; i++) |
| 3018 | { |
| 3019 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 3020 | pBody++; |
| 3021 | } |
| 3022 | } |
| 3023 | } |
| 3024 | |
| 3025 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3026 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 3027 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3028 | (tANI_U8 *)pFrame, |
| 3029 | (nBytes + ft_ies_length));) |
| 3030 | #endif |
| 3031 | |
| 3032 | |
| 3033 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3034 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3035 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3036 | ) |
| 3037 | { |
| 3038 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3039 | } |
| 3040 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3041 | if( NULL != psessionEntry->assocReq ) |
| 3042 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3043 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3044 | psessionEntry->assocReq = NULL; |
| 3045 | } |
| 3046 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3047 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3048 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3049 | { |
| 3050 | 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] | 3051 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3052 | } |
| 3053 | else |
| 3054 | { |
| 3055 | //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] | 3056 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3057 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3058 | psessionEntry->assocReqLen = (ft_ies_length); |
| 3059 | } |
| 3060 | |
| 3061 | |
Mihir Shete | 63561c8 | 2014-08-23 16:58:07 +0530 | [diff] [blame] | 3062 | // Enable TL cahching in case of roaming |
| 3063 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3064 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3065 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3066 | psessionEntry->peSessionId, |
| 3067 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3068 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3069 | HAL_TXRX_FRM_802_11_MGMT, |
| 3070 | ANI_TXDIR_TODS, |
| 3071 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3072 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3073 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3074 | psessionEntry->peSessionId, |
| 3075 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3076 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3077 | { |
| 3078 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3079 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3080 | nSirStatus ); |
| 3081 | //Pkt will be freed up by the callback |
| 3082 | goto end; |
| 3083 | } |
| 3084 | |
| 3085 | end: |
| 3086 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3087 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3088 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3089 | |
| 3090 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3091 | |
| 3092 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3093 | tLimMlmReassocReq *pMlmReassocReq, |
| 3094 | tpPESession psessionEntry) |
| 3095 | { |
| 3096 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3097 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 3098 | if(NULL == pTmpMlmReassocReq) |
| 3099 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3100 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3101 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3102 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3103 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3104 | } |
| 3105 | |
| 3106 | // Prepare and send Reassociation request frame |
| 3107 | // start reassoc timer. |
| 3108 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3109 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3110 | 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] | 3111 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3112 | != TX_SUCCESS) |
| 3113 | { |
| 3114 | // Could not start reassoc failure timer. |
| 3115 | // Log error |
| 3116 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3117 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3118 | // Return Reassoc confirm with |
| 3119 | // Resources Unavailable |
| 3120 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3121 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3122 | goto end; |
| 3123 | } |
| 3124 | |
| 3125 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3126 | return; |
| 3127 | |
| 3128 | end: |
| 3129 | // Free up buffer allocated for reassocReq |
| 3130 | if (pMlmReassocReq != NULL) |
| 3131 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3132 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3133 | pMlmReassocReq = NULL; |
| 3134 | } |
| 3135 | if (pTmpMlmReassocReq != NULL) |
| 3136 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3137 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3138 | pTmpMlmReassocReq = NULL; |
| 3139 | } |
| 3140 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3141 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3142 | /* Update PE sessio Id*/ |
| 3143 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3144 | |
| 3145 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3146 | } |
| 3147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3148 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3149 | |
| 3150 | |
| 3151 | void |
| 3152 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3153 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3154 | { |
| 3155 | static tDot11fReAssocRequest frm; |
| 3156 | tANI_U16 caps; |
| 3157 | tANI_U8 *pFrame; |
| 3158 | tSirRetStatus nSirStatus; |
| 3159 | tANI_U32 nBytes, nPayload, nStatus; |
| 3160 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3161 | void *pPacket; |
| 3162 | eHalStatus halstatus; |
| 3163 | tANI_U16 nAddIELen; |
| 3164 | tANI_U8 *pAddIE; |
| 3165 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3166 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3167 | #if defined WLAN_FEATURE_VOWIFI |
| 3168 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3169 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3170 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3171 | |
| 3172 | if(NULL == psessionEntry) |
| 3173 | { |
| 3174 | return; |
| 3175 | } |
| 3176 | |
| 3177 | /* check this early to avoid unncessary operation */ |
| 3178 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3179 | { |
| 3180 | return; |
| 3181 | } |
| 3182 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3183 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3184 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3185 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3186 | |
| 3187 | caps = pMlmReassocReq->capabilityInfo; |
| 3188 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3189 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3190 | #if defined(FEATURE_WLAN_WAPI) |
| 3191 | /* CR: 262463 : |
| 3192 | According to WAPI standard: |
| 3193 | 7.3.1.4 Capability Information field |
| 3194 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3195 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3196 | Reassociation management frames. */ |
| 3197 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3198 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3199 | #endif |
| 3200 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3201 | |
| 3202 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3203 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3204 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3205 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3206 | |
| 3207 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3208 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3209 | &frm.SuppRates,psessionEntry); |
| 3210 | |
| 3211 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3212 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3213 | |
| 3214 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3215 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3216 | |
| 3217 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3218 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3219 | |
| 3220 | |
| 3221 | if ( psessionEntry->lim11hEnable && |
| 3222 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3223 | { |
| 3224 | #if defined WLAN_FEATURE_VOWIFI |
| 3225 | PowerCapsPopulated = TRUE; |
| 3226 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3227 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3228 | #endif |
| 3229 | } |
| 3230 | |
| 3231 | #if defined WLAN_FEATURE_VOWIFI |
| 3232 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3233 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3234 | { |
| 3235 | if (PowerCapsPopulated == FALSE) |
| 3236 | { |
| 3237 | PowerCapsPopulated = TRUE; |
| 3238 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3239 | } |
| 3240 | } |
| 3241 | #endif |
| 3242 | |
| 3243 | if ( fQosEnabled && |
| 3244 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3245 | { |
| 3246 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3247 | } |
| 3248 | |
| 3249 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3250 | &frm.ExtSuppRates, psessionEntry ); |
| 3251 | |
| 3252 | #if defined WLAN_FEATURE_VOWIFI |
| 3253 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3254 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3255 | { |
| 3256 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3257 | } |
| 3258 | #endif |
| 3259 | // The join request *should* contain zero or one of the WPA and RSN |
| 3260 | // IEs. The payload send along with the request is a |
| 3261 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3262 | |
| 3263 | // typedef struct sSirRSNie |
| 3264 | // { |
| 3265 | // tANI_U16 length; |
| 3266 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3267 | // } tSirRSNie, *tpSirRSNie; |
| 3268 | |
| 3269 | // So, we should be able to make the following two calls harmlessly, |
| 3270 | // since they do nothing if they don't find the given IE in the |
| 3271 | // bytestream with which they're provided. |
| 3272 | |
| 3273 | // The net effect of this will be to faithfully transmit whatever |
| 3274 | // security IE is in the join request. |
| 3275 | |
| 3276 | // *However*, if we're associating for the purpose of WPS |
| 3277 | // enrollment, and we've been configured to indicate that by |
| 3278 | // eliding the WPA or RSN IE, we just skip this: |
| 3279 | if( nAddIELen && pAddIE ) |
| 3280 | { |
| 3281 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3282 | } |
| 3283 | if ( NULL == wpsIe ) |
| 3284 | { |
| 3285 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3286 | &frm.RSNOpaque ); |
| 3287 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3288 | &frm.WPAOpaque ); |
| 3289 | #if defined(FEATURE_WLAN_WAPI) |
| 3290 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3291 | &frm.WAPIOpaque ); |
| 3292 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3293 | } |
| 3294 | |
| 3295 | // include WME EDCA IE as well |
| 3296 | if ( fWmeEnabled ) |
| 3297 | { |
| 3298 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3299 | { |
| 3300 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3301 | } |
| 3302 | |
| 3303 | if ( fWsmEnabled && |
| 3304 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3305 | { |
| 3306 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3307 | } |
| 3308 | } |
| 3309 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3310 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3311 | pMac->lim.htCapabilityPresentInBeacon) |
| 3312 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3313 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3314 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3315 | #ifdef WLAN_FEATURE_11AC |
| 3316 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3317 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3318 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3319 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 3320 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_FALSE ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3321 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3322 | } |
| 3323 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3324 | |
| 3325 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3326 | if ( DOT11F_FAILED( nStatus ) ) |
| 3327 | { |
| 3328 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3329 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3330 | nStatus ); |
| 3331 | // We'll fall back on the worst case scenario: |
| 3332 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3333 | } |
| 3334 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3335 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3336 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3337 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3338 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3339 | } |
| 3340 | |
| 3341 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3342 | |
| 3343 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3344 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3345 | ( void** ) &pPacket ); |
| 3346 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3347 | { |
| 3348 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3349 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3350 | 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] | 3351 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3352 | goto end; |
| 3353 | } |
| 3354 | |
| 3355 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3356 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3357 | |
| 3358 | // Next, we fill out the buffer descriptor: |
| 3359 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3360 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3361 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3362 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3363 | { |
| 3364 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3365 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3366 | nSirStatus ); |
| 3367 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3368 | goto end; |
| 3369 | } |
| 3370 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3371 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3372 | // That done, pack the Probe Request: |
| 3373 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3374 | sizeof(tSirMacMgmtHdr), |
| 3375 | nPayload, &nPayload ); |
| 3376 | if ( DOT11F_FAILED( nStatus ) ) |
| 3377 | { |
| 3378 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3379 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | nStatus ); |
| 3381 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3382 | goto end; |
| 3383 | } |
| 3384 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3385 | { |
| 3386 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3387 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | } |
| 3389 | |
| 3390 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3391 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3392 | nBytes );) |
| 3393 | |
| 3394 | if( psessionEntry->assocReq != NULL ) |
| 3395 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3396 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | psessionEntry->assocReq = NULL; |
| 3398 | } |
| 3399 | |
| 3400 | if( nAddIELen ) |
| 3401 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3402 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3403 | pAddIE, |
| 3404 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3405 | nPayload += nAddIELen; |
| 3406 | } |
| 3407 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3408 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3409 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3410 | { |
| 3411 | 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] | 3412 | } |
| 3413 | else |
| 3414 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3415 | //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] | 3416 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3417 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3419 | |
| 3420 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3421 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3422 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3423 | ) |
| 3424 | { |
| 3425 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3426 | } |
| 3427 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3428 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3429 | { |
| 3430 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3431 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3432 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3433 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3434 | psessionEntry->peSessionId, |
| 3435 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 3436 | |
| 3437 | // enable caching |
| 3438 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3440 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3441 | HAL_TXRX_FRM_802_11_MGMT, |
| 3442 | ANI_TXDIR_TODS, |
| 3443 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3444 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3445 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3446 | psessionEntry->peSessionId, |
| 3447 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3448 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3449 | { |
| 3450 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3451 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3452 | nSirStatus ); |
| 3453 | //Pkt will be freed up by the callback |
| 3454 | goto end; |
| 3455 | } |
| 3456 | |
| 3457 | end: |
| 3458 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3459 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3460 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3461 | |
| 3462 | } // limSendReassocReqMgmtFrame |
| 3463 | |
| 3464 | /** |
| 3465 | * \brief Send an Authentication frame |
| 3466 | * |
| 3467 | * |
| 3468 | * \param pMac Pointer to Global MAC structure |
| 3469 | * |
| 3470 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3471 | * to be sent |
| 3472 | * |
| 3473 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3474 | * frame is destined |
| 3475 | * |
| 3476 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3477 | * Authentication frame3 |
| 3478 | * |
| 3479 | * |
| 3480 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3481 | * is formatted and sent when this function is called. |
| 3482 | * |
| 3483 | * |
| 3484 | */ |
| 3485 | |
| 3486 | void |
| 3487 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3488 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3489 | tSirMacAddr peerMacAddr, |
| 3490 | tANI_U8 wepBit, |
| 3491 | tpPESession psessionEntry |
| 3492 | ) |
| 3493 | { |
| 3494 | tANI_U8 *pFrame, *pBody; |
| 3495 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3496 | tpSirMacMgmtHdr pMacHdr; |
| 3497 | tANI_U16 i; |
| 3498 | void *pPacket; |
| 3499 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3500 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3501 | |
| 3502 | if(NULL == psessionEntry) |
| 3503 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3504 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3505 | return; |
| 3506 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3507 | |
| 3508 | limLog(pMac, LOG1, |
| 3509 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3510 | pAuthFrameBody->authTransactionSeqNumber, |
| 3511 | pAuthFrameBody->authStatusCode, |
| 3512 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3513 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3514 | if (wepBit == LIM_WEP_IN_FC) |
| 3515 | { |
| 3516 | /// Auth frame3 to be sent with encrypted framebody |
| 3517 | /** |
| 3518 | * Allocate buffer for Authenticaton frame of size equal |
| 3519 | * to management frame header length plus 2 bytes each for |
| 3520 | * auth algorithm number, transaction number, status code, |
| 3521 | * 128 bytes for challenge text and 4 bytes each for |
| 3522 | * IV & ICV. |
| 3523 | */ |
| 3524 | |
| 3525 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3526 | |
| 3527 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3528 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3529 | else |
| 3530 | { |
| 3531 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3532 | { |
| 3533 | case SIR_MAC_AUTH_FRAME_1: |
| 3534 | /** |
| 3535 | * Allocate buffer for Authenticaton frame of size |
| 3536 | * equal to management frame header length plus 2 bytes |
| 3537 | * each for auth algorithm number, transaction number |
| 3538 | * and status code. |
| 3539 | */ |
| 3540 | |
| 3541 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3542 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3543 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3544 | |
| 3545 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3546 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3547 | { |
| 3548 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3549 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3550 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3551 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3552 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3553 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3554 | else |
| 3555 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3556 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3557 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3558 | frameLen += (2+SIR_MDIE_SIZE); |
| 3559 | } |
| 3560 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3561 | #endif |
| 3562 | break; |
| 3563 | |
| 3564 | case SIR_MAC_AUTH_FRAME_2: |
| 3565 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3566 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3567 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3568 | { |
| 3569 | /** |
| 3570 | * Allocate buffer for Authenticaton frame of size |
| 3571 | * equal to management frame header length plus |
| 3572 | * 2 bytes each for auth algorithm number, |
| 3573 | * transaction number and status code. |
| 3574 | */ |
| 3575 | |
| 3576 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3577 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3578 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3579 | } |
| 3580 | else |
| 3581 | { |
| 3582 | // Shared Key algorithm with challenge text |
| 3583 | // to be sent |
| 3584 | /** |
| 3585 | * Allocate buffer for Authenticaton frame of size |
| 3586 | * equal to management frame header length plus |
| 3587 | * 2 bytes each for auth algorithm number, |
| 3588 | * transaction number, status code and 128 bytes |
| 3589 | * for challenge text. |
| 3590 | */ |
| 3591 | |
| 3592 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3593 | sizeof(tSirMacAuthFrame); |
| 3594 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3595 | } |
| 3596 | |
| 3597 | break; |
| 3598 | |
| 3599 | case SIR_MAC_AUTH_FRAME_3: |
| 3600 | /// Auth frame3 to be sent without encrypted framebody |
| 3601 | /** |
| 3602 | * Allocate buffer for Authenticaton frame of size equal |
| 3603 | * to management frame header length plus 2 bytes each |
| 3604 | * for auth algorithm number, transaction number and |
| 3605 | * status code. |
| 3606 | */ |
| 3607 | |
| 3608 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3609 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3610 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3611 | |
| 3612 | break; |
| 3613 | |
| 3614 | case SIR_MAC_AUTH_FRAME_4: |
| 3615 | /** |
| 3616 | * Allocate buffer for Authenticaton frame of size equal |
| 3617 | * to management frame header length plus 2 bytes each |
| 3618 | * for auth algorithm number, transaction number and |
| 3619 | * status code. |
| 3620 | */ |
| 3621 | |
| 3622 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3623 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3624 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3625 | |
| 3626 | break; |
| 3627 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3628 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3629 | |
| 3630 | |
| 3631 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3632 | |
| 3633 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3634 | { |
| 3635 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3636 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3637 | |
| 3638 | return; |
| 3639 | } |
| 3640 | |
| 3641 | for (i = 0; i < frameLen; i++) |
| 3642 | pFrame[i] = 0; |
| 3643 | |
| 3644 | // Prepare BD |
| 3645 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3646 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3647 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3648 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3649 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3651 | return; |
| 3652 | } |
| 3653 | |
| 3654 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3655 | pMacHdr->fc.wep = wepBit; |
| 3656 | |
| 3657 | // Prepare BSSId |
| 3658 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3659 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3660 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3661 | (tANI_U8 *) psessionEntry->bssId, |
| 3662 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3663 | } |
| 3664 | |
| 3665 | /// Prepare Authentication frame body |
| 3666 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3667 | |
| 3668 | if (wepBit == LIM_WEP_IN_FC) |
| 3669 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3670 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3671 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3672 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3673 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3674 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3675 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3676 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3678 | } |
| 3679 | else |
| 3680 | { |
| 3681 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3682 | pBody += sizeof(tANI_U16); |
| 3683 | bodyLen -= sizeof(tANI_U16); |
| 3684 | |
| 3685 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3686 | pBody += sizeof(tANI_U16); |
| 3687 | bodyLen -= sizeof(tANI_U16); |
| 3688 | |
| 3689 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3690 | pBody += sizeof(tANI_U16); |
| 3691 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3692 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3693 | sizeof (pAuthFrameBody->length) + |
| 3694 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3695 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3696 | |
| 3697 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3698 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3699 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3700 | { |
| 3701 | |
| 3702 | { |
| 3703 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3704 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3705 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3706 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3707 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3708 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3709 | (tANI_U8 *)pBody, |
| 3710 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3711 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3712 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3713 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3714 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3715 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3716 | } |
| 3717 | } |
| 3718 | else |
| 3719 | { |
| 3720 | /* MDID attr is 54*/ |
| 3721 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3722 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3723 | *pBody = SIR_MDIE_SIZE; |
| 3724 | pBody++; |
| 3725 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3726 | { |
| 3727 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3728 | pBody++; |
| 3729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3730 | } |
| 3731 | } |
| 3732 | } |
| 3733 | #endif |
| 3734 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3735 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3736 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3737 | pAuthFrameBody->authTransactionSeqNumber, |
| 3738 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3739 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3740 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3741 | } |
| 3742 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3743 | |
| 3744 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3745 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3746 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3747 | #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] | 3748 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3749 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3750 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3751 | ) |
| 3752 | { |
| 3753 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3754 | } |
| 3755 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3756 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3757 | { |
| 3758 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3759 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3760 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 3761 | limLog( pMac, LOG1, FL("Sending Auth Frame over WQ5 to "MAC_ADDRESS_STR |
| 3762 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 3763 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3764 | |
| 3765 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3766 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3767 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3768 | psessionEntry->peSessionId, |
| 3769 | pMacHdr->fc.subType)); |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 3770 | |
| 3771 | if( ( psessionEntry->is11Gonly == true ) && |
| 3772 | ( !IS_BROADCAST_MAC(peerMacAddr) ) ){ |
| 3773 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3774 | } |
| 3775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3776 | /// Queue Authentication frame in high priority WQ |
| 3777 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3778 | HAL_TXRX_FRM_802_11_MGMT, |
| 3779 | ANI_TXDIR_TODS, |
| 3780 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3781 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3782 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3783 | psessionEntry->peSessionId, |
| 3784 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3785 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3786 | { |
| 3787 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3788 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3789 | halstatus); |
| 3790 | |
| 3791 | //Pkt will be freed up by the callback |
| 3792 | } |
| 3793 | |
| 3794 | return; |
| 3795 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3796 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3797 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3798 | { |
| 3799 | tANI_U16 aid; |
| 3800 | tpDphHashNode pStaDs; |
| 3801 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3802 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3803 | tpPESession psessionEntry; |
| 3804 | |
| 3805 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3806 | if (pMlmDeauthReq) |
| 3807 | { |
| 3808 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3809 | { |
| 3810 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3811 | } |
| 3812 | |
| 3813 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3814 | { |
| 3815 | |
| 3816 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3817 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3818 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3819 | goto end; |
| 3820 | } |
| 3821 | |
| 3822 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3823 | if (pStaDs == NULL) |
| 3824 | { |
| 3825 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3826 | goto end; |
| 3827 | } |
| 3828 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3829 | /// Receive path cleanup with dummy packet |
| 3830 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3831 | |
| 3832 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3833 | if ( psessionEntry->limSystemRole == eLIM_STA_ROLE ) |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3834 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3835 | PELOGE(limLog(pMac, LOG1, |
| 3836 | FL("FT Preauth SessionId %d Cleanup" |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3837 | #ifdef FEATURE_WLAN_ESE |
| 3838 | " isESE %d" |
| 3839 | #endif |
| 3840 | #ifdef FEATURE_WLAN_LFR |
| 3841 | " isLFR %d" |
| 3842 | #endif |
| 3843 | " is11r %d, Deauth reason %d Trigger = %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3844 | psessionEntry->peSessionId, |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3845 | #ifdef FEATURE_WLAN_ESE |
| 3846 | psessionEntry->isESEconnection, |
| 3847 | #endif |
| 3848 | #ifdef FEATURE_WLAN_LFR |
| 3849 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3850 | #endif |
| 3851 | psessionEntry->is11Rconnection, |
| 3852 | pMlmDeauthReq->reasonCode, |
| 3853 | pMlmDeauthReq->deauthTrigger);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3854 | |
| 3855 | limFTCleanup(pMac); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3856 | } |
| 3857 | #endif |
| 3858 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3859 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3860 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3861 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3862 | } |
| 3863 | return eHAL_STATUS_SUCCESS; |
| 3864 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3865 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3866 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3867 | sizeof(tSirMacAddr)); |
| 3868 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3869 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3870 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3871 | |
| 3872 | // Free up buffer allocated |
| 3873 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3874 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3875 | |
| 3876 | limPostSmeMessage(pMac, |
| 3877 | LIM_MLM_DEAUTH_CNF, |
| 3878 | (tANI_U32 *) &mlmDeauthCnf); |
| 3879 | return eHAL_STATUS_SUCCESS; |
| 3880 | } |
| 3881 | |
| 3882 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3883 | { |
| 3884 | tANI_U16 aid; |
| 3885 | tpDphHashNode pStaDs; |
| 3886 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3887 | tpPESession psessionEntry; |
| 3888 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3889 | |
| 3890 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3891 | if (pMlmDisassocReq) |
| 3892 | { |
| 3893 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3894 | { |
| 3895 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3896 | } |
| 3897 | |
| 3898 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3899 | { |
| 3900 | |
| 3901 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3902 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3903 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3904 | goto end; |
| 3905 | } |
| 3906 | |
| 3907 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3908 | if (pStaDs == NULL) |
| 3909 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame^] | 3910 | limLog(pMac, LOGE, |
| 3911 | FL("StaDs Null")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3912 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3913 | goto end; |
| 3914 | } |
| 3915 | |
| 3916 | /// Receive path cleanup with dummy packet |
| 3917 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3918 | { |
| 3919 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame^] | 3920 | limLog(pMac, LOGE, |
| 3921 | FL("CleanupRxPath error")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3922 | goto end; |
| 3923 | } |
| 3924 | |
| 3925 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3926 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3927 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3928 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3929 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3930 | PELOGE(limLog(pMac, LOG1, |
| 3931 | FL("FT Preauth SessionId %d Cleanup" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3932 | #ifdef FEATURE_WLAN_ESE |
| 3933 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3934 | #endif |
| 3935 | #ifdef FEATURE_WLAN_LFR |
| 3936 | " isLFR %d" |
| 3937 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3938 | " is11r %d reason %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3939 | psessionEntry->peSessionId, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3940 | #ifdef FEATURE_WLAN_ESE |
| 3941 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3942 | #endif |
| 3943 | #ifdef FEATURE_WLAN_LFR |
| 3944 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3945 | #endif |
| 3946 | psessionEntry->is11Rconnection, |
| 3947 | pMlmDisassocReq->reasonCode);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 3948 | limFTCleanup(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3949 | } |
| 3950 | #endif |
| 3951 | |
| 3952 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3953 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3954 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3955 | return eHAL_STATUS_SUCCESS; |
| 3956 | } |
| 3957 | else |
| 3958 | { |
| 3959 | return eHAL_STATUS_SUCCESS; |
| 3960 | } |
| 3961 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3962 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3963 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3964 | sizeof(tSirMacAddr)); |
| 3965 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3966 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3967 | |
| 3968 | /* Update PE session ID*/ |
| 3969 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3970 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3971 | if(pMlmDisassocReq != NULL) |
| 3972 | { |
| 3973 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3974 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3975 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3976 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3977 | |
| 3978 | limPostSmeMessage(pMac, |
| 3979 | LIM_MLM_DISASSOC_CNF, |
| 3980 | (tANI_U32 *) &mlmDisassocCnf); |
| 3981 | return eHAL_STATUS_SUCCESS; |
| 3982 | } |
| 3983 | |
| 3984 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3985 | { |
| 3986 | return limSendDisassocCnf(pMac); |
| 3987 | } |
| 3988 | |
| 3989 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3990 | { |
| 3991 | return limSendDeauthCnf(pMac); |
| 3992 | } |
| 3993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3994 | /** |
| 3995 | * \brief This function is called to send Disassociate frame. |
| 3996 | * |
| 3997 | * |
| 3998 | * \param pMac Pointer to Global MAC structure |
| 3999 | * |
| 4000 | * \param nReason Indicates the reason that need to be sent in |
| 4001 | * Disassociation frame |
| 4002 | * |
| 4003 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 4004 | * sent |
| 4005 | * |
| 4006 | * |
| 4007 | */ |
| 4008 | |
| 4009 | void |
| 4010 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 4011 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4012 | tSirMacAddr peer, |
| 4013 | tpPESession psessionEntry, |
| 4014 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4015 | { |
| 4016 | tDot11fDisassociation frm; |
| 4017 | tANI_U8 *pFrame; |
| 4018 | tSirRetStatus nSirStatus; |
| 4019 | tpSirMacMgmtHdr pMacHdr; |
| 4020 | tANI_U32 nBytes, nPayload, nStatus; |
| 4021 | void *pPacket; |
| 4022 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4023 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4024 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4025 | if(NULL == psessionEntry) |
| 4026 | { |
| 4027 | return; |
| 4028 | } |
| 4029 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4030 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4031 | |
| 4032 | frm.Reason.code = nReason; |
| 4033 | |
| 4034 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 4035 | if ( DOT11F_FAILED( nStatus ) ) |
| 4036 | { |
| 4037 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4038 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | nStatus ); |
| 4040 | // We'll fall back on the worst case scenario: |
| 4041 | nPayload = sizeof( tDot11fDisassociation ); |
| 4042 | } |
| 4043 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4044 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4045 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4046 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4047 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4048 | } |
| 4049 | |
| 4050 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4051 | |
| 4052 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4053 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4054 | ( void** ) &pPacket ); |
| 4055 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4056 | { |
| 4057 | 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] | 4058 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4059 | return; |
| 4060 | } |
| 4061 | |
| 4062 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4063 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4064 | |
| 4065 | // Next, we fill out the buffer descriptor: |
| 4066 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4067 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4068 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4069 | { |
| 4070 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4071 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4072 | nSirStatus ); |
| 4073 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4074 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4075 | return; // just allocated... |
| 4076 | } |
| 4077 | |
| 4078 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4079 | |
| 4080 | // Prepare the BSSID |
| 4081 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4082 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4083 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4084 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4085 | #endif |
| 4086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4087 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4088 | sizeof(tSirMacMgmtHdr), |
| 4089 | nPayload, &nPayload ); |
| 4090 | if ( DOT11F_FAILED( nStatus ) ) |
| 4091 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4092 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4093 | nStatus ); |
| 4094 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4095 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4096 | return; // allocated! |
| 4097 | } |
| 4098 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4099 | { |
| 4100 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4101 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4102 | } |
| 4103 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4104 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4105 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4106 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4107 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4108 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4109 | |
| 4110 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4111 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4112 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4113 | ) |
| 4114 | { |
| 4115 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4116 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4117 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4118 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4119 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4120 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4121 | { |
| 4122 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4123 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4124 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4125 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4126 | { |
| 4127 | /* This frame will be sent on air by firmware, |
| 4128 | which will ensure that this frame goes out |
| 4129 | even though DEL_STA is sent immediately */ |
| 4130 | /* Without this for DEL_STA command there is |
| 4131 | risk of flushing frame in BTQM queue without |
| 4132 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4133 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4134 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4135 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4136 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4137 | } |
| 4138 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4139 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4140 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4141 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4142 | psessionEntry->peSessionId, |
| 4143 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4144 | // Queue Disassociation frame in high priority WQ |
| 4145 | /* get the duration from the request */ |
| 4146 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4147 | HAL_TXRX_FRM_802_11_MGMT, |
| 4148 | ANI_TXDIR_TODS, |
| 4149 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4150 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 4151 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4152 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4153 | psessionEntry->peSessionId, |
| 4154 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4155 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4156 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4157 | if (tx_timer_change( |
| 4158 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4159 | != TX_SUCCESS) |
| 4160 | { |
| 4161 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4162 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4163 | return; |
| 4164 | } |
| 4165 | else if(TX_SUCCESS != tx_timer_activate( |
| 4166 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4167 | { |
| 4168 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4169 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4170 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4171 | return; |
| 4172 | } |
| 4173 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4174 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4175 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4176 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4177 | psessionEntry->peSessionId, |
| 4178 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4179 | // Queue Disassociation frame in high priority WQ |
| 4180 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4181 | HAL_TXRX_FRM_802_11_MGMT, |
| 4182 | ANI_TXDIR_TODS, |
| 4183 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4184 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4185 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4186 | psessionEntry->peSessionId, |
| 4187 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4188 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4189 | { |
| 4190 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4191 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4192 | nSirStatus ); |
| 4193 | //Pkt will be freed up by the callback |
| 4194 | return; |
| 4195 | } |
| 4196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | } // End limSendDisassocMgmtFrame. |
| 4198 | |
| 4199 | /** |
| 4200 | * \brief This function is called to send a Deauthenticate frame |
| 4201 | * |
| 4202 | * |
| 4203 | * \param pMac Pointer to global MAC structure |
| 4204 | * |
| 4205 | * \param nReason Indicates the reason that need to be sent in the |
| 4206 | * Deauthenticate frame |
| 4207 | * |
| 4208 | * \param peeer address of the STA to which the frame is to be sent |
| 4209 | * |
| 4210 | * |
| 4211 | */ |
| 4212 | |
| 4213 | void |
| 4214 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4215 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4216 | tSirMacAddr peer, |
| 4217 | tpPESession psessionEntry, |
| 4218 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4219 | { |
| 4220 | tDot11fDeAuth frm; |
| 4221 | tANI_U8 *pFrame; |
| 4222 | tSirRetStatus nSirStatus; |
| 4223 | tpSirMacMgmtHdr pMacHdr; |
| 4224 | tANI_U32 nBytes, nPayload, nStatus; |
| 4225 | void *pPacket; |
| 4226 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4227 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4228 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4229 | #ifdef FEATURE_WLAN_TDLS |
| 4230 | tANI_U16 aid; |
| 4231 | tpDphHashNode pStaDs; |
| 4232 | #endif |
| 4233 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4234 | if(NULL == psessionEntry) |
| 4235 | { |
| 4236 | return; |
| 4237 | } |
| 4238 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4239 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4240 | |
| 4241 | frm.Reason.code = nReason; |
| 4242 | |
| 4243 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4244 | if ( DOT11F_FAILED( nStatus ) ) |
| 4245 | { |
| 4246 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4247 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4248 | nStatus ); |
| 4249 | // We'll fall back on the worst case scenario: |
| 4250 | nPayload = sizeof( tDot11fDeAuth ); |
| 4251 | } |
| 4252 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4253 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4254 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4255 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4256 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4257 | } |
| 4258 | |
| 4259 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4260 | |
| 4261 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4262 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4263 | ( void** ) &pPacket ); |
| 4264 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4265 | { |
| 4266 | 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] | 4267 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4268 | return; |
| 4269 | } |
| 4270 | |
| 4271 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4272 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4273 | |
| 4274 | // Next, we fill out the buffer descriptor: |
| 4275 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4276 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4277 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4278 | { |
| 4279 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4280 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4281 | nSirStatus ); |
| 4282 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4283 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4284 | return; // just allocated... |
| 4285 | } |
| 4286 | |
| 4287 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4288 | |
| 4289 | // Prepare the BSSID |
| 4290 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4291 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4292 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4293 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4294 | #endif |
| 4295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4296 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4297 | sizeof(tSirMacMgmtHdr), |
| 4298 | nPayload, &nPayload ); |
| 4299 | if ( DOT11F_FAILED( nStatus ) ) |
| 4300 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4301 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4302 | nStatus ); |
| 4303 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4304 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4305 | return; |
| 4306 | } |
| 4307 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4308 | { |
| 4309 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4310 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4311 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4312 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4313 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4314 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4315 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4316 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4317 | |
| 4318 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4319 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4320 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4321 | ) |
| 4322 | { |
| 4323 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4324 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4325 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4326 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4327 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4328 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4329 | { |
| 4330 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4331 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4332 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4333 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4334 | { |
| 4335 | /* This frame will be sent on air by firmware, |
| 4336 | which will ensure that this frame goes out |
| 4337 | even though DEL_STA is sent immediately */ |
| 4338 | /* Without this for DEL_STA command there is |
| 4339 | risk of flushing frame in BTQM queue without |
| 4340 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4341 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4342 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4343 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4344 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4345 | } |
| 4346 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4347 | #ifdef FEATURE_WLAN_TDLS |
| 4348 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4349 | #endif |
| 4350 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4351 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4352 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4353 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4354 | psessionEntry->peSessionId, |
| 4355 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4356 | // Queue Disassociation frame in high priority WQ |
| 4357 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4358 | HAL_TXRX_FRM_802_11_MGMT, |
| 4359 | ANI_TXDIR_TODS, |
| 4360 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4361 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4362 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4363 | psessionEntry->peSessionId, |
| 4364 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4365 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4366 | { |
| 4367 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4368 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4369 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4370 | //Pkt will be freed up by the callback limTxComplete |
| 4371 | |
| 4372 | /*Call limProcessDeauthAckTimeout which will send |
| 4373 | * DeauthCnf for this frame |
| 4374 | */ |
| 4375 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4376 | return; |
| 4377 | } |
| 4378 | |
| 4379 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4380 | |
| 4381 | if (tx_timer_change( |
| 4382 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4383 | != TX_SUCCESS) |
| 4384 | { |
| 4385 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4386 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4387 | return; |
| 4388 | } |
| 4389 | else if(TX_SUCCESS != tx_timer_activate( |
| 4390 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4391 | { |
| 4392 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4393 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4394 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4395 | return; |
| 4396 | } |
| 4397 | } |
| 4398 | else |
| 4399 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4400 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4401 | psessionEntry->peSessionId, |
| 4402 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4403 | #ifdef FEATURE_WLAN_TDLS |
| 4404 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4405 | { |
| 4406 | // Queue Disassociation frame in high priority WQ |
| 4407 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4408 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4409 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4410 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4411 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4412 | } |
| 4413 | else |
| 4414 | { |
| 4415 | #endif |
| 4416 | // Queue Disassociation frame in high priority WQ |
| 4417 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4418 | HAL_TXRX_FRM_802_11_MGMT, |
| 4419 | ANI_TXDIR_TODS, |
| 4420 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4421 | limTxComplete, pFrame, txFlag ); |
| 4422 | #ifdef FEATURE_WLAN_TDLS |
| 4423 | } |
| 4424 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4425 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4426 | psessionEntry->peSessionId, |
| 4427 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4428 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4429 | { |
| 4430 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4431 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4432 | nSirStatus ); |
| 4433 | //Pkt will be freed up by the callback |
| 4434 | return; |
| 4435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4436 | } |
| 4437 | |
| 4438 | } // End limSendDeauthMgmtFrame. |
| 4439 | |
| 4440 | |
| 4441 | #ifdef ANI_SUPPORT_11H |
| 4442 | /** |
| 4443 | * \brief Send a Measurement Report Action frame |
| 4444 | * |
| 4445 | * |
| 4446 | * \param pMac Pointer to the global MAC structure |
| 4447 | * |
| 4448 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4449 | * |
| 4450 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4451 | * |
| 4452 | * |
| 4453 | */ |
| 4454 | |
| 4455 | tSirRetStatus |
| 4456 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4457 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4458 | tSirMacAddr peer) |
| 4459 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4460 | tDot11fMeasurementReport frm; |
| 4461 | tANI_U8 *pFrame; |
| 4462 | tSirRetStatus nSirStatus; |
| 4463 | tpSirMacMgmtHdr pMacHdr; |
| 4464 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4465 | void *pPacket; |
| 4466 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4467 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4468 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4469 | |
| 4470 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4471 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4472 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4473 | |
| 4474 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4475 | { |
| 4476 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4477 | nSirStatus = |
| 4478 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4479 | &frm.MeasurementReport ); |
| 4480 | break; |
| 4481 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4482 | nSirStatus = |
| 4483 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4484 | &frm.MeasurementReport ); |
| 4485 | break; |
| 4486 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4487 | nSirStatus = |
| 4488 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4489 | &frm.MeasurementReport ); |
| 4490 | break; |
| 4491 | default: |
| 4492 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4493 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4494 | pMeasReqFrame->measReqIE.measType ); |
| 4495 | return eSIR_FAILURE; |
| 4496 | } |
| 4497 | |
| 4498 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4499 | |
| 4500 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4501 | if ( DOT11F_FAILED( nStatus ) ) |
| 4502 | { |
| 4503 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4504 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4505 | nStatus ); |
| 4506 | // We'll fall back on the worst case scenario: |
| 4507 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4508 | } |
| 4509 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4510 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4511 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4512 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4513 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4514 | } |
| 4515 | |
| 4516 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4517 | |
| 4518 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4519 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4520 | { |
| 4521 | 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] | 4522 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4523 | return eSIR_FAILURE; |
| 4524 | } |
| 4525 | |
| 4526 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4527 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4528 | |
| 4529 | // Next, we fill out the buffer descriptor: |
| 4530 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4531 | SIR_MAC_MGMT_ACTION, peer); |
| 4532 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4533 | { |
| 4534 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4535 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4536 | nSirStatus ); |
| 4537 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4538 | return eSIR_FAILURE; // just allocated... |
| 4539 | } |
| 4540 | |
| 4541 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4542 | |
| 4543 | nCfg = 6; |
| 4544 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4545 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4546 | { |
| 4547 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4548 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4549 | nSirStatus ); |
| 4550 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4551 | return eSIR_FAILURE; // just allocated... |
| 4552 | } |
| 4553 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4554 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4555 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4556 | #endif |
| 4557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4558 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4559 | sizeof(tSirMacMgmtHdr), |
| 4560 | nPayload, &nPayload ); |
| 4561 | if ( DOT11F_FAILED( nStatus ) ) |
| 4562 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4563 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4564 | nStatus ); |
| 4565 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4566 | return eSIR_FAILURE; // allocated! |
| 4567 | } |
| 4568 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4569 | { |
| 4570 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4571 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4572 | } |
| 4573 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4574 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4575 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4576 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4577 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4578 | HAL_TXRX_FRM_802_11_MGMT, |
| 4579 | ANI_TXDIR_TODS, |
| 4580 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4581 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4582 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4583 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4584 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4585 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4586 | { |
| 4587 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4588 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4589 | nSirStatus ); |
| 4590 | //Pkt will be freed up by the callback |
| 4591 | return eSIR_FAILURE; // just allocated... |
| 4592 | } |
| 4593 | |
| 4594 | return eSIR_SUCCESS; |
| 4595 | |
| 4596 | } // End limSendMeasReportFrame. |
| 4597 | |
| 4598 | |
| 4599 | /** |
| 4600 | * \brief Send a TPC Request Action frame |
| 4601 | * |
| 4602 | * |
| 4603 | * \param pMac Pointer to the global MAC datastructure |
| 4604 | * |
| 4605 | * \param peer MAC address to which the frame should be sent |
| 4606 | * |
| 4607 | * |
| 4608 | */ |
| 4609 | |
| 4610 | void |
| 4611 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4612 | tSirMacAddr peer) |
| 4613 | { |
| 4614 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4615 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | tSirRetStatus nSirStatus; |
| 4617 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4618 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4619 | void *pPacket; |
| 4620 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4621 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4622 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4623 | |
| 4624 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4625 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4626 | frm.DialogToken.token = 1; |
| 4627 | frm.TPCRequest.present = 1; |
| 4628 | |
| 4629 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4630 | if ( DOT11F_FAILED( nStatus ) ) |
| 4631 | { |
| 4632 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4633 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4634 | nStatus ); |
| 4635 | // We'll fall back on the worst case scenario: |
| 4636 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4637 | } |
| 4638 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4639 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4640 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4641 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4642 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | } |
| 4644 | |
| 4645 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4646 | |
| 4647 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4648 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4649 | { |
| 4650 | 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] | 4651 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4652 | return; |
| 4653 | } |
| 4654 | |
| 4655 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4656 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4657 | |
| 4658 | // Next, we fill out the buffer descriptor: |
| 4659 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4660 | SIR_MAC_MGMT_ACTION, peer); |
| 4661 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4662 | { |
| 4663 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4664 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4665 | nSirStatus ); |
| 4666 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4667 | return; // just allocated... |
| 4668 | } |
| 4669 | |
| 4670 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4671 | |
| 4672 | nCfg = 6; |
| 4673 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4674 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4675 | { |
| 4676 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4677 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4678 | nSirStatus ); |
| 4679 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4680 | return; // just allocated... |
| 4681 | } |
| 4682 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4683 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4684 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4685 | #endif |
| 4686 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4687 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4688 | sizeof(tSirMacMgmtHdr), |
| 4689 | nPayload, &nPayload ); |
| 4690 | if ( DOT11F_FAILED( nStatus ) ) |
| 4691 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4692 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4693 | nStatus ); |
| 4694 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4695 | return; // allocated! |
| 4696 | } |
| 4697 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4698 | { |
| 4699 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4700 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4701 | } |
| 4702 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4703 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4704 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4705 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4706 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4707 | HAL_TXRX_FRM_802_11_MGMT, |
| 4708 | ANI_TXDIR_TODS, |
| 4709 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4710 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4711 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4712 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4713 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4714 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4715 | { |
| 4716 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4717 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4718 | nSirStatus ); |
| 4719 | //Pkt will be freed up by the callback |
| 4720 | return; |
| 4721 | } |
| 4722 | |
| 4723 | } // End limSendTpcRequestFrame. |
| 4724 | |
| 4725 | |
| 4726 | /** |
| 4727 | * \brief Send a TPC Report Action frame |
| 4728 | * |
| 4729 | * |
| 4730 | * \param pMac Pointer to the global MAC datastructure |
| 4731 | * |
| 4732 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4733 | * |
| 4734 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4735 | * |
| 4736 | * |
| 4737 | */ |
| 4738 | |
| 4739 | tSirRetStatus |
| 4740 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4741 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4742 | tSirMacAddr peer) |
| 4743 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4744 | tDot11fTPCReport frm; |
| 4745 | tANI_U8 *pFrame; |
| 4746 | tSirRetStatus nSirStatus; |
| 4747 | tpSirMacMgmtHdr pMacHdr; |
| 4748 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4749 | void *pPacket; |
| 4750 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4751 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4752 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4753 | |
| 4754 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4755 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4756 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4757 | |
| 4758 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4759 | // "misplaced this function, need to replace: |
| 4760 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4761 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4762 | frm.TPCReport.tx_power = 0; |
| 4763 | frm.TPCReport.link_margin = 0; |
| 4764 | frm.TPCReport.present = 1; |
| 4765 | |
| 4766 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4767 | if ( DOT11F_FAILED( nStatus ) ) |
| 4768 | { |
| 4769 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4770 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4771 | nStatus ); |
| 4772 | // We'll fall back on the worst case scenario: |
| 4773 | nPayload = sizeof( tDot11fTPCReport ); |
| 4774 | } |
| 4775 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4776 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4777 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4778 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4779 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4780 | } |
| 4781 | |
| 4782 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4783 | |
| 4784 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4785 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4786 | { |
| 4787 | 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] | 4788 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4789 | return eSIR_FAILURE; |
| 4790 | } |
| 4791 | |
| 4792 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4793 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4794 | |
| 4795 | // Next, we fill out the buffer descriptor: |
| 4796 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4797 | SIR_MAC_MGMT_ACTION, peer); |
| 4798 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4799 | { |
| 4800 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4801 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4802 | nSirStatus ); |
| 4803 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4804 | return eSIR_FAILURE; // just allocated... |
| 4805 | } |
| 4806 | |
| 4807 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4808 | |
| 4809 | nCfg = 6; |
| 4810 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4811 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4812 | { |
| 4813 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4814 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4815 | nSirStatus ); |
| 4816 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4817 | return eSIR_FAILURE; // just allocated... |
| 4818 | } |
| 4819 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4820 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4821 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4822 | #endif |
| 4823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4825 | sizeof(tSirMacMgmtHdr), |
| 4826 | nPayload, &nPayload ); |
| 4827 | if ( DOT11F_FAILED( nStatus ) ) |
| 4828 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4829 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4830 | nStatus ); |
| 4831 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4832 | return eSIR_FAILURE; // allocated! |
| 4833 | } |
| 4834 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4835 | { |
| 4836 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4837 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4838 | } |
| 4839 | |
| 4840 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4841 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4842 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4843 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4844 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4845 | HAL_TXRX_FRM_802_11_MGMT, |
| 4846 | ANI_TXDIR_TODS, |
| 4847 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4848 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4849 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4850 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4851 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4852 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4853 | { |
| 4854 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4855 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4856 | nSirStatus ); |
| 4857 | //Pkt will be freed up by the callback |
| 4858 | return eSIR_FAILURE; // just allocated... |
| 4859 | } |
| 4860 | |
| 4861 | return eSIR_SUCCESS; |
| 4862 | |
| 4863 | } // End limSendTpcReportFrame. |
| 4864 | #endif //ANI_SUPPORT_11H |
| 4865 | |
| 4866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4867 | /** |
| 4868 | * \brief Send a Channel Switch Announcement |
| 4869 | * |
| 4870 | * |
| 4871 | * \param pMac Pointer to the global MAC datastructure |
| 4872 | * |
| 4873 | * \param peer MAC address to which this frame will be sent |
| 4874 | * |
| 4875 | * \param nMode |
| 4876 | * |
| 4877 | * \param nNewChannel |
| 4878 | * |
| 4879 | * \param nCount |
| 4880 | * |
| 4881 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4882 | * |
| 4883 | * |
| 4884 | */ |
| 4885 | |
| 4886 | tSirRetStatus |
| 4887 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4888 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4889 | tANI_U8 nMode, |
| 4890 | tANI_U8 nNewChannel, |
| 4891 | tANI_U8 nCount, |
| 4892 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4893 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4894 | tDot11fChannelSwitch frm; |
| 4895 | tANI_U8 *pFrame; |
| 4896 | tSirRetStatus nSirStatus; |
| 4897 | tpSirMacMgmtHdr pMacHdr; |
| 4898 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4899 | void *pPacket; |
| 4900 | eHalStatus halstatus; |
| 4901 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4902 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4903 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | |
| 4905 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4906 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4907 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4908 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4909 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4910 | frm.ChanSwitchAnn.present = 1; |
| 4911 | |
| 4912 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4913 | if ( DOT11F_FAILED( nStatus ) ) |
| 4914 | { |
| 4915 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4916 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4917 | nStatus ); |
| 4918 | // We'll fall back on the worst case scenario: |
| 4919 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4920 | } |
| 4921 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4922 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4923 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4924 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4925 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4926 | } |
| 4927 | |
| 4928 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4929 | |
| 4930 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4931 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4932 | { |
| 4933 | 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] | 4934 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4935 | return eSIR_FAILURE; |
| 4936 | } |
| 4937 | |
| 4938 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4939 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4940 | |
| 4941 | // Next, we fill out the buffer descriptor: |
| 4942 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4943 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4944 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4945 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4946 | (tANI_U8 *) psessionEntry->bssId, |
| 4947 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4949 | { |
| 4950 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4951 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4952 | nSirStatus ); |
| 4953 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4954 | return eSIR_FAILURE; // just allocated... |
| 4955 | } |
| 4956 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4957 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4958 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4959 | |
| 4960 | nCfg = 6; |
| 4961 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4962 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4963 | { |
| 4964 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4965 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4966 | nSirStatus ); |
| 4967 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4968 | return eSIR_FAILURE; // just allocated... |
| 4969 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4970 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4971 | |
| 4972 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4973 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4974 | #endif |
| 4975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4976 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4977 | sizeof(tSirMacMgmtHdr), |
| 4978 | nPayload, &nPayload ); |
| 4979 | if ( DOT11F_FAILED( nStatus ) ) |
| 4980 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4981 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4982 | nStatus ); |
| 4983 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4984 | return eSIR_FAILURE; // allocated! |
| 4985 | } |
| 4986 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4987 | { |
| 4988 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4989 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4990 | } |
| 4991 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4992 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4993 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4994 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4995 | ) |
| 4996 | { |
| 4997 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4998 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4999 | |
| 5000 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5001 | psessionEntry->peSessionId, |
| 5002 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5003 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5004 | HAL_TXRX_FRM_802_11_MGMT, |
| 5005 | ANI_TXDIR_TODS, |
| 5006 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5007 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5008 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5009 | psessionEntry->peSessionId, |
| 5010 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5011 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5012 | { |
| 5013 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5014 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5015 | nSirStatus ); |
| 5016 | //Pkt will be freed up by the callback |
| 5017 | return eSIR_FAILURE; |
| 5018 | } |
| 5019 | |
| 5020 | return eSIR_SUCCESS; |
| 5021 | |
| 5022 | } // End limSendChannelSwitchMgmtFrame. |
| 5023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5024 | |
| 5025 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5026 | #ifdef WLAN_FEATURE_11AC |
| 5027 | tSirRetStatus |
| 5028 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 5029 | tSirMacAddr peer, |
| 5030 | tANI_U8 nMode, |
| 5031 | tpPESession psessionEntry ) |
| 5032 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5033 | tDot11fOperatingMode frm; |
| 5034 | tANI_U8 *pFrame; |
| 5035 | tSirRetStatus nSirStatus; |
| 5036 | tpSirMacMgmtHdr pMacHdr; |
| 5037 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 5038 | void *pPacket; |
| 5039 | eHalStatus halstatus; |
| 5040 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5041 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5042 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5043 | |
| 5044 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5045 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5046 | frm.OperatingMode.chanWidth = nMode; |
| 5047 | frm.OperatingMode.rxNSS = 0; |
| 5048 | frm.OperatingMode.rxNSSType = 0; |
| 5049 | |
| 5050 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5051 | if ( DOT11F_FAILED( nStatus ) ) |
| 5052 | { |
| 5053 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5054 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5055 | nStatus ); |
| 5056 | // We'll fall back on the worst case scenario: |
| 5057 | nPayload = sizeof( tDot11fOperatingMode); |
| 5058 | } |
| 5059 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5060 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5061 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5062 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5063 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5064 | } |
| 5065 | |
| 5066 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5067 | |
| 5068 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5069 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5070 | { |
| 5071 | 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] | 5072 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5073 | return eSIR_FAILURE; |
| 5074 | } |
| 5075 | |
| 5076 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5077 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5078 | |
| 5079 | |
| 5080 | // Next, we fill out the buffer descriptor: |
| 5081 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5082 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5083 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5084 | } else |
| 5085 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5086 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5087 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5088 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5089 | (tANI_U8 *) psessionEntry->bssId, |
| 5090 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5091 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5092 | { |
| 5093 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5094 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5095 | nSirStatus ); |
| 5096 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5097 | return eSIR_FAILURE; // just allocated... |
| 5098 | } |
| 5099 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5100 | sizeof(tSirMacMgmtHdr), |
| 5101 | nPayload, &nPayload ); |
| 5102 | if ( DOT11F_FAILED( nStatus ) ) |
| 5103 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5104 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5105 | nStatus ); |
| 5106 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5107 | return eSIR_FAILURE; // allocated! |
| 5108 | } |
| 5109 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5110 | { |
| 5111 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5112 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5113 | } |
| 5114 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5115 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5116 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5117 | ) |
| 5118 | { |
| 5119 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5120 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5121 | |
| 5122 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5123 | psessionEntry->peSessionId, |
| 5124 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5125 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5126 | HAL_TXRX_FRM_802_11_MGMT, |
| 5127 | ANI_TXDIR_TODS, |
| 5128 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5129 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5130 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5131 | psessionEntry->peSessionId, |
| 5132 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5133 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5134 | { |
| 5135 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5136 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5137 | nSirStatus ); |
| 5138 | //Pkt will be freed up by the callback |
| 5139 | return eSIR_FAILURE; |
| 5140 | } |
| 5141 | |
| 5142 | return eSIR_SUCCESS; |
| 5143 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5144 | |
| 5145 | /** |
| 5146 | * \brief Send a VHT Channel Switch Announcement |
| 5147 | * |
| 5148 | * |
| 5149 | * \param pMac Pointer to the global MAC datastructure |
| 5150 | * |
| 5151 | * \param peer MAC address to which this frame will be sent |
| 5152 | * |
| 5153 | * \param nChanWidth |
| 5154 | * |
| 5155 | * \param nNewChannel |
| 5156 | * |
| 5157 | * |
| 5158 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5159 | * |
| 5160 | * |
| 5161 | */ |
| 5162 | |
| 5163 | tSirRetStatus |
| 5164 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5165 | tSirMacAddr peer, |
| 5166 | tANI_U8 nChanWidth, |
| 5167 | tANI_U8 nNewChannel, |
| 5168 | tANI_U8 ncbMode, |
| 5169 | tpPESession psessionEntry ) |
| 5170 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5171 | tDot11fChannelSwitch frm; |
| 5172 | tANI_U8 *pFrame; |
| 5173 | tSirRetStatus nSirStatus; |
| 5174 | tpSirMacMgmtHdr pMacHdr; |
| 5175 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5176 | void *pPacket; |
| 5177 | eHalStatus halstatus; |
| 5178 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5179 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5180 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5181 | |
| 5182 | |
| 5183 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5184 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5185 | frm.ChanSwitchAnn.switchMode = 1; |
| 5186 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5187 | frm.ChanSwitchAnn.switchCount = 1; |
| 5188 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5189 | frm.ExtChanSwitchAnn.present = 1; |
| 5190 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5191 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5192 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5193 | frm.ChanSwitchAnn.present = 1; |
| 5194 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5195 | |
| 5196 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5197 | if ( DOT11F_FAILED( nStatus ) ) |
| 5198 | { |
| 5199 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5200 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5201 | nStatus ); |
| 5202 | // We'll fall back on the worst case scenario: |
| 5203 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5204 | } |
| 5205 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5206 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5207 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5208 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5209 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5210 | } |
| 5211 | |
| 5212 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5213 | |
| 5214 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5215 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5216 | { |
| 5217 | 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] | 5218 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5219 | return eSIR_FAILURE; |
| 5220 | } |
| 5221 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5222 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5223 | |
| 5224 | // Next, we fill out the buffer descriptor: |
| 5225 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5226 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5227 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5228 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5229 | (tANI_U8 *) psessionEntry->bssId, |
| 5230 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5231 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5232 | { |
| 5233 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5234 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5235 | nSirStatus ); |
| 5236 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5237 | return eSIR_FAILURE; // just allocated... |
| 5238 | } |
| 5239 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5240 | sizeof(tSirMacMgmtHdr), |
| 5241 | nPayload, &nPayload ); |
| 5242 | if ( DOT11F_FAILED( nStatus ) ) |
| 5243 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5244 | 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] | 5245 | nStatus ); |
| 5246 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5247 | return eSIR_FAILURE; // allocated! |
| 5248 | } |
| 5249 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5250 | { |
| 5251 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5252 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5253 | } |
| 5254 | |
| 5255 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5256 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5257 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5258 | ) |
| 5259 | { |
| 5260 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5261 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5262 | |
| 5263 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5264 | psessionEntry->peSessionId, |
| 5265 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5266 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5267 | HAL_TXRX_FRM_802_11_MGMT, |
| 5268 | ANI_TXDIR_TODS, |
| 5269 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5270 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5271 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5272 | psessionEntry->peSessionId, |
| 5273 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5274 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5275 | { |
| 5276 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5277 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5278 | nSirStatus ); |
| 5279 | //Pkt will be freed up by the callback |
| 5280 | return eSIR_FAILURE; |
| 5281 | } |
| 5282 | |
| 5283 | return eSIR_SUCCESS; |
| 5284 | |
| 5285 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5286 | |
| 5287 | |
| 5288 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5289 | #endif |
| 5290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5291 | /** |
| 5292 | * \brief Send an ADDBA Req Action Frame to peer |
| 5293 | * |
| 5294 | * \sa limSendAddBAReq |
| 5295 | * |
| 5296 | * \param pMac The global tpAniSirGlobal object |
| 5297 | * |
| 5298 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5299 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5300 | * Frame to the peer |
| 5301 | * |
| 5302 | * \return eSIR_SUCCESS if setup completes successfully |
| 5303 | * eSIR_FAILURE is some problem is encountered |
| 5304 | */ |
| 5305 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5306 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5307 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5308 | tDot11fAddBAReq frmAddBAReq; |
| 5309 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5310 | tpSirMacMgmtHdr pMacHdr; |
| 5311 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5312 | tSirRetStatus statusCode; |
| 5313 | eHalStatus halStatus; |
| 5314 | void *pPacket; |
| 5315 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5316 | |
| 5317 | if(NULL == psessionEntry) |
| 5318 | { |
| 5319 | return eSIR_FAILURE; |
| 5320 | } |
| 5321 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5322 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5323 | |
| 5324 | // Category - 3 (BA) |
| 5325 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5326 | |
| 5327 | // Action - 0 (ADDBA Req) |
| 5328 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5329 | |
| 5330 | // FIXME - Dialog Token, generalize this... |
| 5331 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5332 | |
| 5333 | // Fill the ADDBA Parameter Set |
| 5334 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5335 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5336 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5337 | |
| 5338 | // BA timeout |
| 5339 | // 0 - indicates no BA timeout |
| 5340 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5341 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5342 | /* Send SSN whatever we get from FW. |
| 5343 | */ |
| 5344 | frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5345 | |
| 5346 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5347 | |
| 5348 | if( DOT11F_FAILED( nStatus )) |
| 5349 | { |
| 5350 | limLog( pMac, LOGW, |
| 5351 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5352 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5353 | nStatus ); |
| 5354 | |
| 5355 | // We'll fall back on the worst case scenario: |
| 5356 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5357 | } |
| 5358 | else if( DOT11F_WARNED( nStatus )) |
| 5359 | { |
| 5360 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5361 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5362 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5363 | nStatus ); |
| 5364 | } |
| 5365 | |
| 5366 | // Add the MGMT header to frame length |
| 5367 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5368 | |
| 5369 | // Need to allocate a buffer for ADDBA AF |
| 5370 | if( eHAL_STATUS_SUCCESS != |
| 5371 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5372 | HAL_TXRX_FRM_802_11_MGMT, |
| 5373 | (tANI_U16) frameLen, |
| 5374 | (void **) &pAddBAReqBuffer, |
| 5375 | (void **) &pPacket ))) |
| 5376 | { |
| 5377 | // Log error |
| 5378 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5379 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5380 | frameLen, |
| 5381 | halStatus ); |
| 5382 | |
| 5383 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5384 | goto returnAfterError; |
| 5385 | } |
| 5386 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5387 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5388 | |
| 5389 | // Copy necessary info to BD |
| 5390 | if( eSIR_SUCCESS != |
| 5391 | (statusCode = limPopulateMacHeader( pMac, |
| 5392 | pAddBAReqBuffer, |
| 5393 | SIR_MAC_MGMT_FRAME, |
| 5394 | SIR_MAC_MGMT_ACTION, |
| 5395 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5396 | goto returnAfterError; |
| 5397 | |
| 5398 | // Update A3 with the BSSID |
| 5399 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5400 | |
| 5401 | #if 0 |
| 5402 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5403 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5404 | WNI_CFG_BSSID, |
| 5405 | (tANI_U8 *) pMacHdr->bssId, |
| 5406 | &cfgLen )) |
| 5407 | { |
| 5408 | limLog( pMac, LOGP, |
| 5409 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5410 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5411 | |
| 5412 | // FIXME - Need to convert to tSirRetStatus |
| 5413 | statusCode = eSIR_FAILURE; |
| 5414 | goto returnAfterError; |
| 5415 | } |
| 5416 | #endif//TO SUPPORT BT-AMP |
| 5417 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5418 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5419 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5420 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5421 | #endif |
| 5422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | // Now, we're ready to "pack" the frames |
| 5424 | nStatus = dot11fPackAddBAReq( pMac, |
| 5425 | &frmAddBAReq, |
| 5426 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5427 | nPayload, |
| 5428 | &nPayload ); |
| 5429 | |
| 5430 | if( DOT11F_FAILED( nStatus )) |
| 5431 | { |
| 5432 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5433 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | nStatus ); |
| 5435 | |
| 5436 | // FIXME - Need to convert to tSirRetStatus |
| 5437 | statusCode = eSIR_FAILURE; |
| 5438 | goto returnAfterError; |
| 5439 | } |
| 5440 | else if( DOT11F_WARNED( nStatus )) |
| 5441 | { |
| 5442 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5443 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5444 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5445 | } |
| 5446 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5447 | limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with" |
| 5448 | " tid = %d policy = %d buffsize = %d " |
| 5449 | " amsduSupported = %d"), |
| 5450 | MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr), |
| 5451 | frmAddBAReq.AddBAParameterSet.tid, |
| 5452 | frmAddBAReq.AddBAParameterSet.policy, |
| 5453 | frmAddBAReq.AddBAParameterSet.bufferSize, |
| 5454 | frmAddBAReq.AddBAParameterSet.amsduSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5455 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5456 | limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ), |
| 5457 | frmAddBAReq.BAStartingSequenceControl.ssn, |
| 5458 | frmAddBAReq.BAStartingSequenceControl.fragNumber); |
| 5459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5461 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5462 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5463 | ) |
| 5464 | { |
| 5465 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5466 | } |
| 5467 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5468 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5469 | psessionEntry->peSessionId, |
| 5470 | pMacHdr->fc.subType)); |
| 5471 | halStatus = halTxFrame( pMac, |
| 5472 | pPacket, |
| 5473 | (tANI_U16) frameLen, |
| 5474 | HAL_TXRX_FRM_802_11_MGMT, |
| 5475 | ANI_TXDIR_TODS, |
| 5476 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5477 | limTxComplete, |
| 5478 | pAddBAReqBuffer, txFlag ); |
| 5479 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5480 | psessionEntry->peSessionId, |
| 5481 | halStatus)); |
| 5482 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5483 | { |
| 5484 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5485 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5486 | halStatus ); |
| 5487 | |
| 5488 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5489 | statusCode = eSIR_FAILURE; |
| 5490 | //Pkt will be freed up by the callback |
| 5491 | return statusCode; |
| 5492 | } |
| 5493 | else |
| 5494 | return eSIR_SUCCESS; |
| 5495 | |
| 5496 | returnAfterError: |
| 5497 | |
| 5498 | // Release buffer, if allocated |
| 5499 | if( NULL != pAddBAReqBuffer ) |
| 5500 | palPktFree( pMac->hHdd, |
| 5501 | HAL_TXRX_FRM_802_11_MGMT, |
| 5502 | (void *) pAddBAReqBuffer, |
| 5503 | (void *) pPacket ); |
| 5504 | |
| 5505 | return statusCode; |
| 5506 | } |
| 5507 | |
| 5508 | /** |
| 5509 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5510 | * |
| 5511 | * \sa limSendAddBARsp |
| 5512 | * |
| 5513 | * \param pMac The global tpAniSirGlobal object |
| 5514 | * |
| 5515 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5516 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5517 | * Frame to the peer |
| 5518 | * |
| 5519 | * \return eSIR_SUCCESS if setup completes successfully |
| 5520 | * eSIR_FAILURE is some problem is encountered |
| 5521 | */ |
| 5522 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5523 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5524 | tpPESession psessionEntry) |
| 5525 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5526 | tDot11fAddBARsp frmAddBARsp; |
| 5527 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5528 | tpSirMacMgmtHdr pMacHdr; |
| 5529 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5530 | tSirRetStatus statusCode; |
| 5531 | eHalStatus halStatus; |
| 5532 | void *pPacket; |
| 5533 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5534 | |
| 5535 | if(NULL == psessionEntry) |
| 5536 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5537 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5538 | return eSIR_FAILURE; |
| 5539 | } |
| 5540 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5541 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5542 | |
| 5543 | // Category - 3 (BA) |
| 5544 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5545 | // Action - 1 (ADDBA Rsp) |
| 5546 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5547 | |
| 5548 | // Should be same as the one we received in the ADDBA Req |
| 5549 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5550 | |
| 5551 | // ADDBA Req status |
| 5552 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5553 | |
| 5554 | // Fill the ADDBA Parameter Set as provided by caller |
| 5555 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5556 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5557 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5558 | |
| 5559 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5560 | { |
| 5561 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5562 | psessionEntry->amsduSupportedInBA; |
| 5563 | } |
| 5564 | else |
| 5565 | { |
| 5566 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5568 | |
| 5569 | // BA timeout |
| 5570 | // 0 - indicates no BA timeout |
| 5571 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5572 | |
| 5573 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5574 | |
| 5575 | if( DOT11F_FAILED( nStatus )) |
| 5576 | { |
| 5577 | limLog( pMac, LOGW, |
| 5578 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5579 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5580 | nStatus ); |
| 5581 | |
| 5582 | // We'll fall back on the worst case scenario: |
| 5583 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5584 | } |
| 5585 | else if( DOT11F_WARNED( nStatus )) |
| 5586 | { |
| 5587 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5588 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5589 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5590 | nStatus ); |
| 5591 | } |
| 5592 | |
| 5593 | // Need to allocate a buffer for ADDBA AF |
| 5594 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5595 | |
| 5596 | // Allocate shared memory |
| 5597 | if( eHAL_STATUS_SUCCESS != |
| 5598 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5599 | HAL_TXRX_FRM_802_11_MGMT, |
| 5600 | (tANI_U16) frameLen, |
| 5601 | (void **) &pAddBARspBuffer, |
| 5602 | (void **) &pPacket ))) |
| 5603 | { |
| 5604 | // Log error |
| 5605 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5606 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5607 | frameLen, |
| 5608 | halStatus ); |
| 5609 | |
| 5610 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5611 | goto returnAfterError; |
| 5612 | } |
| 5613 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5614 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5615 | |
| 5616 | // Copy necessary info to BD |
| 5617 | if( eSIR_SUCCESS != |
| 5618 | (statusCode = limPopulateMacHeader( pMac, |
| 5619 | pAddBARspBuffer, |
| 5620 | SIR_MAC_MGMT_FRAME, |
| 5621 | SIR_MAC_MGMT_ACTION, |
| 5622 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5623 | goto returnAfterError; |
| 5624 | |
| 5625 | // Update A3 with the BSSID |
| 5626 | |
| 5627 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5628 | |
| 5629 | #if 0 |
| 5630 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5631 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5632 | WNI_CFG_BSSID, |
| 5633 | (tANI_U8 *) pMacHdr->bssId, |
| 5634 | &cfgLen )) |
| 5635 | { |
| 5636 | limLog( pMac, LOGP, |
| 5637 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5638 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5639 | |
| 5640 | // FIXME - Need to convert to tSirRetStatus |
| 5641 | statusCode = eSIR_FAILURE; |
| 5642 | goto returnAfterError; |
| 5643 | } |
| 5644 | #endif // TO SUPPORT BT-AMP |
| 5645 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5646 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5647 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5648 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5649 | #endif |
| 5650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | // Now, we're ready to "pack" the frames |
| 5652 | nStatus = dot11fPackAddBARsp( pMac, |
| 5653 | &frmAddBARsp, |
| 5654 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5655 | nPayload, |
| 5656 | &nPayload ); |
| 5657 | |
| 5658 | if( DOT11F_FAILED( nStatus )) |
| 5659 | { |
| 5660 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5661 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5662 | nStatus ); |
| 5663 | |
| 5664 | // FIXME - Need to convert to tSirRetStatus |
| 5665 | statusCode = eSIR_FAILURE; |
| 5666 | goto returnAfterError; |
| 5667 | } |
| 5668 | else if( DOT11F_WARNED( nStatus )) |
| 5669 | { |
| 5670 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5671 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5672 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5673 | } |
| 5674 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5675 | limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with" |
| 5676 | " tid = %d policy = %d buffsize = %d" |
| 5677 | " amsduSupported = %d status %d"), |
| 5678 | MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr), |
| 5679 | frmAddBARsp.AddBAParameterSet.tid, |
| 5680 | frmAddBARsp.AddBAParameterSet.policy, |
| 5681 | frmAddBARsp.AddBAParameterSet.bufferSize, |
| 5682 | frmAddBARsp.AddBAParameterSet.amsduSupported, |
| 5683 | frmAddBARsp.Status.status); |
| 5684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5685 | |
| 5686 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5688 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5689 | ) |
| 5690 | { |
| 5691 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5692 | } |
| 5693 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5694 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5695 | psessionEntry->peSessionId, |
| 5696 | pMacHdr->fc.subType)); |
| 5697 | halStatus = halTxFrame( pMac, |
| 5698 | pPacket, |
| 5699 | (tANI_U16) frameLen, |
| 5700 | HAL_TXRX_FRM_802_11_MGMT, |
| 5701 | ANI_TXDIR_TODS, |
| 5702 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5703 | limTxComplete, |
| 5704 | pAddBARspBuffer, txFlag ); |
| 5705 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5706 | psessionEntry->peSessionId, |
| 5707 | halStatus)); |
| 5708 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5709 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5710 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5711 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5712 | halStatus ); |
| 5713 | |
| 5714 | // FIXME - HAL error codes are different from PE error |
| 5715 | // codes!! And, this routine is returning tSirRetStatus |
| 5716 | statusCode = eSIR_FAILURE; |
| 5717 | //Pkt will be freed up by the callback |
| 5718 | return statusCode; |
| 5719 | } |
| 5720 | else |
| 5721 | return eSIR_SUCCESS; |
| 5722 | |
| 5723 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | // Release buffer, if allocated |
| 5725 | if( NULL != pAddBARspBuffer ) |
| 5726 | palPktFree( pMac->hHdd, |
| 5727 | HAL_TXRX_FRM_802_11_MGMT, |
| 5728 | (void *) pAddBARspBuffer, |
| 5729 | (void *) pPacket ); |
| 5730 | |
| 5731 | return statusCode; |
| 5732 | } |
| 5733 | |
| 5734 | /** |
| 5735 | * \brief Send a DELBA Indication Action Frame to peer |
| 5736 | * |
| 5737 | * \sa limSendDelBAInd |
| 5738 | * |
| 5739 | * \param pMac The global tpAniSirGlobal object |
| 5740 | * |
| 5741 | * \param peerMacAddr MAC Address of peer |
| 5742 | * |
| 5743 | * \param reasonCode Reason for the DELBA notification |
| 5744 | * |
| 5745 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5746 | * This identifies the TID for which the BA session is |
| 5747 | * being deleted. |
| 5748 | * |
| 5749 | * \return eSIR_SUCCESS if setup completes successfully |
| 5750 | * eSIR_FAILURE is some problem is encountered |
| 5751 | */ |
| 5752 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5753 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5754 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5755 | tDot11fDelBAInd frmDelBAInd; |
| 5756 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5757 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5758 | tpSirMacMgmtHdr pMacHdr; |
| 5759 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5760 | tSirRetStatus statusCode; |
| 5761 | eHalStatus halStatus; |
| 5762 | void *pPacket; |
| 5763 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | |
| 5765 | if(NULL == psessionEntry) |
| 5766 | { |
| 5767 | return eSIR_FAILURE; |
| 5768 | } |
| 5769 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5770 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5771 | |
| 5772 | // Category - 3 (BA) |
| 5773 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5774 | // Action - 2 (DELBA) |
| 5775 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5776 | |
| 5777 | // Fill the DELBA Parameter Set as provided by caller |
| 5778 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5779 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5780 | |
| 5781 | // BA Starting Sequence Number |
| 5782 | // Fragment number will always be zero |
| 5783 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5784 | |
| 5785 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5786 | |
| 5787 | if( DOT11F_FAILED( nStatus )) |
| 5788 | { |
| 5789 | limLog( pMac, LOGW, |
| 5790 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5791 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5792 | nStatus ); |
| 5793 | |
| 5794 | // We'll fall back on the worst case scenario: |
| 5795 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5796 | } |
| 5797 | else if( DOT11F_WARNED( nStatus )) |
| 5798 | { |
| 5799 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5800 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5801 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5802 | nStatus ); |
| 5803 | } |
| 5804 | |
| 5805 | // Add the MGMT header to frame length |
| 5806 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5807 | |
| 5808 | // Allocate shared memory |
| 5809 | if( eHAL_STATUS_SUCCESS != |
| 5810 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5811 | HAL_TXRX_FRM_802_11_MGMT, |
| 5812 | (tANI_U16) frameLen, |
| 5813 | (void **) &pDelBAIndBuffer, |
| 5814 | (void **) &pPacket ))) |
| 5815 | { |
| 5816 | // Log error |
| 5817 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5818 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5819 | frameLen, |
| 5820 | halStatus ); |
| 5821 | |
| 5822 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5823 | goto returnAfterError; |
| 5824 | } |
| 5825 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5826 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5827 | |
| 5828 | // Copy necessary info to BD |
| 5829 | if( eSIR_SUCCESS != |
| 5830 | (statusCode = limPopulateMacHeader( pMac, |
| 5831 | pDelBAIndBuffer, |
| 5832 | SIR_MAC_MGMT_FRAME, |
| 5833 | SIR_MAC_MGMT_ACTION, |
| 5834 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5835 | goto returnAfterError; |
| 5836 | |
| 5837 | // Update A3 with the BSSID |
| 5838 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5839 | |
| 5840 | #if 0 |
| 5841 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5842 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5843 | WNI_CFG_BSSID, |
| 5844 | (tANI_U8 *) pMacHdr->bssId, |
| 5845 | &cfgLen )) |
| 5846 | { |
| 5847 | limLog( pMac, LOGP, |
| 5848 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5849 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5850 | |
| 5851 | // FIXME - Need to convert to tSirRetStatus |
| 5852 | statusCode = eSIR_FAILURE; |
| 5853 | goto returnAfterError; |
| 5854 | } |
| 5855 | #endif //TO SUPPORT BT-AMP |
| 5856 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5857 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5858 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5859 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5860 | #endif |
| 5861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5862 | // Now, we're ready to "pack" the frames |
| 5863 | nStatus = dot11fPackDelBAInd( pMac, |
| 5864 | &frmDelBAInd, |
| 5865 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5866 | nPayload, |
| 5867 | &nPayload ); |
| 5868 | |
| 5869 | if( DOT11F_FAILED( nStatus )) |
| 5870 | { |
| 5871 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5872 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5873 | nStatus ); |
| 5874 | |
| 5875 | // FIXME - Need to convert to tSirRetStatus |
| 5876 | statusCode = eSIR_FAILURE; |
| 5877 | goto returnAfterError; |
| 5878 | } |
| 5879 | else if( DOT11F_WARNED( nStatus )) |
| 5880 | { |
| 5881 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5882 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5883 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5884 | } |
| 5885 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5886 | limLog( pMac, LOG1, |
| 5887 | FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d" |
| 5888 | " initiator = %d reason = %d" ), |
| 5889 | MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr), |
| 5890 | frmDelBAInd.DelBAParameterSet.tid, |
| 5891 | frmDelBAInd.DelBAParameterSet.initiator, |
| 5892 | frmDelBAInd.Reason.code); |
| 5893 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5894 | |
| 5895 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5896 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5897 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5898 | ) |
| 5899 | { |
| 5900 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5901 | } |
| 5902 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5903 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5904 | psessionEntry->peSessionId, |
| 5905 | pMacHdr->fc.subType)); |
| 5906 | halStatus = halTxFrame( pMac, |
| 5907 | pPacket, |
| 5908 | (tANI_U16) frameLen, |
| 5909 | HAL_TXRX_FRM_802_11_MGMT, |
| 5910 | ANI_TXDIR_TODS, |
| 5911 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5912 | limTxComplete, |
| 5913 | pDelBAIndBuffer, txFlag ); |
| 5914 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5915 | psessionEntry->peSessionId, |
| 5916 | halStatus)); |
| 5917 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5918 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5919 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5920 | statusCode = eSIR_FAILURE; |
| 5921 | //Pkt will be freed up by the callback |
| 5922 | return statusCode; |
| 5923 | } |
| 5924 | else |
| 5925 | return eSIR_SUCCESS; |
| 5926 | |
| 5927 | returnAfterError: |
| 5928 | |
| 5929 | // Release buffer, if allocated |
| 5930 | if( NULL != pDelBAIndBuffer ) |
| 5931 | palPktFree( pMac->hHdd, |
| 5932 | HAL_TXRX_FRM_802_11_MGMT, |
| 5933 | (void *) pDelBAIndBuffer, |
| 5934 | (void *) pPacket ); |
| 5935 | |
| 5936 | return statusCode; |
| 5937 | } |
| 5938 | |
| 5939 | #if defined WLAN_FEATURE_VOWIFI |
| 5940 | |
| 5941 | /** |
| 5942 | * \brief Send a Neighbor Report Request Action frame |
| 5943 | * |
| 5944 | * |
| 5945 | * \param pMac Pointer to the global MAC structure |
| 5946 | * |
| 5947 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5948 | * |
| 5949 | * \param peer mac address of peer station. |
| 5950 | * |
| 5951 | * \param psessionEntry address of session entry. |
| 5952 | * |
| 5953 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5954 | * |
| 5955 | * |
| 5956 | */ |
| 5957 | |
| 5958 | tSirRetStatus |
| 5959 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5960 | tpSirMacNeighborReportReq pNeighborReq, |
| 5961 | tSirMacAddr peer, |
| 5962 | tpPESession psessionEntry |
| 5963 | ) |
| 5964 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5965 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5966 | tDot11fNeighborReportRequest frm; |
| 5967 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5968 | tpSirMacMgmtHdr pMacHdr; |
| 5969 | tANI_U32 nBytes, nPayload, nStatus; |
| 5970 | void *pPacket; |
| 5971 | eHalStatus halstatus; |
| 5972 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5973 | |
| 5974 | if ( psessionEntry == NULL ) |
| 5975 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5976 | 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] | 5977 | return eSIR_FAILURE; |
| 5978 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5979 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | |
| 5981 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5982 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5983 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5984 | |
| 5985 | |
| 5986 | if( pNeighborReq->ssid_present ) |
| 5987 | { |
| 5988 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5989 | } |
| 5990 | |
| 5991 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5992 | if ( DOT11F_FAILED( nStatus ) ) |
| 5993 | { |
| 5994 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5995 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5996 | nStatus ); |
| 5997 | // We'll fall back on the worst case scenario: |
| 5998 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5999 | } |
| 6000 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6001 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6002 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6003 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6004 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6005 | } |
| 6006 | |
| 6007 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6008 | |
| 6009 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6010 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6011 | { |
| 6012 | 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] | 6013 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | return eSIR_FAILURE; |
| 6015 | } |
| 6016 | |
| 6017 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6018 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6019 | |
| 6020 | // Copy necessary info to BD |
| 6021 | if( eSIR_SUCCESS != |
| 6022 | (statusCode = limPopulateMacHeader( pMac, |
| 6023 | pFrame, |
| 6024 | SIR_MAC_MGMT_FRAME, |
| 6025 | SIR_MAC_MGMT_ACTION, |
| 6026 | peer, psessionEntry->selfMacAddr))) |
| 6027 | goto returnAfterError; |
| 6028 | |
| 6029 | // Update A3 with the BSSID |
| 6030 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6031 | |
| 6032 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6033 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6034 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6035 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6036 | #endif |
| 6037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | // Now, we're ready to "pack" the frames |
| 6039 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 6040 | &frm, |
| 6041 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6042 | nPayload, |
| 6043 | &nPayload ); |
| 6044 | |
| 6045 | if( DOT11F_FAILED( nStatus )) |
| 6046 | { |
| 6047 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6048 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6049 | nStatus ); |
| 6050 | |
| 6051 | // FIXME - Need to convert to tSirRetStatus |
| 6052 | statusCode = eSIR_FAILURE; |
| 6053 | goto returnAfterError; |
| 6054 | } |
| 6055 | else if( DOT11F_WARNED( nStatus )) |
| 6056 | { |
| 6057 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6058 | FL( "There were warnings while packing Neighbor Report " |
| 6059 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6060 | } |
| 6061 | |
| 6062 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6063 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6064 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6065 | |
| 6066 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6067 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6068 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6069 | ) |
| 6070 | { |
| 6071 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6072 | } |
| 6073 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6074 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6075 | psessionEntry->peSessionId, |
| 6076 | pMacHdr->fc.subType)); |
| 6077 | halstatus = halTxFrame( pMac, |
| 6078 | pPacket, |
| 6079 | (tANI_U16) nBytes, |
| 6080 | HAL_TXRX_FRM_802_11_MGMT, |
| 6081 | ANI_TXDIR_TODS, |
| 6082 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6083 | limTxComplete, |
| 6084 | pFrame, txFlag ); |
| 6085 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6086 | psessionEntry->peSessionId, |
| 6087 | halstatus)); |
| 6088 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6089 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6090 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6091 | statusCode = eSIR_FAILURE; |
| 6092 | //Pkt will be freed up by the callback |
| 6093 | return statusCode; |
| 6094 | } |
| 6095 | else |
| 6096 | return eSIR_SUCCESS; |
| 6097 | |
| 6098 | returnAfterError: |
| 6099 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6100 | |
| 6101 | return statusCode; |
| 6102 | } // End limSendNeighborReportRequestFrame. |
| 6103 | |
| 6104 | /** |
| 6105 | * \brief Send a Link Report Action frame |
| 6106 | * |
| 6107 | * |
| 6108 | * \param pMac Pointer to the global MAC structure |
| 6109 | * |
| 6110 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6111 | * |
| 6112 | * \param peer mac address of peer station. |
| 6113 | * |
| 6114 | * \param psessionEntry address of session entry. |
| 6115 | * |
| 6116 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6117 | * |
| 6118 | * |
| 6119 | */ |
| 6120 | |
| 6121 | tSirRetStatus |
| 6122 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6123 | tpSirMacLinkReport pLinkReport, |
| 6124 | tSirMacAddr peer, |
| 6125 | tpPESession psessionEntry |
| 6126 | ) |
| 6127 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6128 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | tDot11fLinkMeasurementReport frm; |
| 6130 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6131 | tpSirMacMgmtHdr pMacHdr; |
| 6132 | tANI_U32 nBytes, nPayload, nStatus; |
| 6133 | void *pPacket; |
| 6134 | eHalStatus halstatus; |
| 6135 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6136 | |
| 6137 | |
| 6138 | if ( psessionEntry == NULL ) |
| 6139 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6140 | 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] | 6141 | return eSIR_FAILURE; |
| 6142 | } |
| 6143 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6144 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6145 | |
| 6146 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6147 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6148 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6149 | |
| 6150 | |
| 6151 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6152 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6153 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6154 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6155 | //such case this way than changing the frame parser. |
| 6156 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6157 | frm.TPCEleLen.TPCLen = 2; |
| 6158 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6159 | frm.LinkMargin.linkMargin = 0; |
| 6160 | |
| 6161 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6162 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6163 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6164 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6165 | |
| 6166 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6167 | if ( DOT11F_FAILED( nStatus ) ) |
| 6168 | { |
| 6169 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6170 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6171 | nStatus ); |
| 6172 | // We'll fall back on the worst case scenario: |
| 6173 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6174 | } |
| 6175 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6176 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6177 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6178 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6179 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | } |
| 6181 | |
| 6182 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6183 | |
| 6184 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6185 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6186 | { |
| 6187 | 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] | 6188 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6189 | return eSIR_FAILURE; |
| 6190 | } |
| 6191 | |
| 6192 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6193 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6194 | |
| 6195 | // Copy necessary info to BD |
| 6196 | if( eSIR_SUCCESS != |
| 6197 | (statusCode = limPopulateMacHeader( pMac, |
| 6198 | pFrame, |
| 6199 | SIR_MAC_MGMT_FRAME, |
| 6200 | SIR_MAC_MGMT_ACTION, |
| 6201 | peer, psessionEntry->selfMacAddr))) |
| 6202 | goto returnAfterError; |
| 6203 | |
| 6204 | // Update A3 with the BSSID |
| 6205 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6206 | |
| 6207 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6208 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6209 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6210 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6211 | #endif |
| 6212 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6213 | // Now, we're ready to "pack" the frames |
| 6214 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6215 | &frm, |
| 6216 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6217 | nPayload, |
| 6218 | &nPayload ); |
| 6219 | |
| 6220 | if( DOT11F_FAILED( nStatus )) |
| 6221 | { |
| 6222 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6223 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6224 | nStatus ); |
| 6225 | |
| 6226 | // FIXME - Need to convert to tSirRetStatus |
| 6227 | statusCode = eSIR_FAILURE; |
| 6228 | goto returnAfterError; |
| 6229 | } |
| 6230 | else if( DOT11F_WARNED( nStatus )) |
| 6231 | { |
| 6232 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6233 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6234 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6235 | } |
| 6236 | |
| 6237 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6238 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6239 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6240 | |
| 6241 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6242 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6243 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6244 | ) |
| 6245 | { |
| 6246 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6247 | } |
| 6248 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6249 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6250 | psessionEntry->peSessionId, |
| 6251 | pMacHdr->fc.subType)); |
| 6252 | halstatus = halTxFrame( pMac, |
| 6253 | pPacket, |
| 6254 | (tANI_U16) nBytes, |
| 6255 | HAL_TXRX_FRM_802_11_MGMT, |
| 6256 | ANI_TXDIR_TODS, |
| 6257 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6258 | limTxComplete, |
| 6259 | pFrame, txFlag ); |
| 6260 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6261 | psessionEntry->peSessionId, |
| 6262 | halstatus)); |
| 6263 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6264 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6265 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6266 | statusCode = eSIR_FAILURE; |
| 6267 | //Pkt will be freed up by the callback |
| 6268 | return statusCode; |
| 6269 | } |
| 6270 | else |
| 6271 | return eSIR_SUCCESS; |
| 6272 | |
| 6273 | returnAfterError: |
| 6274 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6275 | |
| 6276 | return statusCode; |
| 6277 | } // End limSendLinkReportActionFrame. |
| 6278 | |
| 6279 | /** |
| 6280 | * \brief Send a Beacon Report Action frame |
| 6281 | * |
| 6282 | * |
| 6283 | * \param pMac Pointer to the global MAC structure |
| 6284 | * |
| 6285 | * \param dialog_token dialog token to be used in the action frame. |
| 6286 | * |
| 6287 | * \param num_report number of reports in pRRMReport. |
| 6288 | * |
| 6289 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6290 | * |
| 6291 | * \param peer mac address of peer station. |
| 6292 | * |
| 6293 | * \param psessionEntry address of session entry. |
| 6294 | * |
| 6295 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6296 | * |
| 6297 | * |
| 6298 | */ |
| 6299 | |
| 6300 | tSirRetStatus |
| 6301 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6302 | tANI_U8 dialog_token, |
| 6303 | tANI_U8 num_report, |
| 6304 | tpSirMacRadioMeasureReport pRRMReport, |
| 6305 | tSirMacAddr peer, |
| 6306 | tpPESession psessionEntry |
| 6307 | ) |
| 6308 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6309 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6310 | tANI_U8 *pFrame; |
| 6311 | tpSirMacMgmtHdr pMacHdr; |
| 6312 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6314 | eHalStatus halstatus; |
| 6315 | tANI_U8 i; |
| 6316 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6317 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6318 | tDot11fRadioMeasurementReport *frm = |
| 6319 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6320 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6321 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6322 | return eSIR_FAILURE; |
| 6323 | } |
| 6324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | if ( psessionEntry == NULL ) |
| 6326 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6327 | 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] | 6328 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6329 | return eSIR_FAILURE; |
| 6330 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6331 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6333 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6334 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6335 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6336 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6337 | 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] | 6338 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6339 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6340 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6341 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6342 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6343 | 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] | 6344 | switch( pRRMReport[i].type ) |
| 6345 | { |
| 6346 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6347 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6348 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6349 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6350 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6351 | break; |
| 6352 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6353 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6354 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6355 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6356 | break; |
| 6357 | } |
| 6358 | } |
| 6359 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6360 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6361 | if ( DOT11F_FAILED( nStatus ) ) |
| 6362 | { |
| 6363 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6364 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6365 | nStatus ); |
| 6366 | // We'll fall back on the worst case scenario: |
| 6367 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6368 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6369 | return eSIR_FAILURE; |
| 6370 | } |
| 6371 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6372 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6373 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6374 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6375 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6379 | |
| 6380 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6381 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6382 | { |
| 6383 | 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] | 6384 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6385 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6386 | return eSIR_FAILURE; |
| 6387 | } |
| 6388 | |
| 6389 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6390 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6391 | |
| 6392 | // Copy necessary info to BD |
| 6393 | if( eSIR_SUCCESS != |
| 6394 | (statusCode = limPopulateMacHeader( pMac, |
| 6395 | pFrame, |
| 6396 | SIR_MAC_MGMT_FRAME, |
| 6397 | SIR_MAC_MGMT_ACTION, |
| 6398 | peer, psessionEntry->selfMacAddr))) |
| 6399 | goto returnAfterError; |
| 6400 | |
| 6401 | // Update A3 with the BSSID |
| 6402 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6403 | |
| 6404 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6405 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6406 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6407 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6408 | #endif |
| 6409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6410 | // Now, we're ready to "pack" the frames |
| 6411 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6412 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6413 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6414 | nPayload, |
| 6415 | &nPayload ); |
| 6416 | |
| 6417 | if( DOT11F_FAILED( nStatus )) |
| 6418 | { |
| 6419 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6420 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6421 | nStatus ); |
| 6422 | |
| 6423 | // FIXME - Need to convert to tSirRetStatus |
| 6424 | statusCode = eSIR_FAILURE; |
| 6425 | goto returnAfterError; |
| 6426 | } |
| 6427 | else if( DOT11F_WARNED( nStatus )) |
| 6428 | { |
| 6429 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6430 | FL( "There were warnings while packing Radio " |
| 6431 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6432 | } |
| 6433 | |
| 6434 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6435 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6436 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6437 | |
| 6438 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6439 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6440 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6441 | ) |
| 6442 | { |
| 6443 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6444 | } |
| 6445 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6446 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6447 | psessionEntry->peSessionId, |
| 6448 | pMacHdr->fc.subType)); |
| 6449 | halstatus = halTxFrame( pMac, |
| 6450 | pPacket, |
| 6451 | (tANI_U16) nBytes, |
| 6452 | HAL_TXRX_FRM_802_11_MGMT, |
| 6453 | ANI_TXDIR_TODS, |
| 6454 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6455 | limTxComplete, |
| 6456 | pFrame, txFlag ); |
| 6457 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6458 | psessionEntry->peSessionId, |
| 6459 | halstatus)); |
| 6460 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6461 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6462 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6463 | statusCode = eSIR_FAILURE; |
| 6464 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6465 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6466 | return statusCode; |
| 6467 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6468 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6469 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6470 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6472 | |
| 6473 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6474 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6475 | 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] | 6476 | return statusCode; |
| 6477 | } // End limSendBeaconReportActionFrame. |
| 6478 | |
| 6479 | #endif |
| 6480 | |
| 6481 | #ifdef WLAN_FEATURE_11W |
| 6482 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6483 | * \brief Send SA query request action frame to peer |
| 6484 | * |
| 6485 | * \sa limSendSaQueryRequestFrame |
| 6486 | * |
| 6487 | * |
| 6488 | * \param pMac The global tpAniSirGlobal object |
| 6489 | * |
| 6490 | * \param transId Transaction identifier |
| 6491 | * |
| 6492 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6493 | * |
| 6494 | * \param psessionEntry The PE session entry |
| 6495 | * |
| 6496 | * \return eSIR_SUCCESS if setup completes successfully |
| 6497 | * eSIR_FAILURE is some problem is encountered |
| 6498 | */ |
| 6499 | |
| 6500 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6501 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6502 | { |
| 6503 | |
| 6504 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6505 | tANI_U8 *pFrame; |
| 6506 | tSirRetStatus nSirStatus; |
| 6507 | tpSirMacMgmtHdr pMacHdr; |
| 6508 | tANI_U32 nBytes, nPayload, nStatus; |
| 6509 | void *pPacket; |
| 6510 | eHalStatus halstatus; |
| 6511 | tANI_U8 txFlag = 0; |
| 6512 | |
| 6513 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6514 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6515 | /* 11w action field is : |
| 6516 | action: 0 --> SA Query Request action frame |
| 6517 | action: 1 --> SA Query Response action frame */ |
| 6518 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6519 | /* 11w SA Query Request transId */ |
| 6520 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6521 | |
| 6522 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6523 | if ( DOT11F_FAILED( nStatus ) ) |
| 6524 | { |
| 6525 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6526 | "for an SA Query Request (0x%08x)."), |
| 6527 | nStatus ); |
| 6528 | // We'll fall back on the worst case scenario: |
| 6529 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6530 | } |
| 6531 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6532 | { |
| 6533 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6534 | "the packed size for an SA Query Request" |
| 6535 | " (0x%08x)."), nStatus ); |
| 6536 | } |
| 6537 | |
| 6538 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6539 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6540 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6541 | { |
| 6542 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6543 | "action frame"), nBytes ); |
| 6544 | return eSIR_FAILURE; |
| 6545 | } |
| 6546 | |
| 6547 | // Paranoia: |
| 6548 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6549 | |
| 6550 | // Copy necessary info to BD |
| 6551 | nSirStatus = limPopulateMacHeader( pMac, |
| 6552 | pFrame, |
| 6553 | SIR_MAC_MGMT_FRAME, |
| 6554 | SIR_MAC_MGMT_ACTION, |
| 6555 | peer, psessionEntry->selfMacAddr ); |
| 6556 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6557 | goto returnAfterError; |
| 6558 | |
| 6559 | // Update A3 with the BSSID |
| 6560 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6561 | |
| 6562 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6563 | |
| 6564 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6565 | // in the FC |
| 6566 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6567 | |
| 6568 | // Pack 11w SA Query Request frame |
| 6569 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6570 | &frm, |
| 6571 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6572 | nPayload, |
| 6573 | &nPayload ); |
| 6574 | |
| 6575 | if ( DOT11F_FAILED( nStatus )) |
| 6576 | { |
| 6577 | limLog( pMac, LOGE, |
| 6578 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6579 | nStatus ); |
| 6580 | // FIXME - Need to convert to tSirRetStatus |
| 6581 | nSirStatus = eSIR_FAILURE; |
| 6582 | goto returnAfterError; |
| 6583 | } |
| 6584 | else if ( DOT11F_WARNED( nStatus )) |
| 6585 | { |
| 6586 | limLog( pMac, LOGW, |
| 6587 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6588 | nStatus); |
| 6589 | } |
| 6590 | |
| 6591 | limLog( pMac, LOG1, |
| 6592 | FL( "Sending an SA Query Request to " )); |
| 6593 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6594 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6595 | limLog( pMac, LOGE, |
| 6596 | FL( "Sending an SA Query Request from " )); |
| 6597 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6598 | |
| 6599 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6600 | #ifdef WLAN_FEATURE_P2P |
| 6601 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6602 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6603 | #endif |
| 6604 | ) |
| 6605 | { |
| 6606 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6607 | } |
| 6608 | |
| 6609 | halstatus = halTxFrame( pMac, |
| 6610 | pPacket, |
| 6611 | (tANI_U16) nBytes, |
| 6612 | HAL_TXRX_FRM_802_11_MGMT, |
| 6613 | ANI_TXDIR_TODS, |
| 6614 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6615 | limTxComplete, |
| 6616 | pFrame, txFlag ); |
| 6617 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6618 | { |
| 6619 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6620 | nSirStatus = eSIR_FAILURE; |
| 6621 | //Pkt will be freed up by the callback |
| 6622 | return nSirStatus; |
| 6623 | } |
| 6624 | else { |
| 6625 | return eSIR_SUCCESS; |
| 6626 | } |
| 6627 | |
| 6628 | returnAfterError: |
| 6629 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6630 | return nSirStatus; |
| 6631 | } // End limSendSaQueryRequestFrame |
| 6632 | |
| 6633 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6634 | * \brief Send SA query response action frame to peer |
| 6635 | * |
| 6636 | * \sa limSendSaQueryResponseFrame |
| 6637 | * |
| 6638 | * |
| 6639 | * \param pMac The global tpAniSirGlobal object |
| 6640 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6641 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6643 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6644 | * |
| 6645 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | * |
| 6647 | * \return eSIR_SUCCESS if setup completes successfully |
| 6648 | * eSIR_FAILURE is some problem is encountered |
| 6649 | */ |
| 6650 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6651 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6652 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6653 | { |
| 6654 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6655 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6656 | tANI_U8 *pFrame; |
| 6657 | tSirRetStatus nSirStatus; |
| 6658 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6659 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | void *pPacket; |
| 6661 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6662 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6664 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6665 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6666 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | action: 0 --> SA query request action frame |
| 6668 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6669 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6670 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6672 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6673 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6674 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6675 | if ( DOT11F_FAILED( nStatus ) ) |
| 6676 | { |
| 6677 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6678 | "or a SA Query Response (0x%08x)."), |
| 6679 | nStatus ); |
| 6680 | // We'll fall back on the worst case scenario: |
| 6681 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6682 | } |
| 6683 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6684 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6685 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6686 | "the packed size for an SA Query Response" |
| 6687 | " (0x%08x)."), nStatus ); |
| 6688 | } |
| 6689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6691 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6692 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6693 | { |
| 6694 | 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] | 6695 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6696 | return eSIR_FAILURE; |
| 6697 | } |
| 6698 | |
| 6699 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6700 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6701 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6702 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6703 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6704 | pFrame, |
| 6705 | SIR_MAC_MGMT_FRAME, |
| 6706 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6707 | peer, psessionEntry->selfMacAddr ); |
| 6708 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6709 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6710 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6711 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6712 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6713 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6714 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6715 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6716 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6717 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6718 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6719 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6720 | // Pack 11w SA query response frame |
| 6721 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6722 | &frm, |
| 6723 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6724 | nPayload, |
| 6725 | &nPayload ); |
| 6726 | |
| 6727 | if ( DOT11F_FAILED( nStatus )) |
| 6728 | { |
| 6729 | limLog( pMac, LOGE, |
| 6730 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6731 | nStatus ); |
| 6732 | // FIXME - Need to convert to tSirRetStatus |
| 6733 | nSirStatus = eSIR_FAILURE; |
| 6734 | goto returnAfterError; |
| 6735 | } |
| 6736 | else if ( DOT11F_WARNED( nStatus )) |
| 6737 | { |
| 6738 | limLog( pMac, LOGW, |
| 6739 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6740 | nStatus); |
| 6741 | } |
| 6742 | |
| 6743 | limLog( pMac, LOG1, |
| 6744 | FL( "Sending a SA Query Response to " )); |
| 6745 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6746 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6747 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6748 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6749 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6750 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6751 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6752 | ) |
| 6753 | { |
| 6754 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6755 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6756 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6757 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6758 | psessionEntry->peSessionId, |
| 6759 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6760 | halstatus = halTxFrame( pMac, |
| 6761 | pPacket, |
| 6762 | (tANI_U16) nBytes, |
| 6763 | HAL_TXRX_FRM_802_11_MGMT, |
| 6764 | ANI_TXDIR_TODS, |
| 6765 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6766 | limTxComplete, |
| 6767 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6768 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6769 | psessionEntry->peSessionId, |
| 6770 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6771 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6772 | { |
| 6773 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6774 | nSirStatus = eSIR_FAILURE; |
| 6775 | //Pkt will be freed up by the callback |
| 6776 | return nSirStatus; |
| 6777 | } |
| 6778 | else { |
| 6779 | return eSIR_SUCCESS; |
| 6780 | } |
| 6781 | |
| 6782 | returnAfterError: |
| 6783 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6784 | return nSirStatus; |
| 6785 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6786 | #endif |