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 | |
| 65 | |
| 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; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 320 | tANI_U32 chanbond24G = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | |
| 322 | #ifndef GEN4_SCAN |
| 323 | return eSIR_FAILURE; |
| 324 | #endif |
| 325 | |
| 326 | #if defined ( ANI_DVT_DEBUG ) |
| 327 | return eSIR_FAILURE; |
| 328 | #endif |
| 329 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame] | 330 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 331 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 332 | * is false and dot11mode is 11ac set it to 11n. |
| 333 | */ |
| 334 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 335 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 336 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 337 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 338 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 339 | /* |
| 340 | * session context may or may not be present, when probe request needs to be sent out. |
| 341 | * following cases exist: |
| 342 | * --heartbeat failure: session needed |
| 343 | * --join req: session needed |
| 344 | * --foreground scan: no session |
| 345 | * --background scan: no session |
| 346 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 347 | * If session context does not exist, some IEs will be populated from CFGs, |
| 348 | * e.g. Supported and Extended rate set IEs |
| 349 | */ |
| 350 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 351 | |
| 352 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 353 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 354 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 355 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 356 | |
| 357 | // & delegating to assorted helpers: |
| 358 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 360 | if( nAdditionalIELen && pAdditionalIE ) |
| 361 | { |
| 362 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 363 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 364 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 365 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 366 | ( p2pIe != NULL ) && |
| 367 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 368 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 369 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 370 | ( ( psessionEntry != NULL ) && |
| 371 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 372 | ) |
| 373 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 374 | { |
| 375 | /* In the below API pass channel number > 14, do that it fills only |
| 376 | * 11a rates in supported rates */ |
| 377 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 378 | } |
| 379 | else |
| 380 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 382 | &pr.SuppRates,psessionEntry); |
| 383 | |
| 384 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 385 | { |
| 386 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | |
| 390 | #if defined WLAN_FEATURE_VOWIFI |
| 391 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 392 | //DS params "can" be present in RRM is disabled and "is" present if |
| 393 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 394 | //RRM is not enabled. |
| 395 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 396 | //Call RRM module to get the tx power for management used. |
| 397 | { |
| 398 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 399 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 400 | } |
| 401 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 402 | |
| 403 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 404 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 406 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 407 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 408 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 409 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 410 | } else { //psessionEntry == NULL |
| 411 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 412 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 413 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 414 | } |
| 415 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 416 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 417 | /* Get HT40 capability for 2.4GHz band */ |
| 418 | wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G); |
| 419 | if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 420 | { |
| 421 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 422 | pr.HTCaps.shortGI40MHz = 0; |
| 423 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 424 | #ifdef WLAN_FEATURE_11AC |
| 425 | if (psessionEntry != NULL ) { |
| 426 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 427 | //Include HT Capability IE |
| 428 | if (psessionEntry->vhtCapability) |
| 429 | { |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 430 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 431 | } |
| 432 | } else { |
| 433 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 434 | { |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 435 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 436 | } |
| 437 | } |
| 438 | #endif |
| 439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 440 | |
| 441 | // That's it-- now we pack it. First, how much space are we going to |
| 442 | // need? |
| 443 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 444 | if ( DOT11F_FAILED( nStatus ) ) |
| 445 | { |
| 446 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 447 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | // We'll fall back on the worst case scenario: |
| 449 | nPayload = sizeof( tDot11fProbeRequest ); |
| 450 | } |
| 451 | else if ( DOT11F_WARNED( nStatus ) ) |
| 452 | { |
| 453 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 454 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 455 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 459 | |
| 460 | // Ok-- try to allocate some memory: |
| 461 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 462 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 463 | ( void** ) &pPacket ); |
| 464 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 465 | { |
| 466 | 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] | 467 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | return eSIR_MEM_ALLOC_FAILED; |
| 469 | } |
| 470 | |
| 471 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 472 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 473 | |
| 474 | // Next, we fill out the buffer descriptor: |
| 475 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 476 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | if ( eSIR_SUCCESS != nSirStatus ) |
| 478 | { |
| 479 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 480 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | nSirStatus ); |
| 482 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 483 | ( void* ) pFrame, ( void* ) pPacket ); |
| 484 | return nSirStatus; // allocated! |
| 485 | } |
| 486 | |
| 487 | // That done, pack the Probe Request: |
| 488 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 489 | sizeof( tSirMacMgmtHdr ), |
| 490 | nPayload, &nPayload ); |
| 491 | if ( DOT11F_FAILED( nStatus ) ) |
| 492 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 493 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | nStatus ); |
| 495 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 496 | return eSIR_FAILURE; // allocated! |
| 497 | } |
| 498 | else if ( DOT11F_WARNED( nStatus ) ) |
| 499 | { |
| 500 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 501 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | // Append any AddIE if present. |
| 505 | if( nAdditionalIELen ) |
| 506 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 507 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | pAdditionalIE, nAdditionalIELen ); |
| 509 | nPayload += nAdditionalIELen; |
| 510 | } |
| 511 | |
| 512 | /* If this probe request is sent during P2P Search State, then we need |
| 513 | * to send it at OFDM rate. |
| 514 | */ |
| 515 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 517 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 518 | /* For unicast probe req mgmt from Join function |
| 519 | we don't set above variables. So we need to add |
| 520 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 521 | || ( ( psessionEntry != NULL ) && |
| 522 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 523 | ) |
| 524 | { |
| 525 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 526 | } |
| 527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 528 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 529 | HAL_TXRX_FRM_802_11_MGMT, |
| 530 | ANI_TXDIR_TODS, |
| 531 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 532 | limTxComplete, pFrame, txFlag ); |
| 533 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 534 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 535 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | //Pkt will be freed up by the callback |
| 537 | return eSIR_FAILURE; |
| 538 | } |
| 539 | |
| 540 | return eSIR_SUCCESS; |
| 541 | } // End limSendProbeReqMgmtFrame. |
| 542 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 543 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 544 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 545 | tANI_U8 probeReqP2pIe) |
| 546 | { |
| 547 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 548 | from additional IE */ |
| 549 | if(!probeReqP2pIe) |
| 550 | { |
| 551 | tANI_U8* tempbuf = NULL; |
| 552 | tANI_U16 tempLen = 0; |
| 553 | int left = *addnIELen; |
| 554 | v_U8_t *ptr = addIE; |
| 555 | v_U8_t elem_id, elem_len; |
| 556 | |
| 557 | if(NULL == addIE) |
| 558 | { |
| 559 | PELOGE(limLog(pMac, LOGE, |
| 560 | FL(" NULL addIE pointer"));) |
| 561 | return eSIR_FAILURE; |
| 562 | } |
| 563 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 564 | tempbuf = vos_mem_malloc(left); |
| 565 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | { |
| 567 | PELOGE(limLog(pMac, LOGE, |
| 568 | FL("Unable to allocate memory to store addn IE"));) |
| 569 | return eSIR_MEM_ALLOC_FAILED; |
| 570 | } |
| 571 | |
| 572 | while(left >= 2) |
| 573 | { |
| 574 | elem_id = ptr[0]; |
| 575 | elem_len = ptr[1]; |
| 576 | left -= 2; |
| 577 | if(elem_len > left) |
| 578 | { |
| 579 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 580 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 581 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 582 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 583 | return eSIR_FAILURE; |
| 584 | } |
| 585 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 586 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 587 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 588 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | tempLen += (elem_len + 2); |
| 590 | } |
| 591 | left -= elem_len; |
| 592 | ptr += (elem_len + 2); |
| 593 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 594 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 595 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 596 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 597 | } |
| 598 | return eSIR_SUCCESS; |
| 599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | |
| 601 | void |
| 602 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 603 | tSirMacAddr peerMacAddr, |
| 604 | tpAniSSID pSsid, |
| 605 | short nStaId, |
| 606 | tANI_U8 nKeepAlive, |
| 607 | tpPESession psessionEntry, |
| 608 | tANI_U8 probeReqP2pIe) |
| 609 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 610 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 611 | tSirRetStatus nSirStatus; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 612 | tANI_U32 cfg, nPayload, nStatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 613 | tpSirMacMgmtHdr pMacHdr; |
| 614 | tANI_U8 *pFrame; |
| 615 | void *pPacket; |
| 616 | eHalStatus halstatus; |
| 617 | tANI_U32 addnIEPresent; |
| 618 | tANI_U32 addnIE1Len=0; |
| 619 | tANI_U32 addnIE2Len=0; |
| 620 | tANI_U32 addnIE3Len=0; |
| 621 | tANI_U16 totalAddnIeLen = 0; |
| 622 | tANI_U32 wpsApEnable=0, tmp; |
| 623 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 624 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 625 | tANI_U8 *pP2pIe = NULL; |
| 626 | tANI_U8 noaLen = 0; |
| 627 | tANI_U8 total_noaLen = 0; |
| 628 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 629 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 630 | 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] | 631 | tDot11fIEExtCap extractedExtCap; |
| 632 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 633 | tANI_U32 nBytes = 0; |
| 634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 635 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 636 | { |
| 637 | return; // in this case. |
| 638 | } |
| 639 | |
| 640 | if(NULL == psessionEntry) |
| 641 | { |
| 642 | return; |
| 643 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 644 | |
| 645 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 646 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 647 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 648 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 649 | return; |
| 650 | } |
| 651 | |
Girish Gowli | 0e82679 | 2014-05-17 17:56:44 +0530 | [diff] [blame] | 652 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | // Fill out 'frm', after which we'll just hand the struct off to |
| 655 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 656 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 657 | |
| 658 | // Timestamp to be updated by TFP, below. |
| 659 | |
| 660 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 661 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 662 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 663 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | } |
| 665 | else |
| 666 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 667 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 668 | if (eSIR_SUCCESS != nSirStatus) |
| 669 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 670 | 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] | 671 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 672 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 673 | return; |
| 674 | } |
| 675 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 676 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 677 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 678 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 679 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 680 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 681 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 682 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 683 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 684 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 686 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 688 | { |
| 689 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 690 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 691 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | } |
| 693 | } |
| 694 | else |
| 695 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 696 | 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] | 697 | 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] | 698 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 699 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 700 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 701 | if (wpsApEnable) |
| 702 | { |
| 703 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 704 | } |
| 705 | |
| 706 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 707 | { |
| 708 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 709 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 710 | } |
| 711 | |
| 712 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 713 | { |
| 714 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 715 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 718 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 719 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 720 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
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 | |
| 723 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 724 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 725 | |
| 726 | |
| 727 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 728 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 729 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 730 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | |
| 732 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 733 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 734 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 735 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 736 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 737 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 738 | #ifdef WLAN_FEATURE_11AC |
| 739 | if(psessionEntry->vhtCapability) |
| 740 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 741 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 742 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, eSIR_TRUE ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 743 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 744 | // we do not support multi users yet |
| 745 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 746 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 747 | } |
| 748 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 749 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 750 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 751 | if ( psessionEntry->pLimStartBssReq ) |
| 752 | { |
| 753 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 754 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 755 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 756 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 757 | } |
| 758 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 759 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | |
| 761 | #if defined(FEATURE_WLAN_WAPI) |
| 762 | if( psessionEntry->pLimStartBssReq ) |
| 763 | { |
| 764 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 765 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | #endif // defined(FEATURE_WLAN_WAPI) |
| 769 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 770 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 771 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 772 | { |
| 773 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 774 | } |
| 775 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 776 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 777 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 778 | { |
| 779 | |
| 780 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 781 | &addnIEPresent) != eSIR_SUCCESS) |
| 782 | { |
| 783 | 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] | 784 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 785 | return; |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | if (addnIEPresent) |
| 790 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 791 | |
| 792 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 793 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | { |
| 795 | PELOGE(limLog(pMac, LOGE, |
| 796 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 797 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 798 | return; |
| 799 | } |
| 800 | |
| 801 | //Probe rsp IE available |
| 802 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 803 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 804 | { |
| 805 | 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] | 806 | vos_mem_free(addIE); |
| 807 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 808 | return; |
| 809 | } |
| 810 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 811 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 812 | { |
| 813 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 814 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 815 | &addnIE1Len) ) |
| 816 | { |
| 817 | limLog(pMac, LOGP, |
| 818 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 819 | vos_mem_free(addIE); |
| 820 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 821 | return; |
| 822 | } |
| 823 | } |
| 824 | |
| 825 | //Probe rsp IE available |
| 826 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 827 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 828 | { |
| 829 | 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] | 830 | vos_mem_free(addIE); |
| 831 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | return; |
| 833 | } |
| 834 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 835 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 836 | { |
| 837 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 838 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 839 | &addnIE2Len) ) |
| 840 | { |
| 841 | limLog(pMac, LOGP, |
| 842 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 843 | vos_mem_free(addIE); |
| 844 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 845 | return; |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | //Probe rsp IE available |
| 850 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 851 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 852 | { |
| 853 | 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] | 854 | vos_mem_free(addIE); |
| 855 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | return; |
| 857 | } |
| 858 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 859 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 860 | { |
| 861 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 862 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 863 | &addIE[addnIE1Len + addnIE2Len], |
| 864 | &addnIE3Len) ) |
| 865 | { |
| 866 | limLog(pMac, LOGP, |
| 867 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 868 | vos_mem_free(addIE); |
| 869 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 870 | return; |
| 871 | } |
| 872 | } |
| 873 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 875 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 876 | { |
| 877 | limLog(pMac, LOGP, |
| 878 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 879 | vos_mem_free(addIE); |
| 880 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 881 | return; |
| 882 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 883 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 884 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 885 | addIE, |
| 886 | &totalAddnIeLen, |
| 887 | &extractedExtCap ); |
| 888 | if(eSIR_SUCCESS != nSirStatus ) |
| 889 | { |
| 890 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 891 | limLog(pMac, LOG1, |
| 892 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 893 | } |
| 894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 895 | nBytes = nBytes + totalAddnIeLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 896 | limLog(pMac, LOG1, |
| 897 | FL("probe rsp packet size is %d "), nBytes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 898 | if (probeReqP2pIe) |
| 899 | { |
| 900 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 901 | if (pP2pIe != NULL) |
| 902 | { |
| 903 | //get NoA attribute stream P2P IE |
| 904 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 905 | if (noaLen != 0) |
| 906 | { |
| 907 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 908 | &noaStream[0], noaLen); |
| 909 | nBytes = nBytes + total_noaLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 910 | limLog(pMac, LOG1, |
| 911 | FL("p2p probe rsp packet size is %d, noalength is %d"), |
| 912 | nBytes, total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 913 | } |
| 914 | } |
| 915 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | } |
| 917 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 918 | /*merge ExtCap IE*/ |
| 919 | if (extractedExtCapFlag && extractedExtCap.present) |
| 920 | { |
| 921 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 922 | } |
| 923 | |
| 924 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 925 | if ( DOT11F_FAILED( nStatus ) ) |
| 926 | { |
| 927 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 928 | "or a Probe Response (0x%08x)."), |
| 929 | nStatus ); |
| 930 | // We'll fall back on the worst case scenario: |
| 931 | nPayload = sizeof( tDot11fProbeResponse ); |
| 932 | } |
| 933 | else if ( DOT11F_WARNED( nStatus ) ) |
| 934 | { |
| 935 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 936 | "the packed size for a Probe Response " |
| 937 | "(0x%08x)."), nStatus ); |
| 938 | } |
| 939 | |
| 940 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 941 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 942 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 943 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 944 | ( void** ) &pPacket ); |
| 945 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 946 | { |
| 947 | 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] | 948 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 949 | if ( addIE != NULL ) |
| 950 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 951 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 952 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 953 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | return; |
| 955 | } |
| 956 | |
| 957 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 958 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | |
| 960 | // Next, we fill out the buffer descriptor: |
| 961 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 962 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 963 | if ( eSIR_SUCCESS != nSirStatus ) |
| 964 | { |
| 965 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 966 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 967 | nSirStatus ); |
| 968 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 969 | ( void* ) pFrame, ( void* ) pPacket ); |
| 970 | if ( addIE != NULL ) |
| 971 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 972 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 973 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 974 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | return; |
| 976 | } |
| 977 | |
| 978 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 979 | |
| 980 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 981 | |
| 982 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 983 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 984 | nPayload, &nPayload ); |
| 985 | if ( DOT11F_FAILED( nStatus ) ) |
| 986 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 987 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 988 | nStatus ); |
| 989 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 990 | if ( addIE != NULL ) |
| 991 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 992 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 993 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 994 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | return; // allocated! |
| 996 | } |
| 997 | else if ( DOT11F_WARNED( nStatus ) ) |
| 998 | { |
| 999 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1000 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1001 | } |
| 1002 | |
| 1003 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1004 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1005 | |
| 1006 | pMac->sys.probeRespond++; |
| 1007 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1008 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1009 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1010 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1013 | |
| 1014 | if ( addnIEPresent ) |
| 1015 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1016 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1018 | if (noaLen != 0) |
| 1019 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1020 | 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] | 1021 | { |
| 1022 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1023 | FL("Not able to insert NoA because of length constraint." |
| 1024 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1025 | vos_mem_free(addIE); |
| 1026 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1027 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1028 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1029 | return; |
| 1030 | } |
| 1031 | else |
| 1032 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1033 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1034 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1035 | } |
| 1036 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1037 | |
| 1038 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1040 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1041 | ) |
| 1042 | { |
| 1043 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1044 | } |
| 1045 | |
| 1046 | // Queue Probe Response frame in high priority WQ |
| 1047 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1048 | ( tANI_U16 ) nBytes, |
| 1049 | HAL_TXRX_FRM_802_11_MGMT, |
| 1050 | ANI_TXDIR_TODS, |
| 1051 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1052 | limTxComplete, pFrame, txFlag ); |
| 1053 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1054 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1055 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | //Pkt will be freed up by the callback |
| 1057 | } |
| 1058 | |
| 1059 | if ( addIE != NULL ) |
| 1060 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1061 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1062 | } |
| 1063 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1064 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1065 | return; |
| 1066 | |
| 1067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1068 | } // End limSendProbeRspMgmtFrame. |
| 1069 | |
| 1070 | void |
| 1071 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1072 | tSirMacAddr peerMacAddr, |
| 1073 | tSirAddtsReqInfo *pAddTS, |
| 1074 | tpPESession psessionEntry) |
| 1075 | { |
| 1076 | tANI_U16 i; |
| 1077 | tANI_U8 *pFrame; |
| 1078 | tSirRetStatus nSirStatus; |
| 1079 | tDot11fAddTSRequest AddTSReq; |
| 1080 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1081 | tANI_U32 nPayload, nBytes, nStatus; |
| 1082 | tpSirMacMgmtHdr pMacHdr; |
| 1083 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1084 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | tANI_U32 phyMode; |
| 1086 | #endif |
| 1087 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1088 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1089 | |
| 1090 | if(NULL == psessionEntry) |
| 1091 | { |
| 1092 | return; |
| 1093 | } |
| 1094 | |
| 1095 | if ( ! pAddTS->wmeTspecPresent ) |
| 1096 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1097 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1098 | |
| 1099 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1100 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1101 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1102 | if ( pAddTS->lleTspecPresent ) |
| 1103 | { |
| 1104 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1105 | } |
| 1106 | else |
| 1107 | { |
| 1108 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1109 | } |
| 1110 | |
| 1111 | if ( pAddTS->lleTspecPresent ) |
| 1112 | { |
| 1113 | AddTSReq.num_WMMTCLAS = 0; |
| 1114 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1115 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1116 | { |
| 1117 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1118 | &AddTSReq.TCLAS[i] ); |
| 1119 | } |
| 1120 | } |
| 1121 | else |
| 1122 | { |
| 1123 | AddTSReq.num_TCLAS = 0; |
| 1124 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1125 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1126 | { |
| 1127 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1128 | &AddTSReq.WMMTCLAS[i] ); |
| 1129 | } |
| 1130 | } |
| 1131 | |
| 1132 | if ( pAddTS->tclasProcPresent ) |
| 1133 | { |
| 1134 | if ( pAddTS->lleTspecPresent ) |
| 1135 | { |
| 1136 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1137 | AddTSReq.TCLASSPROC.present = 1; |
| 1138 | } |
| 1139 | else |
| 1140 | { |
| 1141 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1142 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1143 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1148 | if ( DOT11F_FAILED( nStatus ) ) |
| 1149 | { |
| 1150 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1151 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1152 | nStatus ); |
| 1153 | // We'll fall back on the worst case scenario: |
| 1154 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1155 | } |
| 1156 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1157 | { |
| 1158 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1159 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1160 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1161 | } |
| 1162 | } |
| 1163 | else |
| 1164 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1165 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | |
| 1167 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1168 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1169 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1170 | |
| 1171 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1172 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1173 | |
| 1174 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1175 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1176 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1177 | |
| 1178 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1179 | { |
| 1180 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1181 | } |
| 1182 | else |
| 1183 | { |
| 1184 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1185 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1186 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1187 | #endif |
| 1188 | // fillWmeTspecIE |
| 1189 | |
| 1190 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1191 | if ( DOT11F_FAILED( nStatus ) ) |
| 1192 | { |
| 1193 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1194 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1195 | nStatus ); |
| 1196 | // We'll fall back on the worst case scenario: |
| 1197 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1198 | } |
| 1199 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1200 | { |
| 1201 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1202 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1203 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1208 | |
| 1209 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1210 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1211 | ( void** ) &pPacket ); |
| 1212 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1213 | { |
| 1214 | 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] | 1215 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1216 | return; |
| 1217 | } |
| 1218 | |
| 1219 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1220 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1221 | |
| 1222 | // Next, we fill out the buffer descriptor: |
| 1223 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1224 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1225 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1226 | { |
| 1227 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1228 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | nSirStatus ); |
| 1230 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1231 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1232 | return; |
| 1233 | } |
| 1234 | |
| 1235 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1236 | |
| 1237 | #if 0 |
| 1238 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1239 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1240 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1241 | { |
| 1242 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1243 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1244 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1245 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1246 | return; |
| 1247 | } |
| 1248 | #endif //TO SUPPORT BT-AMP |
| 1249 | |
| 1250 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1251 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1252 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1253 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1254 | #endif |
| 1255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1256 | // That done, pack the struct: |
| 1257 | if ( ! pAddTS->wmeTspecPresent ) |
| 1258 | { |
| 1259 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1260 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1261 | nPayload, &nPayload ); |
| 1262 | if ( DOT11F_FAILED( nStatus ) ) |
| 1263 | { |
| 1264 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1265 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1266 | nStatus ); |
| 1267 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1268 | return; // allocated! |
| 1269 | } |
| 1270 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1271 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1272 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1273 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | } |
| 1275 | } |
| 1276 | else |
| 1277 | { |
| 1278 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1279 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1280 | nPayload, &nPayload ); |
| 1281 | if ( DOT11F_FAILED( nStatus ) ) |
| 1282 | { |
| 1283 | 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] | 1284 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1285 | nStatus ); |
| 1286 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1287 | return; // allocated! |
| 1288 | } |
| 1289 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1290 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1291 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1292 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") ); |
| 1297 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1298 | |
| 1299 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1301 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | ) |
| 1303 | { |
| 1304 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1305 | } |
| 1306 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1307 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1308 | psessionEntry->peSessionId, |
| 1309 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1310 | // Queue Addts Response frame in high priority WQ |
| 1311 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1312 | HAL_TXRX_FRM_802_11_MGMT, |
| 1313 | ANI_TXDIR_TODS, |
| 1314 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1315 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1316 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1317 | psessionEntry->peSessionId, |
| 1318 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1320 | { |
| 1321 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1322 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | //Pkt will be freed up by the callback |
| 1324 | } |
| 1325 | |
| 1326 | } // End limSendAddtsReqActionFrame. |
| 1327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | |
| 1329 | |
| 1330 | void |
| 1331 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1332 | tANI_U16 statusCode, |
| 1333 | tANI_U16 aid, |
| 1334 | tSirMacAddr peerMacAddr, |
| 1335 | tANI_U8 subType, |
| 1336 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1337 | { |
| 1338 | static tDot11fAssocResponse frm; |
| 1339 | tANI_U8 *pFrame, *macAddr; |
| 1340 | tpSirMacMgmtHdr pMacHdr; |
| 1341 | tSirRetStatus nSirStatus; |
| 1342 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1343 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1344 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1345 | void *pPacket; |
| 1346 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1347 | tUpdateBeaconParams beaconParams; |
| 1348 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1349 | tANI_U32 addnIEPresent = false; |
| 1350 | tANI_U32 addnIELen=0; |
| 1351 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1352 | tpSirAssocReq pAssocReq = NULL; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1353 | tANI_U16 addStripoffIELen = 0; |
| 1354 | tDot11fIEExtCap extractedExtCap; |
| 1355 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1356 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1357 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1358 | #ifdef WLAN_FEATURE_11W |
| 1359 | tANI_U32 retryInterval; |
| 1360 | tANI_U32 maxRetries; |
| 1361 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1362 | |
| 1363 | if(NULL == psessionEntry) |
| 1364 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1365 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1366 | return; |
| 1367 | } |
| 1368 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1369 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | |
| 1371 | limGetQosMode(psessionEntry, &qosMode); |
| 1372 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1373 | |
| 1374 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1375 | // STA sent a traffic spec. |
| 1376 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1377 | |
| 1378 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1379 | |
| 1380 | frm.Status.status = statusCode; |
| 1381 | |
| 1382 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1383 | |
| 1384 | if ( NULL == pSta ) |
| 1385 | { |
| 1386 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1387 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1388 | } |
| 1389 | else |
| 1390 | { |
| 1391 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1392 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1393 | } |
| 1394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1395 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1396 | { |
| 1397 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1398 | { |
| 1399 | pAssocReq = |
| 1400 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1401 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1402 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1403 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | } |
| 1406 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1407 | |
| 1408 | if ( NULL != pSta ) |
| 1409 | { |
| 1410 | if ( eHAL_SET == qosMode ) |
| 1411 | { |
| 1412 | if ( pSta->lleEnabled ) |
| 1413 | { |
| 1414 | lleMode = 1; |
| 1415 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1416 | { |
| 1417 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1418 | |
| 1419 | // FramesToDo:... |
| 1420 | // if ( fAddTS ) |
| 1421 | // { |
| 1422 | // tANI_U8 *pAf = pBody; |
| 1423 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1424 | // tANI_U32 tlen; |
| 1425 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1426 | // &tlen, bufLen - frameLen); |
| 1427 | // } // End if on Add TS. |
| 1428 | } |
| 1429 | } // End if on .11e enabled in 'pSta'. |
| 1430 | } // End if on QOS Mode on. |
| 1431 | |
| 1432 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1433 | { |
| 1434 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1435 | { |
| 1436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1437 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1438 | |
| 1439 | if ( pSta->wsmEnabled ) |
| 1440 | { |
| 1441 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1442 | } |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | if ( pSta->aniPeer ) |
| 1447 | { |
| 1448 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1449 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1450 | { |
| 1451 | edcaInclude = 1; |
| 1452 | } |
| 1453 | |
| 1454 | } // End if on Airgo peer. |
| 1455 | |
| 1456 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1457 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1458 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1459 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Sachin Ahuja | c3a2623 | 2014-09-23 22:27:30 +0530 | [diff] [blame] | 1460 | /* |
| 1461 | *Check the STA capability and update the HTCaps accordingly |
| 1462 | */ |
| 1463 | frm.HTCaps.supportedChannelWidthSet = |
| 1464 | (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ? |
| 1465 | pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ; |
| 1466 | |
| 1467 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1468 | frm.HTCaps.shortGI40MHz = 0; |
| 1469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1470 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1471 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1472 | |
| 1473 | #ifdef WLAN_FEATURE_11AC |
| 1474 | if( pSta->mlmStaContext.vhtCapability && |
| 1475 | psessionEntry->vhtCapability ) |
| 1476 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1477 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 1478 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1479 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1480 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1481 | } |
| 1482 | #endif |
| 1483 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1484 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1485 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1486 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1487 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1488 | &maxRetries ) != eSIR_SUCCESS ) |
| 1489 | limLog( pMac, LOGE, |
| 1490 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1491 | else |
| 1492 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1493 | &retryInterval ) != eSIR_SUCCESS) |
| 1494 | limLog( pMac, LOGE, |
| 1495 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1496 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1497 | PopulateDot11fTimeoutInterval( |
| 1498 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1499 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1500 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1501 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1502 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1503 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1504 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1506 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1507 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1508 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1510 | |
| 1511 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1512 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1513 | |
| 1514 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1515 | |
| 1516 | //Send message to HAL about beacon parameter change. |
| 1517 | if(beaconParams.paramChangeBitmap) |
| 1518 | { |
| 1519 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1520 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1521 | } |
| 1522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1523 | if ( pAssocReq != NULL ) |
| 1524 | { |
| 1525 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1526 | &addnIEPresent) != eSIR_SUCCESS) |
| 1527 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1528 | limLog(pMac, LOGP, FL("Unable to get " |
| 1529 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1530 | return; |
| 1531 | } |
| 1532 | |
| 1533 | if (addnIEPresent) |
| 1534 | { |
| 1535 | //Assoc rsp IE available |
| 1536 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1537 | &addnIELen) != eSIR_SUCCESS) |
| 1538 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1539 | limLog(pMac, LOGP, FL("Unable to get " |
| 1540 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1541 | return; |
| 1542 | } |
| 1543 | |
| 1544 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1545 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1546 | { |
| 1547 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1548 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1549 | { |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1550 | |
| 1551 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1552 | sizeof( tDot11fIEExtCap ), 0); |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 1553 | addStripoffIELen = addnIELen; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1554 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1555 | &addIE[0], |
| 1556 | &addStripoffIELen, |
| 1557 | &extractedExtCap ); |
| 1558 | if(eSIR_SUCCESS != nSirStatus) |
| 1559 | { |
| 1560 | limLog(pMac, LOG1, |
| 1561 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1562 | } |
| 1563 | else |
| 1564 | { |
| 1565 | addnIELen = addStripoffIELen; |
| 1566 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | nBytes = nBytes + addnIELen; |
| 1569 | } |
| 1570 | } |
| 1571 | } |
| 1572 | } |
| 1573 | |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1574 | /* merge the ExtCap struct*/ |
| 1575 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1576 | { |
| 1577 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap); |
| 1578 | } |
| 1579 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1580 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1581 | if ( DOT11F_FAILED( nStatus ) ) |
| 1582 | { |
| 1583 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1584 | "or an Association Response (0x%08x)."), |
| 1585 | nStatus ); |
| 1586 | return; |
| 1587 | } |
| 1588 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1589 | { |
| 1590 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1591 | "the packed size for an Association Re" |
| 1592 | "sponse (0x%08x)."), nStatus ); |
| 1593 | } |
| 1594 | |
| 1595 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1596 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1597 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1598 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1599 | ( void** ) &pPacket ); |
| 1600 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1601 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1602 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1603 | return; |
| 1604 | } |
| 1605 | |
| 1606 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1607 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | |
| 1609 | // Next, we fill out the buffer descriptor: |
| 1610 | nSirStatus = limPopulateMacHeader( pMac, |
| 1611 | pFrame, |
| 1612 | SIR_MAC_MGMT_FRAME, |
| 1613 | ( LIM_ASSOC == subType ) ? |
| 1614 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1615 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1616 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1617 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1618 | { |
| 1619 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1620 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1621 | nSirStatus ); |
| 1622 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1623 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1624 | return; |
| 1625 | } |
| 1626 | |
| 1627 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1628 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1629 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1630 | |
| 1631 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1632 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1633 | nPayload, &nPayload ); |
| 1634 | if ( DOT11F_FAILED( nStatus ) ) |
| 1635 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1636 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1637 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1638 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1639 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1640 | return; // allocated! |
| 1641 | } |
| 1642 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1643 | { |
| 1644 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1645 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1646 | } |
| 1647 | |
| 1648 | macAddr = pMacHdr->da; |
| 1649 | |
| 1650 | if (subType == LIM_ASSOC) |
| 1651 | { |
| 1652 | PELOG1(limLog(pMac, LOG1, |
| 1653 | FL("*** Sending Assoc Resp status %d aid %d to "), |
| 1654 | statusCode, aid);) |
| 1655 | } |
| 1656 | else{ |
| 1657 | PELOG1(limLog(pMac, LOG1, |
| 1658 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
| 1659 | statusCode, aid);) |
| 1660 | } |
| 1661 | PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1662 | |
| 1663 | if ( addnIEPresent ) |
| 1664 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1665 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1666 | } |
| 1667 | |
| 1668 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1670 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1671 | ) |
| 1672 | { |
| 1673 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1674 | } |
| 1675 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1676 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1677 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1678 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1679 | |
| 1680 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1681 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1682 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1683 | psessionEntry->peSessionId, |
| 1684 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | /// Queue Association Response frame in high priority WQ |
| 1686 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1687 | HAL_TXRX_FRM_802_11_MGMT, |
| 1688 | ANI_TXDIR_TODS, |
| 1689 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1690 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1691 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1692 | psessionEntry->peSessionId, |
| 1693 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1694 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1695 | { |
| 1696 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1697 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | nSirStatus); |
| 1699 | |
| 1700 | //Pkt will be freed up by the callback |
| 1701 | } |
| 1702 | |
| 1703 | // update the ANI peer station count |
| 1704 | //FIXME_PROTECTION : take care of different type of station |
| 1705 | // counter inside this function. |
| 1706 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1707 | |
| 1708 | } // End limSendAssocRspMgmtFrame. |
| 1709 | |
| 1710 | |
| 1711 | |
| 1712 | void |
| 1713 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1714 | tSirMacAddr peer, |
| 1715 | tANI_U16 nStatusCode, |
| 1716 | tSirAddtsReqInfo *pAddTS, |
| 1717 | tSirMacScheduleIE *pSchedule, |
| 1718 | tpPESession psessionEntry) |
| 1719 | { |
| 1720 | tANI_U8 *pFrame; |
| 1721 | tpSirMacMgmtHdr pMacHdr; |
| 1722 | tDot11fAddTSResponse AddTSRsp; |
| 1723 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1724 | tSirRetStatus nSirStatus; |
| 1725 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1726 | void *pPacket; |
| 1727 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1728 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1729 | |
| 1730 | if(NULL == psessionEntry) |
| 1731 | { |
| 1732 | return; |
| 1733 | } |
| 1734 | |
| 1735 | if ( ! pAddTS->wmeTspecPresent ) |
| 1736 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1737 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1738 | |
| 1739 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1740 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1741 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1742 | AddTSRsp.Status.status = nStatusCode; |
| 1743 | |
| 1744 | // The TsDelay information element is only filled in for a specific |
| 1745 | // status code: |
| 1746 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1747 | { |
| 1748 | if ( pAddTS->wsmTspecPresent ) |
| 1749 | { |
| 1750 | AddTSRsp.WMMTSDelay.version = 1; |
| 1751 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1752 | AddTSRsp.WMMTSDelay.present = 1; |
| 1753 | } |
| 1754 | else |
| 1755 | { |
| 1756 | AddTSRsp.TSDelay.delay = 10; |
| 1757 | AddTSRsp.TSDelay.present = 1; |
| 1758 | } |
| 1759 | } |
| 1760 | |
| 1761 | if ( pAddTS->wsmTspecPresent ) |
| 1762 | { |
| 1763 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1764 | } |
| 1765 | else |
| 1766 | { |
| 1767 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1768 | } |
| 1769 | |
| 1770 | if ( pAddTS->wsmTspecPresent ) |
| 1771 | { |
| 1772 | AddTSRsp.num_WMMTCLAS = 0; |
| 1773 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1774 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1775 | { |
| 1776 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1777 | &AddTSRsp.TCLAS[i] ); |
| 1778 | } |
| 1779 | } |
| 1780 | else |
| 1781 | { |
| 1782 | AddTSRsp.num_TCLAS = 0; |
| 1783 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1784 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1785 | { |
| 1786 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1787 | &AddTSRsp.WMMTCLAS[i] ); |
| 1788 | } |
| 1789 | } |
| 1790 | |
| 1791 | if ( pAddTS->tclasProcPresent ) |
| 1792 | { |
| 1793 | if ( pAddTS->wsmTspecPresent ) |
| 1794 | { |
| 1795 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1796 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1797 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1798 | } |
| 1799 | else |
| 1800 | { |
| 1801 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1802 | AddTSRsp.TCLASSPROC.present = 1; |
| 1803 | } |
| 1804 | } |
| 1805 | |
| 1806 | // schedule element is included only if requested in the tspec and we are |
| 1807 | // using hcca (or both edca and hcca) |
| 1808 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1809 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1810 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1811 | // sta figure it out |
| 1812 | if ((pSchedule != NULL) && |
| 1813 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1814 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1815 | { |
| 1816 | if ( pAddTS->wsmTspecPresent ) |
| 1817 | { |
| 1818 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1819 | } |
| 1820 | else |
| 1821 | { |
| 1822 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1823 | } |
| 1824 | } |
| 1825 | |
| 1826 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1827 | if ( DOT11F_FAILED( nStatus ) ) |
| 1828 | { |
| 1829 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1830 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | nStatus ); |
| 1832 | // We'll fall back on the worst case scenario: |
| 1833 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1834 | } |
| 1835 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1836 | { |
| 1837 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1838 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1839 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1840 | } |
| 1841 | } |
| 1842 | else |
| 1843 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1844 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | |
| 1846 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1847 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1848 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1849 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1850 | |
| 1851 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1852 | |
| 1853 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1854 | if ( DOT11F_FAILED( nStatus ) ) |
| 1855 | { |
| 1856 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1857 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1858 | nStatus ); |
| 1859 | // We'll fall back on the worst case scenario: |
| 1860 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1861 | } |
| 1862 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1863 | { |
| 1864 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1865 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1866 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1867 | } |
| 1868 | } |
| 1869 | |
| 1870 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1871 | |
| 1872 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1873 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1874 | { |
| 1875 | 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] | 1876 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1877 | return; |
| 1878 | } |
| 1879 | |
| 1880 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1881 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1882 | |
| 1883 | // Next, we fill out the buffer descriptor: |
| 1884 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1885 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1886 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1887 | { |
| 1888 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1889 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1890 | nSirStatus ); |
| 1891 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1892 | return; // allocated! |
| 1893 | } |
| 1894 | |
| 1895 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1896 | |
| 1897 | |
| 1898 | #if 0 |
| 1899 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1900 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1901 | { |
| 1902 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1903 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1904 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1905 | return; // allocated! |
| 1906 | } |
| 1907 | #endif //TO SUPPORT BT-AMP |
| 1908 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1909 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1910 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1911 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1912 | #endif |
| 1913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1914 | // That done, pack the struct: |
| 1915 | if ( ! pAddTS->wmeTspecPresent ) |
| 1916 | { |
| 1917 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1918 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1919 | nPayload, &nPayload ); |
| 1920 | if ( DOT11F_FAILED( nStatus ) ) |
| 1921 | { |
| 1922 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1923 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1924 | nStatus ); |
| 1925 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1926 | return; |
| 1927 | } |
| 1928 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1929 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1930 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1931 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1932 | } |
| 1933 | } |
| 1934 | else |
| 1935 | { |
| 1936 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1937 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1938 | nPayload, &nPayload ); |
| 1939 | if ( DOT11F_FAILED( nStatus ) ) |
| 1940 | { |
| 1941 | 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] | 1942 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | nStatus ); |
| 1944 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1945 | return; |
| 1946 | } |
| 1947 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1948 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1949 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1950 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | } |
| 1952 | } |
| 1953 | |
| 1954 | PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
| 1955 | nStatusCode ); |
| 1956 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 1957 | |
| 1958 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1959 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1960 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1961 | ) |
| 1962 | { |
| 1963 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1964 | } |
| 1965 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1966 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1967 | psessionEntry->peSessionId, |
| 1968 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1969 | // Queue the frame in high priority WQ: |
| 1970 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1971 | HAL_TXRX_FRM_802_11_MGMT, |
| 1972 | ANI_TXDIR_TODS, |
| 1973 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1974 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1975 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1976 | psessionEntry->peSessionId, |
| 1977 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1978 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1979 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1980 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1981 | nSirStatus ); |
| 1982 | //Pkt will be freed up by the callback |
| 1983 | } |
| 1984 | |
| 1985 | } // End limSendAddtsRspActionFrame. |
| 1986 | |
| 1987 | void |
| 1988 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 1989 | tSirMacAddr peer, |
| 1990 | tANI_U8 wmmTspecPresent, |
| 1991 | tSirMacTSInfo *pTsinfo, |
| 1992 | tSirMacTspecIE *pTspecIe, |
| 1993 | tpPESession psessionEntry) |
| 1994 | { |
| 1995 | tANI_U8 *pFrame; |
| 1996 | tpSirMacMgmtHdr pMacHdr; |
| 1997 | tDot11fDelTS DelTS; |
| 1998 | tDot11fWMMDelTS WMMDelTS; |
| 1999 | tSirRetStatus nSirStatus; |
| 2000 | tANI_U32 nBytes, nPayload, nStatus; |
| 2001 | void *pPacket; |
| 2002 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2003 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | |
| 2005 | if(NULL == psessionEntry) |
| 2006 | { |
| 2007 | return; |
| 2008 | } |
| 2009 | |
| 2010 | if ( ! wmmTspecPresent ) |
| 2011 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2012 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2013 | |
| 2014 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2015 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2016 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2017 | |
| 2018 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2019 | if ( DOT11F_FAILED( nStatus ) ) |
| 2020 | { |
| 2021 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2022 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2023 | nStatus ); |
| 2024 | // We'll fall back on the worst case scenario: |
| 2025 | nPayload = sizeof( tDot11fDelTS ); |
| 2026 | } |
| 2027 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2028 | { |
| 2029 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2030 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2031 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2032 | } |
| 2033 | } |
| 2034 | else |
| 2035 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2036 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2037 | |
| 2038 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2039 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2040 | WMMDelTS.DialogToken.token = 0; |
| 2041 | WMMDelTS.StatusCode.statusCode = 0; |
| 2042 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2043 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2044 | if ( DOT11F_FAILED( nStatus ) ) |
| 2045 | { |
| 2046 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2047 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2048 | nStatus ); |
| 2049 | // We'll fall back on the worst case scenario: |
| 2050 | nPayload = sizeof( tDot11fDelTS ); |
| 2051 | } |
| 2052 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2053 | { |
| 2054 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2055 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2056 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2057 | } |
| 2058 | } |
| 2059 | |
| 2060 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2061 | |
| 2062 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2063 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2064 | { |
| 2065 | 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] | 2066 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2067 | return; |
| 2068 | } |
| 2069 | |
| 2070 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2071 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | |
| 2073 | // Next, we fill out the buffer descriptor: |
| 2074 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2075 | SIR_MAC_MGMT_ACTION, peer, |
| 2076 | psessionEntry->selfMacAddr); |
| 2077 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2078 | { |
| 2079 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2080 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | nSirStatus ); |
| 2082 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2083 | return; // allocated! |
| 2084 | } |
| 2085 | |
| 2086 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2087 | |
| 2088 | #if 0 |
| 2089 | |
| 2090 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2091 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2092 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2093 | { |
| 2094 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2095 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2096 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2097 | return; // allocated! |
| 2098 | } |
| 2099 | #endif //TO SUPPORT BT-AMP |
| 2100 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2101 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2102 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2103 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2104 | #endif |
| 2105 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2106 | // That done, pack the struct: |
| 2107 | if ( !wmmTspecPresent ) |
| 2108 | { |
| 2109 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2110 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2111 | nPayload, &nPayload ); |
| 2112 | if ( DOT11F_FAILED( nStatus ) ) |
| 2113 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2114 | 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] | 2115 | nStatus ); |
| 2116 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2117 | return; // allocated! |
| 2118 | } |
| 2119 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2120 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2121 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2122 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2123 | } |
| 2124 | } |
| 2125 | else |
| 2126 | { |
| 2127 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2128 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2129 | nPayload, &nPayload ); |
| 2130 | if ( DOT11F_FAILED( nStatus ) ) |
| 2131 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2132 | 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] | 2133 | nStatus ); |
| 2134 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2135 | return; // allocated! |
| 2136 | } |
| 2137 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2138 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2139 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2140 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2141 | } |
| 2142 | } |
| 2143 | |
| 2144 | PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2145 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 2146 | |
| 2147 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2148 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2149 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2150 | ) |
| 2151 | { |
| 2152 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2153 | } |
| 2154 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2155 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2156 | psessionEntry->peSessionId, |
| 2157 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2158 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2159 | HAL_TXRX_FRM_802_11_MGMT, |
| 2160 | ANI_TXDIR_TODS, |
| 2161 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2162 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2163 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2164 | psessionEntry->peSessionId, |
| 2165 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2166 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2167 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2168 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2169 | nSirStatus ); |
| 2170 | //Pkt will be freed up by the callback |
| 2171 | } |
| 2172 | |
| 2173 | } // End limSendDeltsReqActionFrame. |
| 2174 | |
| 2175 | void |
| 2176 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2177 | tLimMlmAssocReq *pMlmAssocReq, |
| 2178 | tpPESession psessionEntry) |
| 2179 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2180 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2181 | tANI_U16 caps; |
| 2182 | tANI_U8 *pFrame; |
| 2183 | tSirRetStatus nSirStatus; |
| 2184 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2185 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2186 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2187 | void *pPacket; |
| 2188 | eHalStatus halstatus; |
| 2189 | tANI_U16 nAddIELen; |
| 2190 | tANI_U8 *pAddIE; |
| 2191 | tANI_U8 *wpsIe = NULL; |
| 2192 | #if defined WLAN_FEATURE_VOWIFI |
| 2193 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2194 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2195 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2196 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2197 | tDot11fIEExtCap extractedExtCap; |
| 2198 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2199 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2200 | |
| 2201 | if(NULL == psessionEntry) |
| 2202 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2203 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2204 | return; |
| 2205 | } |
| 2206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | /* check this early to avoid unncessary operation */ |
| 2208 | if(NULL == psessionEntry->pLimJoinReq) |
| 2209 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2210 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | return; |
| 2212 | } |
| 2213 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2214 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2215 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2216 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2217 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2218 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2219 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2220 | return; |
| 2221 | } |
| 2222 | |
| 2223 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2224 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2225 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2226 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 2227 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
| 2228 | &nAddIELen, |
| 2229 | &extractedExtCap ); |
| 2230 | if(eSIR_SUCCESS != nSirStatus ) |
| 2231 | { |
| 2232 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2233 | limLog(pMac, LOG1, |
| 2234 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2235 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2236 | /* TODO:remove this code once driver provides the call back function |
| 2237 | * to supplicant for set_qos_map |
| 2238 | */ |
| 2239 | else |
| 2240 | { |
| 2241 | if(extractedExtCap.interworkingService) |
| 2242 | { |
| 2243 | extractedExtCap.qosMap = 1; |
| 2244 | } |
| 2245 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2246 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | caps = pMlmAssocReq->capabilityInfo; |
| 2248 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2249 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2250 | #if defined(FEATURE_WLAN_WAPI) |
| 2251 | /* CR: 262463 : |
| 2252 | According to WAPI standard: |
| 2253 | 7.3.1.4 Capability Information field |
| 2254 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2255 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2256 | Reassociation management frames. */ |
| 2257 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2258 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2259 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2260 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2262 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2263 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2264 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2265 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2266 | |
| 2267 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2268 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2269 | |
| 2270 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2271 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2272 | |
| 2273 | // We prefer .11e asociations: |
| 2274 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2275 | |
| 2276 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2277 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2278 | |
| 2279 | if ( psessionEntry->lim11hEnable && |
| 2280 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2281 | { |
| 2282 | #if defined WLAN_FEATURE_VOWIFI |
| 2283 | PowerCapsPopulated = TRUE; |
| 2284 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2285 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2286 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2287 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2288 | |
| 2289 | } |
| 2290 | |
| 2291 | #if defined WLAN_FEATURE_VOWIFI |
| 2292 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2293 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2294 | { |
| 2295 | if (PowerCapsPopulated == FALSE) |
| 2296 | { |
| 2297 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2298 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2299 | } |
| 2300 | } |
| 2301 | #endif |
| 2302 | |
| 2303 | if ( fQosEnabled && |
| 2304 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2305 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2306 | |
| 2307 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2308 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2309 | |
| 2310 | #if defined WLAN_FEATURE_VOWIFI |
| 2311 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2312 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2313 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2314 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | } |
| 2316 | #endif |
| 2317 | // The join request *should* contain zero or one of the WPA and RSN |
| 2318 | // IEs. The payload send along with the request is a |
| 2319 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2320 | |
| 2321 | // typedef struct sSirRSNie |
| 2322 | // { |
| 2323 | // tANI_U16 length; |
| 2324 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2325 | // } tSirRSNie, *tpSirRSNie; |
| 2326 | |
| 2327 | // So, we should be able to make the following two calls harmlessly, |
| 2328 | // since they do nothing if they don't find the given IE in the |
| 2329 | // bytestream with which they're provided. |
| 2330 | |
| 2331 | // The net effect of this will be to faithfully transmit whatever |
| 2332 | // security IE is in the join request. |
| 2333 | |
| 2334 | // *However*, if we're associating for the purpose of WPS |
| 2335 | // enrollment, and we've been configured to indicate that by |
| 2336 | // eliding the WPA or RSN IE, we just skip this: |
| 2337 | if( nAddIELen && pAddIE ) |
| 2338 | { |
| 2339 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2340 | } |
| 2341 | if ( NULL == wpsIe ) |
| 2342 | { |
| 2343 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2344 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2345 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2346 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2347 | #if defined(FEATURE_WLAN_WAPI) |
| 2348 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2349 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2350 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2351 | } |
| 2352 | |
| 2353 | // include WME EDCA IE as well |
| 2354 | if ( fWmeEnabled ) |
| 2355 | { |
| 2356 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2357 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2358 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | } |
| 2360 | |
| 2361 | if ( fWsmEnabled && |
| 2362 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2363 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2364 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2365 | } |
| 2366 | } |
| 2367 | |
| 2368 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2369 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2370 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | pMac->lim.htCapabilityPresentInBeacon) |
| 2372 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2373 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2374 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2375 | |
| 2376 | /* |
| 2377 | * To resolve the interop problem with Broadcom AP, |
| 2378 | * where TQ STA could not pass traffic with GF enabled, |
| 2379 | * TQ STA will do Greenfield only with TQ AP, for |
| 2380 | * everybody else it will be turned off. |
| 2381 | */ |
| 2382 | |
| 2383 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2384 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2385 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2386 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2387 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2388 | } |
| 2389 | #endif |
| 2390 | |
| 2391 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2392 | #ifdef WLAN_FEATURE_11AC |
| 2393 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2394 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2395 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2396 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 2397 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2398 | } |
| 2399 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2400 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2401 | |
| 2402 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2403 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2404 | { |
| 2405 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2406 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2407 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2408 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2409 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2410 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2411 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2412 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2414 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | { |
| 2416 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2417 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2418 | } |
| 2419 | #endif |
| 2420 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2421 | #ifdef FEATURE_WLAN_ESE |
| 2422 | /* For ESE Associations fill the ESE IEs */ |
| 2423 | if (psessionEntry->isESEconnection && |
| 2424 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2425 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2426 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2427 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2428 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2429 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2430 | } |
| 2431 | #endif |
| 2432 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2433 | /* merge the ExtCap struct*/ |
| 2434 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2435 | { |
| 2436 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 2437 | } |
| 2438 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2439 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2440 | if ( DOT11F_FAILED( nStatus ) ) |
| 2441 | { |
| 2442 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2443 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2444 | nStatus ); |
| 2445 | // We'll fall back on the worst case scenario: |
| 2446 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2447 | } |
| 2448 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2449 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2450 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2451 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2452 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | } |
| 2454 | |
| 2455 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2456 | |
| 2457 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2458 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2459 | ( void** ) &pPacket ); |
| 2460 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2461 | { |
| 2462 | 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] | 2463 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2464 | |
| 2465 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2466 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | |
| 2468 | |
| 2469 | /* Update PE session id*/ |
| 2470 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2471 | |
| 2472 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2473 | |
| 2474 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2475 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2476 | |
| 2477 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2478 | ( tANI_U32* ) &mlmAssocCnf); |
| 2479 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2480 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2481 | return; |
| 2482 | } |
| 2483 | |
| 2484 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2485 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | |
| 2487 | // Next, we fill out the buffer descriptor: |
| 2488 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2489 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2490 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2491 | { |
| 2492 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2493 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2494 | nSirStatus ); |
| 2495 | 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] | 2496 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2497 | return; |
| 2498 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2499 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2500 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2501 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2502 | sizeof(tSirMacMgmtHdr), |
| 2503 | nPayload, &nPayload ); |
| 2504 | if ( DOT11F_FAILED( nStatus ) ) |
| 2505 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2506 | 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] | 2507 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2508 | nStatus ); |
| 2509 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2510 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2511 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | return; |
| 2513 | } |
| 2514 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2515 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2516 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2517 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2518 | } |
| 2519 | |
| 2520 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2521 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2522 | nBytes );) |
| 2523 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2524 | |
| 2525 | if( psessionEntry->assocReq != NULL ) |
| 2526 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2527 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2528 | psessionEntry->assocReq = NULL; |
| 2529 | } |
| 2530 | |
| 2531 | if( nAddIELen ) |
| 2532 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2533 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2534 | pAddIE, |
| 2535 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2536 | nPayload += nAddIELen; |
| 2537 | } |
| 2538 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2539 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2540 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2541 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2542 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2543 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | } |
| 2545 | else |
| 2546 | { |
| 2547 | //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] | 2548 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2549 | psessionEntry->assocReqLen = nPayload; |
| 2550 | } |
| 2551 | |
| 2552 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2553 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2554 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2555 | ) |
| 2556 | { |
| 2557 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2558 | } |
| 2559 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2560 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2561 | { |
| 2562 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2563 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2564 | |
| 2565 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2566 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2567 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2568 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2569 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2570 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2571 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2572 | psessionEntry->peSessionId, |
| 2573 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 2574 | |
| 2575 | // enable caching |
| 2576 | WLANTL_EnableCaching(psessionEntry->staId); |
| 2577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2578 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2579 | HAL_TXRX_FRM_802_11_MGMT, |
| 2580 | ANI_TXDIR_TODS, |
| 2581 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2582 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2583 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2584 | psessionEntry->peSessionId, |
| 2585 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2586 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2587 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2588 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2589 | halstatus ); |
| 2590 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2591 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2592 | return; |
| 2593 | } |
| 2594 | |
| 2595 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2596 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2597 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2598 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2599 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2600 | } // End limSendAssocReqMgmtFrame |
| 2601 | |
| 2602 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2603 | #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] | 2604 | /*------------------------------------------------------------------------------------ |
| 2605 | * |
| 2606 | * Send Reassoc Req with FTIEs. |
| 2607 | * |
| 2608 | *----------------------------------------------------------------------------------- |
| 2609 | */ |
| 2610 | void |
| 2611 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2612 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2613 | { |
| 2614 | static tDot11fReAssocRequest frm; |
| 2615 | tANI_U16 caps; |
| 2616 | tANI_U8 *pFrame; |
| 2617 | tSirRetStatus nSirStatus; |
| 2618 | tANI_U32 nBytes, nPayload, nStatus; |
| 2619 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2620 | void *pPacket; |
| 2621 | eHalStatus halstatus; |
| 2622 | #if defined WLAN_FEATURE_VOWIFI |
| 2623 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2624 | #endif |
| 2625 | tANI_U16 ft_ies_length = 0; |
| 2626 | tANI_U8 *pBody; |
| 2627 | tANI_U16 nAddIELen; |
| 2628 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2629 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2630 | tANI_U8 *wpsIe = NULL; |
| 2631 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2632 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2633 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2634 | |
| 2635 | if (NULL == psessionEntry) |
| 2636 | { |
| 2637 | return; |
| 2638 | } |
| 2639 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2640 | /* check this early to avoid unncessary operation */ |
| 2641 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2642 | { |
| 2643 | return; |
| 2644 | } |
| 2645 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2646 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2647 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2648 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2649 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2650 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2651 | |
| 2652 | caps = pMlmReassocReq->capabilityInfo; |
| 2653 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2654 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2655 | #if defined(FEATURE_WLAN_WAPI) |
| 2656 | /* CR: 262463 : |
| 2657 | According to WAPI standard: |
| 2658 | 7.3.1.4 Capability Information field |
| 2659 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2660 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2661 | Reassociation management frames. */ |
| 2662 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2663 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2664 | #endif |
| 2665 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2666 | |
| 2667 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2668 | |
| 2669 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2670 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2671 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2672 | |
| 2673 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2674 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2675 | &frm.SuppRates,psessionEntry); |
| 2676 | |
| 2677 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2678 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2679 | |
| 2680 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2681 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2682 | |
| 2683 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2684 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2685 | |
| 2686 | if ( psessionEntry->lim11hEnable && |
| 2687 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2688 | { |
| 2689 | #if defined WLAN_FEATURE_VOWIFI |
| 2690 | PowerCapsPopulated = TRUE; |
| 2691 | |
| 2692 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2693 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2694 | #endif |
| 2695 | } |
| 2696 | |
| 2697 | #if defined WLAN_FEATURE_VOWIFI |
| 2698 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2699 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2700 | { |
| 2701 | if (PowerCapsPopulated == FALSE) |
| 2702 | { |
| 2703 | PowerCapsPopulated = TRUE; |
| 2704 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2705 | } |
| 2706 | } |
| 2707 | #endif |
| 2708 | |
| 2709 | if ( fQosEnabled && |
| 2710 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2711 | { |
| 2712 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2713 | } |
| 2714 | |
| 2715 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2716 | &frm.ExtSuppRates, psessionEntry ); |
| 2717 | |
| 2718 | #if defined WLAN_FEATURE_VOWIFI |
| 2719 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2720 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2721 | { |
| 2722 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2723 | } |
| 2724 | #endif |
| 2725 | |
| 2726 | // Ideally this should be enabled for 11r also. But 11r does |
| 2727 | // not follow the usual norm of using the Opaque object |
| 2728 | // for rsnie and fties. Instead we just add |
| 2729 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2730 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2731 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | // |
| 2733 | // The join request *should* contain zero or one of the WPA and RSN |
| 2734 | // IEs. The payload send along with the request is a |
| 2735 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2736 | |
| 2737 | // typedef struct sSirRSNie |
| 2738 | // { |
| 2739 | // tANI_U16 length; |
| 2740 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2741 | // } tSirRSNie, *tpSirRSNie; |
| 2742 | |
| 2743 | // So, we should be able to make the following two calls harmlessly, |
| 2744 | // since they do nothing if they don't find the given IE in the |
| 2745 | // bytestream with which they're provided. |
| 2746 | |
| 2747 | // The net effect of this will be to faithfully transmit whatever |
| 2748 | // security IE is in the join request. |
| 2749 | |
| 2750 | // *However*, if we're associating for the purpose of WPS |
| 2751 | // enrollment, and we've been configured to indicate that by |
| 2752 | // eliding the WPA or RSN IE, we just skip this: |
| 2753 | if (!psessionEntry->is11Rconnection) |
| 2754 | { |
| 2755 | if( nAddIELen && pAddIE ) |
| 2756 | { |
| 2757 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2758 | } |
| 2759 | if ( NULL == wpsIe ) |
| 2760 | { |
| 2761 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2762 | &frm.RSNOpaque ); |
| 2763 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2764 | &frm.WPAOpaque ); |
| 2765 | } |
| 2766 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2767 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2768 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2769 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2770 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2771 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2772 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2773 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2774 | } |
| 2775 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2776 | #ifdef FEATURE_WLAN_ESE |
| 2777 | // For ESE Associations fill the ESE IEs |
| 2778 | if (psessionEntry->isESEconnection && |
| 2779 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2780 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2781 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2782 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2783 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2784 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2785 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2786 | #endif //FEATURE_WLAN_ESE |
| 2787 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2788 | |
| 2789 | // include WME EDCA IE as well |
| 2790 | if ( fWmeEnabled ) |
| 2791 | { |
| 2792 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2793 | { |
| 2794 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2795 | } |
| 2796 | |
| 2797 | if ( fWsmEnabled && |
| 2798 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2799 | { |
| 2800 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2801 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2802 | #ifdef FEATURE_WLAN_ESE |
| 2803 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2804 | { |
| 2805 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2806 | |
| 2807 | // 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] | 2808 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2809 | { |
| 2810 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2811 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2812 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2813 | |
| 2814 | tsrsIE.tsid = 0; |
| 2815 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2816 | { |
| 2817 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2818 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2819 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2820 | { |
| 2821 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2822 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2823 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2824 | } |
| 2825 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2826 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2827 | } |
| 2828 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2829 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2830 | pMac->lim.htCapabilityPresentInBeacon) |
| 2831 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2832 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | } |
| 2834 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2835 | #if defined WLAN_FEATURE_VOWIFI_11R |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 2836 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && |
| 2837 | (pMac->ft.ftSmeContext.addMDIE == TRUE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2838 | #if defined FEATURE_WLAN_ESE |
| 2839 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2840 | #endif |
| 2841 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2842 | { |
| 2843 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2844 | } |
| 2845 | #endif |
| 2846 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2847 | #ifdef WLAN_FEATURE_11AC |
| 2848 | if ( psessionEntry->vhtCapability && |
| 2849 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2850 | { |
| 2851 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 2852 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_FALSE ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2853 | } |
| 2854 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2855 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2857 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2858 | if ( DOT11F_FAILED( nStatus ) ) |
| 2859 | { |
| 2860 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2861 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2862 | nStatus ); |
| 2863 | // We'll fall back on the worst case scenario: |
| 2864 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2865 | } |
| 2866 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2867 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2868 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2869 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2870 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2871 | } |
| 2872 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2873 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2874 | |
| 2875 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2876 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2878 | #endif |
| 2879 | |
| 2880 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2881 | if (psessionEntry->is11Rconnection) |
| 2882 | { |
| 2883 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2884 | } |
| 2885 | #endif |
| 2886 | |
| 2887 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2888 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2889 | ( void** ) &pPacket ); |
| 2890 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2891 | { |
| 2892 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2893 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2894 | 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] | 2895 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2896 | goto end; |
| 2897 | } |
| 2898 | |
| 2899 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2900 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2901 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2902 | #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] | 2903 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2904 | #endif |
| 2905 | // Next, we fill out the buffer descriptor: |
| 2906 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2907 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2908 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2909 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2910 | { |
| 2911 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2912 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2913 | nSirStatus ); |
| 2914 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2915 | goto end; |
| 2916 | } |
| 2917 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2918 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2919 | // That done, pack the ReAssoc Request: |
| 2920 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2921 | sizeof(tSirMacMgmtHdr), |
| 2922 | nPayload, &nPayload ); |
| 2923 | if ( DOT11F_FAILED( nStatus ) ) |
| 2924 | { |
| 2925 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2926 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2927 | nStatus ); |
| 2928 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2929 | goto end; |
| 2930 | } |
| 2931 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2932 | { |
| 2933 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2934 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2935 | } |
| 2936 | |
| 2937 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2938 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2939 | nBytes, nPayload );) |
| 2940 | if( psessionEntry->assocReq != NULL ) |
| 2941 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2942 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2943 | psessionEntry->assocReq = NULL; |
| 2944 | } |
| 2945 | |
| 2946 | if( nAddIELen ) |
| 2947 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2948 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2949 | pAddIE, |
| 2950 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2951 | nPayload += nAddIELen; |
| 2952 | } |
| 2953 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2954 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2955 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2956 | { |
| 2957 | 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] | 2958 | } |
| 2959 | else |
| 2960 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2961 | //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] | 2962 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2963 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2965 | |
| 2966 | if (psessionEntry->is11Rconnection) |
| 2967 | { |
| 2968 | { |
| 2969 | int i = 0; |
| 2970 | |
| 2971 | pBody = pFrame + nBytes; |
| 2972 | for (i=0; i<ft_ies_length; i++) |
| 2973 | { |
| 2974 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2975 | pBody++; |
| 2976 | } |
| 2977 | } |
| 2978 | } |
| 2979 | |
| 2980 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2981 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2982 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | (tANI_U8 *)pFrame, |
| 2984 | (nBytes + ft_ies_length));) |
| 2985 | #endif |
| 2986 | |
| 2987 | |
| 2988 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2989 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2990 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2991 | ) |
| 2992 | { |
| 2993 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2994 | } |
| 2995 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2996 | if( NULL != psessionEntry->assocReq ) |
| 2997 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2998 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2999 | psessionEntry->assocReq = NULL; |
| 3000 | } |
| 3001 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3002 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3003 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3004 | { |
| 3005 | 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] | 3006 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3007 | } |
| 3008 | else |
| 3009 | { |
| 3010 | //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] | 3011 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3012 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3013 | psessionEntry->assocReqLen = (ft_ies_length); |
| 3014 | } |
| 3015 | |
| 3016 | |
Mihir Shete | 63561c8 | 2014-08-23 16:58:07 +0530 | [diff] [blame] | 3017 | // Enable TL cahching in case of roaming |
| 3018 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3019 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3020 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3021 | psessionEntry->peSessionId, |
| 3022 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3023 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3024 | HAL_TXRX_FRM_802_11_MGMT, |
| 3025 | ANI_TXDIR_TODS, |
| 3026 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3027 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3028 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3029 | psessionEntry->peSessionId, |
| 3030 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3031 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3032 | { |
| 3033 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3034 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | nSirStatus ); |
| 3036 | //Pkt will be freed up by the callback |
| 3037 | goto end; |
| 3038 | } |
| 3039 | |
| 3040 | end: |
| 3041 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3042 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3043 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3044 | |
| 3045 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3046 | |
| 3047 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3048 | tLimMlmReassocReq *pMlmReassocReq, |
| 3049 | tpPESession psessionEntry) |
| 3050 | { |
| 3051 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3052 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 3053 | if(NULL == pTmpMlmReassocReq) |
| 3054 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3055 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3056 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3057 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3058 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3059 | } |
| 3060 | |
| 3061 | // Prepare and send Reassociation request frame |
| 3062 | // start reassoc timer. |
| 3063 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3064 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3065 | 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] | 3066 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3067 | != TX_SUCCESS) |
| 3068 | { |
| 3069 | // Could not start reassoc failure timer. |
| 3070 | // Log error |
| 3071 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3072 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3073 | // Return Reassoc confirm with |
| 3074 | // Resources Unavailable |
| 3075 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3076 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3077 | goto end; |
| 3078 | } |
| 3079 | |
| 3080 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3081 | return; |
| 3082 | |
| 3083 | end: |
| 3084 | // Free up buffer allocated for reassocReq |
| 3085 | if (pMlmReassocReq != NULL) |
| 3086 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3087 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3088 | pMlmReassocReq = NULL; |
| 3089 | } |
| 3090 | if (pTmpMlmReassocReq != NULL) |
| 3091 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3092 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3093 | pTmpMlmReassocReq = NULL; |
| 3094 | } |
| 3095 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3096 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3097 | /* Update PE sessio Id*/ |
| 3098 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3099 | |
| 3100 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3101 | } |
| 3102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3103 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3104 | |
| 3105 | |
| 3106 | void |
| 3107 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3108 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3109 | { |
| 3110 | static tDot11fReAssocRequest frm; |
| 3111 | tANI_U16 caps; |
| 3112 | tANI_U8 *pFrame; |
| 3113 | tSirRetStatus nSirStatus; |
| 3114 | tANI_U32 nBytes, nPayload, nStatus; |
| 3115 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3116 | void *pPacket; |
| 3117 | eHalStatus halstatus; |
| 3118 | tANI_U16 nAddIELen; |
| 3119 | tANI_U8 *pAddIE; |
| 3120 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3121 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3122 | #if defined WLAN_FEATURE_VOWIFI |
| 3123 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3124 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3125 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | |
| 3127 | if(NULL == psessionEntry) |
| 3128 | { |
| 3129 | return; |
| 3130 | } |
| 3131 | |
| 3132 | /* check this early to avoid unncessary operation */ |
| 3133 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3134 | { |
| 3135 | return; |
| 3136 | } |
| 3137 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3138 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3139 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3140 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3141 | |
| 3142 | caps = pMlmReassocReq->capabilityInfo; |
| 3143 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3144 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3145 | #if defined(FEATURE_WLAN_WAPI) |
| 3146 | /* CR: 262463 : |
| 3147 | According to WAPI standard: |
| 3148 | 7.3.1.4 Capability Information field |
| 3149 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3150 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3151 | Reassociation management frames. */ |
| 3152 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3153 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3154 | #endif |
| 3155 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3156 | |
| 3157 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3158 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3159 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3160 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3161 | |
| 3162 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3163 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3164 | &frm.SuppRates,psessionEntry); |
| 3165 | |
| 3166 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3167 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3168 | |
| 3169 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3170 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3171 | |
| 3172 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3173 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3174 | |
| 3175 | |
| 3176 | if ( psessionEntry->lim11hEnable && |
| 3177 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3178 | { |
| 3179 | #if defined WLAN_FEATURE_VOWIFI |
| 3180 | PowerCapsPopulated = TRUE; |
| 3181 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3182 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3183 | #endif |
| 3184 | } |
| 3185 | |
| 3186 | #if defined WLAN_FEATURE_VOWIFI |
| 3187 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3188 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3189 | { |
| 3190 | if (PowerCapsPopulated == FALSE) |
| 3191 | { |
| 3192 | PowerCapsPopulated = TRUE; |
| 3193 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3194 | } |
| 3195 | } |
| 3196 | #endif |
| 3197 | |
| 3198 | if ( fQosEnabled && |
| 3199 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3200 | { |
| 3201 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3202 | } |
| 3203 | |
| 3204 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3205 | &frm.ExtSuppRates, psessionEntry ); |
| 3206 | |
| 3207 | #if defined WLAN_FEATURE_VOWIFI |
| 3208 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3209 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3210 | { |
| 3211 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3212 | } |
| 3213 | #endif |
| 3214 | // The join request *should* contain zero or one of the WPA and RSN |
| 3215 | // IEs. The payload send along with the request is a |
| 3216 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3217 | |
| 3218 | // typedef struct sSirRSNie |
| 3219 | // { |
| 3220 | // tANI_U16 length; |
| 3221 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3222 | // } tSirRSNie, *tpSirRSNie; |
| 3223 | |
| 3224 | // So, we should be able to make the following two calls harmlessly, |
| 3225 | // since they do nothing if they don't find the given IE in the |
| 3226 | // bytestream with which they're provided. |
| 3227 | |
| 3228 | // The net effect of this will be to faithfully transmit whatever |
| 3229 | // security IE is in the join request. |
| 3230 | |
| 3231 | // *However*, if we're associating for the purpose of WPS |
| 3232 | // enrollment, and we've been configured to indicate that by |
| 3233 | // eliding the WPA or RSN IE, we just skip this: |
| 3234 | if( nAddIELen && pAddIE ) |
| 3235 | { |
| 3236 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3237 | } |
| 3238 | if ( NULL == wpsIe ) |
| 3239 | { |
| 3240 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3241 | &frm.RSNOpaque ); |
| 3242 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3243 | &frm.WPAOpaque ); |
| 3244 | #if defined(FEATURE_WLAN_WAPI) |
| 3245 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3246 | &frm.WAPIOpaque ); |
| 3247 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3248 | } |
| 3249 | |
| 3250 | // include WME EDCA IE as well |
| 3251 | if ( fWmeEnabled ) |
| 3252 | { |
| 3253 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3254 | { |
| 3255 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3256 | } |
| 3257 | |
| 3258 | if ( fWsmEnabled && |
| 3259 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3260 | { |
| 3261 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3262 | } |
| 3263 | } |
| 3264 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3265 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | pMac->lim.htCapabilityPresentInBeacon) |
| 3267 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3268 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3269 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3270 | #ifdef WLAN_FEATURE_11AC |
| 3271 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3272 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3273 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3274 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 3275 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_FALSE ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3276 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3277 | } |
| 3278 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3279 | |
| 3280 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3281 | if ( DOT11F_FAILED( nStatus ) ) |
| 3282 | { |
| 3283 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3284 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3285 | nStatus ); |
| 3286 | // We'll fall back on the worst case scenario: |
| 3287 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3288 | } |
| 3289 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3290 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3291 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3292 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3293 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3294 | } |
| 3295 | |
| 3296 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3297 | |
| 3298 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3299 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3300 | ( void** ) &pPacket ); |
| 3301 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3302 | { |
| 3303 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3304 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3305 | 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] | 3306 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3307 | goto end; |
| 3308 | } |
| 3309 | |
| 3310 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3311 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3312 | |
| 3313 | // Next, we fill out the buffer descriptor: |
| 3314 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3315 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3316 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3317 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3318 | { |
| 3319 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3320 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3321 | nSirStatus ); |
| 3322 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3323 | goto end; |
| 3324 | } |
| 3325 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3326 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3327 | // That done, pack the Probe Request: |
| 3328 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3329 | sizeof(tSirMacMgmtHdr), |
| 3330 | nPayload, &nPayload ); |
| 3331 | if ( DOT11F_FAILED( nStatus ) ) |
| 3332 | { |
| 3333 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3334 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3335 | nStatus ); |
| 3336 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3337 | goto end; |
| 3338 | } |
| 3339 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3340 | { |
| 3341 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3342 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3343 | } |
| 3344 | |
| 3345 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3346 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3347 | nBytes );) |
| 3348 | |
| 3349 | if( psessionEntry->assocReq != NULL ) |
| 3350 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3351 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3352 | psessionEntry->assocReq = NULL; |
| 3353 | } |
| 3354 | |
| 3355 | if( nAddIELen ) |
| 3356 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3357 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3358 | pAddIE, |
| 3359 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3360 | nPayload += nAddIELen; |
| 3361 | } |
| 3362 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3363 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3364 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3365 | { |
| 3366 | 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] | 3367 | } |
| 3368 | else |
| 3369 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3370 | //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] | 3371 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3372 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3373 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3374 | |
| 3375 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3376 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3377 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3378 | ) |
| 3379 | { |
| 3380 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3381 | } |
| 3382 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3383 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3384 | { |
| 3385 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3386 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3387 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3388 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3389 | psessionEntry->peSessionId, |
| 3390 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 3391 | |
| 3392 | // enable caching |
| 3393 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3395 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3396 | HAL_TXRX_FRM_802_11_MGMT, |
| 3397 | ANI_TXDIR_TODS, |
| 3398 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3399 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3400 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3401 | psessionEntry->peSessionId, |
| 3402 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3403 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3404 | { |
| 3405 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3406 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3407 | nSirStatus ); |
| 3408 | //Pkt will be freed up by the callback |
| 3409 | goto end; |
| 3410 | } |
| 3411 | |
| 3412 | end: |
| 3413 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3414 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3415 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3416 | |
| 3417 | } // limSendReassocReqMgmtFrame |
| 3418 | |
| 3419 | /** |
| 3420 | * \brief Send an Authentication frame |
| 3421 | * |
| 3422 | * |
| 3423 | * \param pMac Pointer to Global MAC structure |
| 3424 | * |
| 3425 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3426 | * to be sent |
| 3427 | * |
| 3428 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3429 | * frame is destined |
| 3430 | * |
| 3431 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3432 | * Authentication frame3 |
| 3433 | * |
| 3434 | * |
| 3435 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3436 | * is formatted and sent when this function is called. |
| 3437 | * |
| 3438 | * |
| 3439 | */ |
| 3440 | |
| 3441 | void |
| 3442 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3443 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3444 | tSirMacAddr peerMacAddr, |
| 3445 | tANI_U8 wepBit, |
| 3446 | tpPESession psessionEntry |
| 3447 | ) |
| 3448 | { |
| 3449 | tANI_U8 *pFrame, *pBody; |
| 3450 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3451 | tpSirMacMgmtHdr pMacHdr; |
| 3452 | tANI_U16 i; |
| 3453 | void *pPacket; |
| 3454 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3455 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3456 | |
| 3457 | if(NULL == psessionEntry) |
| 3458 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3459 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3460 | return; |
| 3461 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3462 | |
| 3463 | limLog(pMac, LOG1, |
| 3464 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3465 | pAuthFrameBody->authTransactionSeqNumber, |
| 3466 | pAuthFrameBody->authStatusCode, |
| 3467 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3468 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3469 | if (wepBit == LIM_WEP_IN_FC) |
| 3470 | { |
| 3471 | /// Auth frame3 to be sent with encrypted framebody |
| 3472 | /** |
| 3473 | * Allocate buffer for Authenticaton frame of size equal |
| 3474 | * to management frame header length plus 2 bytes each for |
| 3475 | * auth algorithm number, transaction number, status code, |
| 3476 | * 128 bytes for challenge text and 4 bytes each for |
| 3477 | * IV & ICV. |
| 3478 | */ |
| 3479 | |
| 3480 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3481 | |
| 3482 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3483 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3484 | else |
| 3485 | { |
| 3486 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3487 | { |
| 3488 | case SIR_MAC_AUTH_FRAME_1: |
| 3489 | /** |
| 3490 | * Allocate buffer for Authenticaton frame of size |
| 3491 | * equal to management frame header length plus 2 bytes |
| 3492 | * each for auth algorithm number, transaction number |
| 3493 | * and status code. |
| 3494 | */ |
| 3495 | |
| 3496 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3497 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3498 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3499 | |
| 3500 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3501 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3502 | { |
| 3503 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3504 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3505 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3506 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3507 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3508 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3509 | else |
| 3510 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3511 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3512 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3513 | frameLen += (2+SIR_MDIE_SIZE); |
| 3514 | } |
| 3515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3516 | #endif |
| 3517 | break; |
| 3518 | |
| 3519 | case SIR_MAC_AUTH_FRAME_2: |
| 3520 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3521 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3522 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3523 | { |
| 3524 | /** |
| 3525 | * Allocate buffer for Authenticaton frame of size |
| 3526 | * equal to management frame header length plus |
| 3527 | * 2 bytes each for auth algorithm number, |
| 3528 | * transaction number and status code. |
| 3529 | */ |
| 3530 | |
| 3531 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3532 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3533 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3534 | } |
| 3535 | else |
| 3536 | { |
| 3537 | // Shared Key algorithm with challenge text |
| 3538 | // to be sent |
| 3539 | /** |
| 3540 | * Allocate buffer for Authenticaton frame of size |
| 3541 | * equal to management frame header length plus |
| 3542 | * 2 bytes each for auth algorithm number, |
| 3543 | * transaction number, status code and 128 bytes |
| 3544 | * for challenge text. |
| 3545 | */ |
| 3546 | |
| 3547 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3548 | sizeof(tSirMacAuthFrame); |
| 3549 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3550 | } |
| 3551 | |
| 3552 | break; |
| 3553 | |
| 3554 | case SIR_MAC_AUTH_FRAME_3: |
| 3555 | /// Auth frame3 to be sent without encrypted framebody |
| 3556 | /** |
| 3557 | * Allocate buffer for Authenticaton frame of size equal |
| 3558 | * to management frame header length plus 2 bytes each |
| 3559 | * for auth algorithm number, transaction number and |
| 3560 | * status code. |
| 3561 | */ |
| 3562 | |
| 3563 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3564 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3565 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3566 | |
| 3567 | break; |
| 3568 | |
| 3569 | case SIR_MAC_AUTH_FRAME_4: |
| 3570 | /** |
| 3571 | * Allocate buffer for Authenticaton frame of size equal |
| 3572 | * to management frame header length plus 2 bytes each |
| 3573 | * for auth algorithm number, transaction number and |
| 3574 | * status code. |
| 3575 | */ |
| 3576 | |
| 3577 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3578 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3579 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3580 | |
| 3581 | break; |
| 3582 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3583 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3584 | |
| 3585 | |
| 3586 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3587 | |
| 3588 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3589 | { |
| 3590 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3591 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3592 | |
| 3593 | return; |
| 3594 | } |
| 3595 | |
| 3596 | for (i = 0; i < frameLen; i++) |
| 3597 | pFrame[i] = 0; |
| 3598 | |
| 3599 | // Prepare BD |
| 3600 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3601 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3602 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3603 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3604 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3605 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3606 | return; |
| 3607 | } |
| 3608 | |
| 3609 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3610 | pMacHdr->fc.wep = wepBit; |
| 3611 | |
| 3612 | // Prepare BSSId |
| 3613 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3614 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3615 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3616 | (tANI_U8 *) psessionEntry->bssId, |
| 3617 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3618 | } |
| 3619 | |
| 3620 | /// Prepare Authentication frame body |
| 3621 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3622 | |
| 3623 | if (wepBit == LIM_WEP_IN_FC) |
| 3624 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3625 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3626 | |
| 3627 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3628 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3629 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3630 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3631 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3633 | } |
| 3634 | else |
| 3635 | { |
| 3636 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3637 | pBody += sizeof(tANI_U16); |
| 3638 | bodyLen -= sizeof(tANI_U16); |
| 3639 | |
| 3640 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3641 | pBody += sizeof(tANI_U16); |
| 3642 | bodyLen -= sizeof(tANI_U16); |
| 3643 | |
| 3644 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3645 | pBody += sizeof(tANI_U16); |
| 3646 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3647 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3648 | sizeof (pAuthFrameBody->length) + |
| 3649 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3650 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3651 | |
| 3652 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3653 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3654 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3655 | { |
| 3656 | |
| 3657 | { |
| 3658 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3659 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3660 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3661 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3662 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3663 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3664 | (tANI_U8 *)pBody, |
| 3665 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3666 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3667 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3668 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3669 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3670 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3671 | } |
| 3672 | } |
| 3673 | else |
| 3674 | { |
| 3675 | /* MDID attr is 54*/ |
| 3676 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3677 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3678 | *pBody = SIR_MDIE_SIZE; |
| 3679 | pBody++; |
| 3680 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3681 | { |
| 3682 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3683 | pBody++; |
| 3684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3685 | } |
| 3686 | } |
| 3687 | } |
| 3688 | #endif |
| 3689 | |
| 3690 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3691 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3692 | pAuthFrameBody->authTransactionSeqNumber, |
| 3693 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3694 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3695 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3696 | } |
| 3697 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3698 | |
| 3699 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3700 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3701 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3702 | #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] | 3703 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3704 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3705 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3706 | ) |
| 3707 | { |
| 3708 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3709 | } |
| 3710 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3711 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3712 | { |
| 3713 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3714 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3715 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 3716 | limLog( pMac, LOG1, FL("Sending Auth Frame over WQ5 to "MAC_ADDRESS_STR |
| 3717 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 3718 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3719 | |
| 3720 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3721 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3722 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3723 | psessionEntry->peSessionId, |
| 3724 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3725 | /// Queue Authentication frame in high priority WQ |
| 3726 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3727 | HAL_TXRX_FRM_802_11_MGMT, |
| 3728 | ANI_TXDIR_TODS, |
| 3729 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3730 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3731 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3732 | psessionEntry->peSessionId, |
| 3733 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3734 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3735 | { |
| 3736 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3737 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | halstatus); |
| 3739 | |
| 3740 | //Pkt will be freed up by the callback |
| 3741 | } |
| 3742 | |
| 3743 | return; |
| 3744 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3745 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3746 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3747 | { |
| 3748 | tANI_U16 aid; |
| 3749 | tpDphHashNode pStaDs; |
| 3750 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3751 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3752 | tpPESession psessionEntry; |
| 3753 | |
| 3754 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3755 | if (pMlmDeauthReq) |
| 3756 | { |
| 3757 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3758 | { |
| 3759 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3760 | } |
| 3761 | |
| 3762 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3763 | { |
| 3764 | |
| 3765 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3766 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3767 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3768 | goto end; |
| 3769 | } |
| 3770 | |
| 3771 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3772 | if (pStaDs == NULL) |
| 3773 | { |
| 3774 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3775 | goto end; |
| 3776 | } |
| 3777 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3778 | /// Receive path cleanup with dummy packet |
| 3779 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3780 | |
| 3781 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3782 | if ( psessionEntry->limSystemRole == eLIM_STA_ROLE ) |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3783 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3784 | PELOGE(limLog(pMac, LOG1, |
| 3785 | FL("FT Preauth SessionId %d Cleanup" |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3786 | #ifdef FEATURE_WLAN_ESE |
| 3787 | " isESE %d" |
| 3788 | #endif |
| 3789 | #ifdef FEATURE_WLAN_LFR |
| 3790 | " isLFR %d" |
| 3791 | #endif |
| 3792 | " is11r %d, Deauth reason %d Trigger = %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3793 | psessionEntry->peSessionId, |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3794 | #ifdef FEATURE_WLAN_ESE |
| 3795 | psessionEntry->isESEconnection, |
| 3796 | #endif |
| 3797 | #ifdef FEATURE_WLAN_LFR |
| 3798 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3799 | #endif |
| 3800 | psessionEntry->is11Rconnection, |
| 3801 | pMlmDeauthReq->reasonCode, |
| 3802 | pMlmDeauthReq->deauthTrigger);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3803 | |
| 3804 | limFTCleanup(pMac); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 3805 | } |
| 3806 | #endif |
| 3807 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3808 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3809 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3810 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3811 | } |
| 3812 | return eHAL_STATUS_SUCCESS; |
| 3813 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3814 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3815 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3816 | sizeof(tSirMacAddr)); |
| 3817 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3818 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3819 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3820 | |
| 3821 | // Free up buffer allocated |
| 3822 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3823 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3824 | |
| 3825 | limPostSmeMessage(pMac, |
| 3826 | LIM_MLM_DEAUTH_CNF, |
| 3827 | (tANI_U32 *) &mlmDeauthCnf); |
| 3828 | return eHAL_STATUS_SUCCESS; |
| 3829 | } |
| 3830 | |
| 3831 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3832 | { |
| 3833 | tANI_U16 aid; |
| 3834 | tpDphHashNode pStaDs; |
| 3835 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3836 | tpPESession psessionEntry; |
| 3837 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3838 | |
| 3839 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3840 | if (pMlmDisassocReq) |
| 3841 | { |
| 3842 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3843 | { |
| 3844 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3845 | } |
| 3846 | |
| 3847 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3848 | { |
| 3849 | |
| 3850 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3851 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3852 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3853 | goto end; |
| 3854 | } |
| 3855 | |
| 3856 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3857 | if (pStaDs == NULL) |
| 3858 | { |
| 3859 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3860 | goto end; |
| 3861 | } |
| 3862 | |
| 3863 | /// Receive path cleanup with dummy packet |
| 3864 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3865 | { |
| 3866 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3867 | goto end; |
| 3868 | } |
| 3869 | |
| 3870 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3871 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3872 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3873 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3874 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3875 | PELOGE(limLog(pMac, LOG1, |
| 3876 | FL("FT Preauth SessionId %d Cleanup" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3877 | #ifdef FEATURE_WLAN_ESE |
| 3878 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3879 | #endif |
| 3880 | #ifdef FEATURE_WLAN_LFR |
| 3881 | " isLFR %d" |
| 3882 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3883 | " is11r %d reason %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3884 | psessionEntry->peSessionId, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3885 | #ifdef FEATURE_WLAN_ESE |
| 3886 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3887 | #endif |
| 3888 | #ifdef FEATURE_WLAN_LFR |
| 3889 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3890 | #endif |
| 3891 | psessionEntry->is11Rconnection, |
| 3892 | pMlmDisassocReq->reasonCode);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame^] | 3893 | limFTCleanup(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3894 | } |
| 3895 | #endif |
| 3896 | |
| 3897 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3898 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3899 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3900 | return eHAL_STATUS_SUCCESS; |
| 3901 | } |
| 3902 | else |
| 3903 | { |
| 3904 | return eHAL_STATUS_SUCCESS; |
| 3905 | } |
| 3906 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3907 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3908 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3909 | sizeof(tSirMacAddr)); |
| 3910 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3911 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3912 | |
| 3913 | /* Update PE session ID*/ |
| 3914 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3915 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3916 | if(pMlmDisassocReq != NULL) |
| 3917 | { |
| 3918 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3919 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3920 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3921 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3922 | |
| 3923 | limPostSmeMessage(pMac, |
| 3924 | LIM_MLM_DISASSOC_CNF, |
| 3925 | (tANI_U32 *) &mlmDisassocCnf); |
| 3926 | return eHAL_STATUS_SUCCESS; |
| 3927 | } |
| 3928 | |
| 3929 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3930 | { |
| 3931 | return limSendDisassocCnf(pMac); |
| 3932 | } |
| 3933 | |
| 3934 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3935 | { |
| 3936 | return limSendDeauthCnf(pMac); |
| 3937 | } |
| 3938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3939 | /** |
| 3940 | * \brief This function is called to send Disassociate frame. |
| 3941 | * |
| 3942 | * |
| 3943 | * \param pMac Pointer to Global MAC structure |
| 3944 | * |
| 3945 | * \param nReason Indicates the reason that need to be sent in |
| 3946 | * Disassociation frame |
| 3947 | * |
| 3948 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3949 | * sent |
| 3950 | * |
| 3951 | * |
| 3952 | */ |
| 3953 | |
| 3954 | void |
| 3955 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3956 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3957 | tSirMacAddr peer, |
| 3958 | tpPESession psessionEntry, |
| 3959 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3960 | { |
| 3961 | tDot11fDisassociation frm; |
| 3962 | tANI_U8 *pFrame; |
| 3963 | tSirRetStatus nSirStatus; |
| 3964 | tpSirMacMgmtHdr pMacHdr; |
| 3965 | tANI_U32 nBytes, nPayload, nStatus; |
| 3966 | void *pPacket; |
| 3967 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3968 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3969 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3970 | if(NULL == psessionEntry) |
| 3971 | { |
| 3972 | return; |
| 3973 | } |
| 3974 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3975 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3976 | |
| 3977 | frm.Reason.code = nReason; |
| 3978 | |
| 3979 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 3980 | if ( DOT11F_FAILED( nStatus ) ) |
| 3981 | { |
| 3982 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3983 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3984 | nStatus ); |
| 3985 | // We'll fall back on the worst case scenario: |
| 3986 | nPayload = sizeof( tDot11fDisassociation ); |
| 3987 | } |
| 3988 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3989 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3990 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3991 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3992 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3993 | } |
| 3994 | |
| 3995 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3996 | |
| 3997 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3998 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3999 | ( void** ) &pPacket ); |
| 4000 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4001 | { |
| 4002 | 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] | 4003 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4004 | return; |
| 4005 | } |
| 4006 | |
| 4007 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4008 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4009 | |
| 4010 | // Next, we fill out the buffer descriptor: |
| 4011 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4012 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4013 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4014 | { |
| 4015 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4016 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4017 | nSirStatus ); |
| 4018 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4019 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4020 | return; // just allocated... |
| 4021 | } |
| 4022 | |
| 4023 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4024 | |
| 4025 | // Prepare the BSSID |
| 4026 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4027 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4028 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4029 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4030 | #endif |
| 4031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4032 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4033 | sizeof(tSirMacMgmtHdr), |
| 4034 | nPayload, &nPayload ); |
| 4035 | if ( DOT11F_FAILED( nStatus ) ) |
| 4036 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4037 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4038 | nStatus ); |
| 4039 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4040 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4041 | return; // allocated! |
| 4042 | } |
| 4043 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4044 | { |
| 4045 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4046 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4047 | } |
| 4048 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4049 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4050 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4051 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4052 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4053 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4054 | |
| 4055 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4056 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4057 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4058 | ) |
| 4059 | { |
| 4060 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4061 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4062 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4063 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4064 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4065 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4066 | { |
| 4067 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4068 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4069 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4070 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4071 | { |
| 4072 | /* This frame will be sent on air by firmware, |
| 4073 | which will ensure that this frame goes out |
| 4074 | even though DEL_STA is sent immediately */ |
| 4075 | /* Without this for DEL_STA command there is |
| 4076 | risk of flushing frame in BTQM queue without |
| 4077 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4078 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4079 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4080 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4081 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4082 | } |
| 4083 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4084 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4085 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4086 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4087 | psessionEntry->peSessionId, |
| 4088 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4089 | // Queue Disassociation frame in high priority WQ |
| 4090 | /* get the duration from the request */ |
| 4091 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4092 | HAL_TXRX_FRM_802_11_MGMT, |
| 4093 | ANI_TXDIR_TODS, |
| 4094 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4095 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 4096 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4097 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4098 | psessionEntry->peSessionId, |
| 4099 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4100 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4101 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4102 | if (tx_timer_change( |
| 4103 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4104 | != TX_SUCCESS) |
| 4105 | { |
| 4106 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4107 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4108 | return; |
| 4109 | } |
| 4110 | else if(TX_SUCCESS != tx_timer_activate( |
| 4111 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4112 | { |
| 4113 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4114 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4115 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4116 | return; |
| 4117 | } |
| 4118 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4119 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4120 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4121 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4122 | psessionEntry->peSessionId, |
| 4123 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4124 | // Queue Disassociation frame in high priority WQ |
| 4125 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4126 | HAL_TXRX_FRM_802_11_MGMT, |
| 4127 | ANI_TXDIR_TODS, |
| 4128 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4129 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4130 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4131 | psessionEntry->peSessionId, |
| 4132 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4133 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4134 | { |
| 4135 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4136 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4137 | nSirStatus ); |
| 4138 | //Pkt will be freed up by the callback |
| 4139 | return; |
| 4140 | } |
| 4141 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4142 | } // End limSendDisassocMgmtFrame. |
| 4143 | |
| 4144 | /** |
| 4145 | * \brief This function is called to send a Deauthenticate frame |
| 4146 | * |
| 4147 | * |
| 4148 | * \param pMac Pointer to global MAC structure |
| 4149 | * |
| 4150 | * \param nReason Indicates the reason that need to be sent in the |
| 4151 | * Deauthenticate frame |
| 4152 | * |
| 4153 | * \param peeer address of the STA to which the frame is to be sent |
| 4154 | * |
| 4155 | * |
| 4156 | */ |
| 4157 | |
| 4158 | void |
| 4159 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4160 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4161 | tSirMacAddr peer, |
| 4162 | tpPESession psessionEntry, |
| 4163 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4164 | { |
| 4165 | tDot11fDeAuth frm; |
| 4166 | tANI_U8 *pFrame; |
| 4167 | tSirRetStatus nSirStatus; |
| 4168 | tpSirMacMgmtHdr pMacHdr; |
| 4169 | tANI_U32 nBytes, nPayload, nStatus; |
| 4170 | void *pPacket; |
| 4171 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4172 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4173 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4174 | #ifdef FEATURE_WLAN_TDLS |
| 4175 | tANI_U16 aid; |
| 4176 | tpDphHashNode pStaDs; |
| 4177 | #endif |
| 4178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4179 | if(NULL == psessionEntry) |
| 4180 | { |
| 4181 | return; |
| 4182 | } |
| 4183 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4184 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4185 | |
| 4186 | frm.Reason.code = nReason; |
| 4187 | |
| 4188 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4189 | if ( DOT11F_FAILED( nStatus ) ) |
| 4190 | { |
| 4191 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4192 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4193 | nStatus ); |
| 4194 | // We'll fall back on the worst case scenario: |
| 4195 | nPayload = sizeof( tDot11fDeAuth ); |
| 4196 | } |
| 4197 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4198 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4199 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4200 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4201 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4202 | } |
| 4203 | |
| 4204 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4205 | |
| 4206 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4207 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4208 | ( void** ) &pPacket ); |
| 4209 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4210 | { |
| 4211 | 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] | 4212 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4213 | return; |
| 4214 | } |
| 4215 | |
| 4216 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4217 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | |
| 4219 | // Next, we fill out the buffer descriptor: |
| 4220 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4221 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4222 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4223 | { |
| 4224 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4225 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4226 | nSirStatus ); |
| 4227 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4228 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4229 | return; // just allocated... |
| 4230 | } |
| 4231 | |
| 4232 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4233 | |
| 4234 | // Prepare the BSSID |
| 4235 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4236 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4237 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4238 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4239 | #endif |
| 4240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4241 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4242 | sizeof(tSirMacMgmtHdr), |
| 4243 | nPayload, &nPayload ); |
| 4244 | if ( DOT11F_FAILED( nStatus ) ) |
| 4245 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4246 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4247 | nStatus ); |
| 4248 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4249 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4250 | return; |
| 4251 | } |
| 4252 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4253 | { |
| 4254 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4255 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4256 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4257 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4258 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4259 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4260 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4261 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4262 | |
| 4263 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4264 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4265 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4266 | ) |
| 4267 | { |
| 4268 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4269 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4270 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4271 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4272 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4273 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4274 | { |
| 4275 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4276 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4277 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4278 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4279 | { |
| 4280 | /* This frame will be sent on air by firmware, |
| 4281 | which will ensure that this frame goes out |
| 4282 | even though DEL_STA is sent immediately */ |
| 4283 | /* Without this for DEL_STA command there is |
| 4284 | risk of flushing frame in BTQM queue without |
| 4285 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4286 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4287 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4288 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4289 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4290 | } |
| 4291 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4292 | #ifdef FEATURE_WLAN_TDLS |
| 4293 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4294 | #endif |
| 4295 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4296 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4297 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4298 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4299 | psessionEntry->peSessionId, |
| 4300 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4301 | // Queue Disassociation frame in high priority WQ |
| 4302 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4303 | HAL_TXRX_FRM_802_11_MGMT, |
| 4304 | ANI_TXDIR_TODS, |
| 4305 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4306 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4307 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4308 | psessionEntry->peSessionId, |
| 4309 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4310 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4311 | { |
| 4312 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4313 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4314 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4315 | //Pkt will be freed up by the callback limTxComplete |
| 4316 | |
| 4317 | /*Call limProcessDeauthAckTimeout which will send |
| 4318 | * DeauthCnf for this frame |
| 4319 | */ |
| 4320 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4321 | return; |
| 4322 | } |
| 4323 | |
| 4324 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4325 | |
| 4326 | if (tx_timer_change( |
| 4327 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4328 | != TX_SUCCESS) |
| 4329 | { |
| 4330 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4331 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4332 | return; |
| 4333 | } |
| 4334 | else if(TX_SUCCESS != tx_timer_activate( |
| 4335 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4336 | { |
| 4337 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4338 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4339 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4340 | return; |
| 4341 | } |
| 4342 | } |
| 4343 | else |
| 4344 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4345 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4346 | psessionEntry->peSessionId, |
| 4347 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4348 | #ifdef FEATURE_WLAN_TDLS |
| 4349 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4350 | { |
| 4351 | // Queue Disassociation frame in high priority WQ |
| 4352 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4353 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4354 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4355 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4356 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4357 | } |
| 4358 | else |
| 4359 | { |
| 4360 | #endif |
| 4361 | // Queue Disassociation frame in high priority WQ |
| 4362 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4363 | HAL_TXRX_FRM_802_11_MGMT, |
| 4364 | ANI_TXDIR_TODS, |
| 4365 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4366 | limTxComplete, pFrame, txFlag ); |
| 4367 | #ifdef FEATURE_WLAN_TDLS |
| 4368 | } |
| 4369 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4370 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4371 | psessionEntry->peSessionId, |
| 4372 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4373 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4374 | { |
| 4375 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4376 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4377 | nSirStatus ); |
| 4378 | //Pkt will be freed up by the callback |
| 4379 | return; |
| 4380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4381 | } |
| 4382 | |
| 4383 | } // End limSendDeauthMgmtFrame. |
| 4384 | |
| 4385 | |
| 4386 | #ifdef ANI_SUPPORT_11H |
| 4387 | /** |
| 4388 | * \brief Send a Measurement Report Action frame |
| 4389 | * |
| 4390 | * |
| 4391 | * \param pMac Pointer to the global MAC structure |
| 4392 | * |
| 4393 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4394 | * |
| 4395 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4396 | * |
| 4397 | * |
| 4398 | */ |
| 4399 | |
| 4400 | tSirRetStatus |
| 4401 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4402 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4403 | tSirMacAddr peer) |
| 4404 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4405 | tDot11fMeasurementReport frm; |
| 4406 | tANI_U8 *pFrame; |
| 4407 | tSirRetStatus nSirStatus; |
| 4408 | tpSirMacMgmtHdr pMacHdr; |
| 4409 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4410 | void *pPacket; |
| 4411 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4412 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4413 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4414 | |
| 4415 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4416 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4417 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4418 | |
| 4419 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4420 | { |
| 4421 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4422 | nSirStatus = |
| 4423 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4424 | &frm.MeasurementReport ); |
| 4425 | break; |
| 4426 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4427 | nSirStatus = |
| 4428 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4429 | &frm.MeasurementReport ); |
| 4430 | break; |
| 4431 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4432 | nSirStatus = |
| 4433 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4434 | &frm.MeasurementReport ); |
| 4435 | break; |
| 4436 | default: |
| 4437 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4438 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4439 | pMeasReqFrame->measReqIE.measType ); |
| 4440 | return eSIR_FAILURE; |
| 4441 | } |
| 4442 | |
| 4443 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4444 | |
| 4445 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4446 | if ( DOT11F_FAILED( nStatus ) ) |
| 4447 | { |
| 4448 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4449 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4450 | nStatus ); |
| 4451 | // We'll fall back on the worst case scenario: |
| 4452 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4453 | } |
| 4454 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4455 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4456 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4457 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4458 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4459 | } |
| 4460 | |
| 4461 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4462 | |
| 4463 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4464 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4465 | { |
| 4466 | 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] | 4467 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4468 | return eSIR_FAILURE; |
| 4469 | } |
| 4470 | |
| 4471 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4472 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4473 | |
| 4474 | // Next, we fill out the buffer descriptor: |
| 4475 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4476 | SIR_MAC_MGMT_ACTION, peer); |
| 4477 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4478 | { |
| 4479 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4480 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4481 | nSirStatus ); |
| 4482 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4483 | return eSIR_FAILURE; // just allocated... |
| 4484 | } |
| 4485 | |
| 4486 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4487 | |
| 4488 | nCfg = 6; |
| 4489 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4490 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4491 | { |
| 4492 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4493 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4494 | nSirStatus ); |
| 4495 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4496 | return eSIR_FAILURE; // just allocated... |
| 4497 | } |
| 4498 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4499 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4500 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4501 | #endif |
| 4502 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4503 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4504 | sizeof(tSirMacMgmtHdr), |
| 4505 | nPayload, &nPayload ); |
| 4506 | if ( DOT11F_FAILED( nStatus ) ) |
| 4507 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4508 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4509 | nStatus ); |
| 4510 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4511 | return eSIR_FAILURE; // allocated! |
| 4512 | } |
| 4513 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4514 | { |
| 4515 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4516 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4517 | } |
| 4518 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4519 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4520 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4521 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4522 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4523 | HAL_TXRX_FRM_802_11_MGMT, |
| 4524 | ANI_TXDIR_TODS, |
| 4525 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4526 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4527 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4528 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4529 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4531 | { |
| 4532 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4533 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4534 | nSirStatus ); |
| 4535 | //Pkt will be freed up by the callback |
| 4536 | return eSIR_FAILURE; // just allocated... |
| 4537 | } |
| 4538 | |
| 4539 | return eSIR_SUCCESS; |
| 4540 | |
| 4541 | } // End limSendMeasReportFrame. |
| 4542 | |
| 4543 | |
| 4544 | /** |
| 4545 | * \brief Send a TPC Request Action frame |
| 4546 | * |
| 4547 | * |
| 4548 | * \param pMac Pointer to the global MAC datastructure |
| 4549 | * |
| 4550 | * \param peer MAC address to which the frame should be sent |
| 4551 | * |
| 4552 | * |
| 4553 | */ |
| 4554 | |
| 4555 | void |
| 4556 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4557 | tSirMacAddr peer) |
| 4558 | { |
| 4559 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4560 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4561 | tSirRetStatus nSirStatus; |
| 4562 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4563 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4564 | void *pPacket; |
| 4565 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4566 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4567 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4568 | |
| 4569 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4570 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4571 | frm.DialogToken.token = 1; |
| 4572 | frm.TPCRequest.present = 1; |
| 4573 | |
| 4574 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4575 | if ( DOT11F_FAILED( nStatus ) ) |
| 4576 | { |
| 4577 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4578 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4579 | nStatus ); |
| 4580 | // We'll fall back on the worst case scenario: |
| 4581 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4582 | } |
| 4583 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4584 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4585 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4587 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4588 | } |
| 4589 | |
| 4590 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4591 | |
| 4592 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4593 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4594 | { |
| 4595 | 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] | 4596 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4597 | return; |
| 4598 | } |
| 4599 | |
| 4600 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4601 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4602 | |
| 4603 | // Next, we fill out the buffer descriptor: |
| 4604 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4605 | SIR_MAC_MGMT_ACTION, peer); |
| 4606 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4607 | { |
| 4608 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4609 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4610 | nSirStatus ); |
| 4611 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4612 | return; // just allocated... |
| 4613 | } |
| 4614 | |
| 4615 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4616 | |
| 4617 | nCfg = 6; |
| 4618 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4619 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4620 | { |
| 4621 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4622 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4623 | nSirStatus ); |
| 4624 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4625 | return; // just allocated... |
| 4626 | } |
| 4627 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4628 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4629 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4630 | #endif |
| 4631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4632 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4633 | sizeof(tSirMacMgmtHdr), |
| 4634 | nPayload, &nPayload ); |
| 4635 | if ( DOT11F_FAILED( nStatus ) ) |
| 4636 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4637 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | nStatus ); |
| 4639 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4640 | return; // allocated! |
| 4641 | } |
| 4642 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4643 | { |
| 4644 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4645 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4646 | } |
| 4647 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4648 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4649 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4650 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4651 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4652 | HAL_TXRX_FRM_802_11_MGMT, |
| 4653 | ANI_TXDIR_TODS, |
| 4654 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4655 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4656 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4657 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4658 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4659 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4660 | { |
| 4661 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4662 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4663 | nSirStatus ); |
| 4664 | //Pkt will be freed up by the callback |
| 4665 | return; |
| 4666 | } |
| 4667 | |
| 4668 | } // End limSendTpcRequestFrame. |
| 4669 | |
| 4670 | |
| 4671 | /** |
| 4672 | * \brief Send a TPC Report Action frame |
| 4673 | * |
| 4674 | * |
| 4675 | * \param pMac Pointer to the global MAC datastructure |
| 4676 | * |
| 4677 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4678 | * |
| 4679 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4680 | * |
| 4681 | * |
| 4682 | */ |
| 4683 | |
| 4684 | tSirRetStatus |
| 4685 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4686 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4687 | tSirMacAddr peer) |
| 4688 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4689 | tDot11fTPCReport frm; |
| 4690 | tANI_U8 *pFrame; |
| 4691 | tSirRetStatus nSirStatus; |
| 4692 | tpSirMacMgmtHdr pMacHdr; |
| 4693 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4694 | void *pPacket; |
| 4695 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4696 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4697 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4698 | |
| 4699 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4700 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4701 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4702 | |
| 4703 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4704 | // "misplaced this function, need to replace: |
| 4705 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4706 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4707 | frm.TPCReport.tx_power = 0; |
| 4708 | frm.TPCReport.link_margin = 0; |
| 4709 | frm.TPCReport.present = 1; |
| 4710 | |
| 4711 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4712 | if ( DOT11F_FAILED( nStatus ) ) |
| 4713 | { |
| 4714 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4715 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4716 | nStatus ); |
| 4717 | // We'll fall back on the worst case scenario: |
| 4718 | nPayload = sizeof( tDot11fTPCReport ); |
| 4719 | } |
| 4720 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4721 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4722 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4723 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4724 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4725 | } |
| 4726 | |
| 4727 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4728 | |
| 4729 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4730 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4731 | { |
| 4732 | 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] | 4733 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4734 | return eSIR_FAILURE; |
| 4735 | } |
| 4736 | |
| 4737 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4738 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4739 | |
| 4740 | // Next, we fill out the buffer descriptor: |
| 4741 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4742 | SIR_MAC_MGMT_ACTION, peer); |
| 4743 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4744 | { |
| 4745 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4746 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4747 | nSirStatus ); |
| 4748 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4749 | return eSIR_FAILURE; // just allocated... |
| 4750 | } |
| 4751 | |
| 4752 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4753 | |
| 4754 | nCfg = 6; |
| 4755 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4756 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4757 | { |
| 4758 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4759 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4760 | nSirStatus ); |
| 4761 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4762 | return eSIR_FAILURE; // just allocated... |
| 4763 | } |
| 4764 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4765 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4766 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4767 | #endif |
| 4768 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4769 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4770 | sizeof(tSirMacMgmtHdr), |
| 4771 | nPayload, &nPayload ); |
| 4772 | if ( DOT11F_FAILED( nStatus ) ) |
| 4773 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4774 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4775 | nStatus ); |
| 4776 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4777 | return eSIR_FAILURE; // allocated! |
| 4778 | } |
| 4779 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4780 | { |
| 4781 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4782 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4783 | } |
| 4784 | |
| 4785 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4786 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4787 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4788 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4789 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4790 | HAL_TXRX_FRM_802_11_MGMT, |
| 4791 | ANI_TXDIR_TODS, |
| 4792 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4793 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4794 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4795 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4796 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4797 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4798 | { |
| 4799 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4800 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4801 | nSirStatus ); |
| 4802 | //Pkt will be freed up by the callback |
| 4803 | return eSIR_FAILURE; // just allocated... |
| 4804 | } |
| 4805 | |
| 4806 | return eSIR_SUCCESS; |
| 4807 | |
| 4808 | } // End limSendTpcReportFrame. |
| 4809 | #endif //ANI_SUPPORT_11H |
| 4810 | |
| 4811 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4812 | /** |
| 4813 | * \brief Send a Channel Switch Announcement |
| 4814 | * |
| 4815 | * |
| 4816 | * \param pMac Pointer to the global MAC datastructure |
| 4817 | * |
| 4818 | * \param peer MAC address to which this frame will be sent |
| 4819 | * |
| 4820 | * \param nMode |
| 4821 | * |
| 4822 | * \param nNewChannel |
| 4823 | * |
| 4824 | * \param nCount |
| 4825 | * |
| 4826 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4827 | * |
| 4828 | * |
| 4829 | */ |
| 4830 | |
| 4831 | tSirRetStatus |
| 4832 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4833 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4834 | tANI_U8 nMode, |
| 4835 | tANI_U8 nNewChannel, |
| 4836 | tANI_U8 nCount, |
| 4837 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4838 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4839 | tDot11fChannelSwitch frm; |
| 4840 | tANI_U8 *pFrame; |
| 4841 | tSirRetStatus nSirStatus; |
| 4842 | tpSirMacMgmtHdr pMacHdr; |
| 4843 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4844 | void *pPacket; |
| 4845 | eHalStatus halstatus; |
| 4846 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4847 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4848 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4849 | |
| 4850 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4851 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4852 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4853 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4854 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4855 | frm.ChanSwitchAnn.present = 1; |
| 4856 | |
| 4857 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4858 | if ( DOT11F_FAILED( nStatus ) ) |
| 4859 | { |
| 4860 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4861 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4862 | nStatus ); |
| 4863 | // We'll fall back on the worst case scenario: |
| 4864 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4865 | } |
| 4866 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4867 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4868 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4869 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4870 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4871 | } |
| 4872 | |
| 4873 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4874 | |
| 4875 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4876 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4877 | { |
| 4878 | 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] | 4879 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4880 | return eSIR_FAILURE; |
| 4881 | } |
| 4882 | |
| 4883 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4884 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4885 | |
| 4886 | // Next, we fill out the buffer descriptor: |
| 4887 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4888 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4889 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4890 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4891 | (tANI_U8 *) psessionEntry->bssId, |
| 4892 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4893 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4894 | { |
| 4895 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4896 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4897 | nSirStatus ); |
| 4898 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4899 | return eSIR_FAILURE; // just allocated... |
| 4900 | } |
| 4901 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4902 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4903 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4904 | |
| 4905 | nCfg = 6; |
| 4906 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4907 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4908 | { |
| 4909 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4910 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4911 | nSirStatus ); |
| 4912 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4913 | return eSIR_FAILURE; // just allocated... |
| 4914 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4915 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4916 | |
| 4917 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4918 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4919 | #endif |
| 4920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4921 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4922 | sizeof(tSirMacMgmtHdr), |
| 4923 | nPayload, &nPayload ); |
| 4924 | if ( DOT11F_FAILED( nStatus ) ) |
| 4925 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4926 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | nStatus ); |
| 4928 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4929 | return eSIR_FAILURE; // allocated! |
| 4930 | } |
| 4931 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4932 | { |
| 4933 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4934 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4935 | } |
| 4936 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4937 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4938 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4939 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4940 | ) |
| 4941 | { |
| 4942 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4943 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4944 | |
| 4945 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4946 | psessionEntry->peSessionId, |
| 4947 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4949 | HAL_TXRX_FRM_802_11_MGMT, |
| 4950 | ANI_TXDIR_TODS, |
| 4951 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4952 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4953 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4954 | psessionEntry->peSessionId, |
| 4955 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4956 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4957 | { |
| 4958 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4959 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4960 | nSirStatus ); |
| 4961 | //Pkt will be freed up by the callback |
| 4962 | return eSIR_FAILURE; |
| 4963 | } |
| 4964 | |
| 4965 | return eSIR_SUCCESS; |
| 4966 | |
| 4967 | } // End limSendChannelSwitchMgmtFrame. |
| 4968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | |
| 4970 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4971 | #ifdef WLAN_FEATURE_11AC |
| 4972 | tSirRetStatus |
| 4973 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 4974 | tSirMacAddr peer, |
| 4975 | tANI_U8 nMode, |
| 4976 | tpPESession psessionEntry ) |
| 4977 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4978 | tDot11fOperatingMode frm; |
| 4979 | tANI_U8 *pFrame; |
| 4980 | tSirRetStatus nSirStatus; |
| 4981 | tpSirMacMgmtHdr pMacHdr; |
| 4982 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 4983 | void *pPacket; |
| 4984 | eHalStatus halstatus; |
| 4985 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4986 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4987 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4988 | |
| 4989 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 4990 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 4991 | frm.OperatingMode.chanWidth = nMode; |
| 4992 | frm.OperatingMode.rxNSS = 0; |
| 4993 | frm.OperatingMode.rxNSSType = 0; |
| 4994 | |
| 4995 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 4996 | if ( DOT11F_FAILED( nStatus ) ) |
| 4997 | { |
| 4998 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4999 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5000 | nStatus ); |
| 5001 | // We'll fall back on the worst case scenario: |
| 5002 | nPayload = sizeof( tDot11fOperatingMode); |
| 5003 | } |
| 5004 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5005 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5006 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5007 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5008 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5009 | } |
| 5010 | |
| 5011 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5012 | |
| 5013 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5014 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5015 | { |
| 5016 | 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] | 5017 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5018 | return eSIR_FAILURE; |
| 5019 | } |
| 5020 | |
| 5021 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5022 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5023 | |
| 5024 | |
| 5025 | // Next, we fill out the buffer descriptor: |
| 5026 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5027 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5028 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5029 | } else |
| 5030 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5031 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5032 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5033 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5034 | (tANI_U8 *) psessionEntry->bssId, |
| 5035 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5036 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5037 | { |
| 5038 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5039 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5040 | nSirStatus ); |
| 5041 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5042 | return eSIR_FAILURE; // just allocated... |
| 5043 | } |
| 5044 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5045 | sizeof(tSirMacMgmtHdr), |
| 5046 | nPayload, &nPayload ); |
| 5047 | if ( DOT11F_FAILED( nStatus ) ) |
| 5048 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5049 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5050 | nStatus ); |
| 5051 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5052 | return eSIR_FAILURE; // allocated! |
| 5053 | } |
| 5054 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5055 | { |
| 5056 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5057 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5058 | } |
| 5059 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5060 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5061 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5062 | ) |
| 5063 | { |
| 5064 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5065 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5066 | |
| 5067 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5068 | psessionEntry->peSessionId, |
| 5069 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5070 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5071 | HAL_TXRX_FRM_802_11_MGMT, |
| 5072 | ANI_TXDIR_TODS, |
| 5073 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5074 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5075 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5076 | psessionEntry->peSessionId, |
| 5077 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5078 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5079 | { |
| 5080 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5081 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5082 | nSirStatus ); |
| 5083 | //Pkt will be freed up by the callback |
| 5084 | return eSIR_FAILURE; |
| 5085 | } |
| 5086 | |
| 5087 | return eSIR_SUCCESS; |
| 5088 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5089 | |
| 5090 | /** |
| 5091 | * \brief Send a VHT Channel Switch Announcement |
| 5092 | * |
| 5093 | * |
| 5094 | * \param pMac Pointer to the global MAC datastructure |
| 5095 | * |
| 5096 | * \param peer MAC address to which this frame will be sent |
| 5097 | * |
| 5098 | * \param nChanWidth |
| 5099 | * |
| 5100 | * \param nNewChannel |
| 5101 | * |
| 5102 | * |
| 5103 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5104 | * |
| 5105 | * |
| 5106 | */ |
| 5107 | |
| 5108 | tSirRetStatus |
| 5109 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5110 | tSirMacAddr peer, |
| 5111 | tANI_U8 nChanWidth, |
| 5112 | tANI_U8 nNewChannel, |
| 5113 | tANI_U8 ncbMode, |
| 5114 | tpPESession psessionEntry ) |
| 5115 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5116 | tDot11fChannelSwitch frm; |
| 5117 | tANI_U8 *pFrame; |
| 5118 | tSirRetStatus nSirStatus; |
| 5119 | tpSirMacMgmtHdr pMacHdr; |
| 5120 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5121 | void *pPacket; |
| 5122 | eHalStatus halstatus; |
| 5123 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5124 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5125 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5126 | |
| 5127 | |
| 5128 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5129 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5130 | frm.ChanSwitchAnn.switchMode = 1; |
| 5131 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5132 | frm.ChanSwitchAnn.switchCount = 1; |
| 5133 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5134 | frm.ExtChanSwitchAnn.present = 1; |
| 5135 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5136 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5137 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5138 | frm.ChanSwitchAnn.present = 1; |
| 5139 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5140 | |
| 5141 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5142 | if ( DOT11F_FAILED( nStatus ) ) |
| 5143 | { |
| 5144 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5145 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5146 | nStatus ); |
| 5147 | // We'll fall back on the worst case scenario: |
| 5148 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5149 | } |
| 5150 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5151 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5152 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5153 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5154 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5155 | } |
| 5156 | |
| 5157 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5158 | |
| 5159 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5160 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5161 | { |
| 5162 | 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] | 5163 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5164 | return eSIR_FAILURE; |
| 5165 | } |
| 5166 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5167 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5168 | |
| 5169 | // Next, we fill out the buffer descriptor: |
| 5170 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5171 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5172 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5173 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5174 | (tANI_U8 *) psessionEntry->bssId, |
| 5175 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5176 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5177 | { |
| 5178 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5179 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5180 | nSirStatus ); |
| 5181 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5182 | return eSIR_FAILURE; // just allocated... |
| 5183 | } |
| 5184 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5185 | sizeof(tSirMacMgmtHdr), |
| 5186 | nPayload, &nPayload ); |
| 5187 | if ( DOT11F_FAILED( nStatus ) ) |
| 5188 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5189 | 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] | 5190 | nStatus ); |
| 5191 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5192 | return eSIR_FAILURE; // allocated! |
| 5193 | } |
| 5194 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5195 | { |
| 5196 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5197 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5198 | } |
| 5199 | |
| 5200 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5201 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5202 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5203 | ) |
| 5204 | { |
| 5205 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5206 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5207 | |
| 5208 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5209 | psessionEntry->peSessionId, |
| 5210 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5211 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5212 | HAL_TXRX_FRM_802_11_MGMT, |
| 5213 | ANI_TXDIR_TODS, |
| 5214 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5215 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5216 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5217 | psessionEntry->peSessionId, |
| 5218 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5219 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5220 | { |
| 5221 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5222 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5223 | nSirStatus ); |
| 5224 | //Pkt will be freed up by the callback |
| 5225 | return eSIR_FAILURE; |
| 5226 | } |
| 5227 | |
| 5228 | return eSIR_SUCCESS; |
| 5229 | |
| 5230 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5231 | |
| 5232 | |
| 5233 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5234 | #endif |
| 5235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5236 | /** |
| 5237 | * \brief Send an ADDBA Req Action Frame to peer |
| 5238 | * |
| 5239 | * \sa limSendAddBAReq |
| 5240 | * |
| 5241 | * \param pMac The global tpAniSirGlobal object |
| 5242 | * |
| 5243 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5244 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5245 | * Frame to the peer |
| 5246 | * |
| 5247 | * \return eSIR_SUCCESS if setup completes successfully |
| 5248 | * eSIR_FAILURE is some problem is encountered |
| 5249 | */ |
| 5250 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5251 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5252 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5253 | tDot11fAddBAReq frmAddBAReq; |
| 5254 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5255 | tpSirMacMgmtHdr pMacHdr; |
| 5256 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5257 | tSirRetStatus statusCode; |
| 5258 | eHalStatus halStatus; |
| 5259 | void *pPacket; |
| 5260 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5261 | |
| 5262 | if(NULL == psessionEntry) |
| 5263 | { |
| 5264 | return eSIR_FAILURE; |
| 5265 | } |
| 5266 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5267 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5268 | |
| 5269 | // Category - 3 (BA) |
| 5270 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5271 | |
| 5272 | // Action - 0 (ADDBA Req) |
| 5273 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5274 | |
| 5275 | // FIXME - Dialog Token, generalize this... |
| 5276 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5277 | |
| 5278 | // Fill the ADDBA Parameter Set |
| 5279 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5280 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5281 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5282 | |
| 5283 | // BA timeout |
| 5284 | // 0 - indicates no BA timeout |
| 5285 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5286 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5287 | /* Send SSN whatever we get from FW. |
| 5288 | */ |
| 5289 | frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5290 | |
| 5291 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5292 | |
| 5293 | if( DOT11F_FAILED( nStatus )) |
| 5294 | { |
| 5295 | limLog( pMac, LOGW, |
| 5296 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5297 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5298 | nStatus ); |
| 5299 | |
| 5300 | // We'll fall back on the worst case scenario: |
| 5301 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5302 | } |
| 5303 | else if( DOT11F_WARNED( nStatus )) |
| 5304 | { |
| 5305 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5306 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5307 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5308 | nStatus ); |
| 5309 | } |
| 5310 | |
| 5311 | // Add the MGMT header to frame length |
| 5312 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5313 | |
| 5314 | // Need to allocate a buffer for ADDBA AF |
| 5315 | if( eHAL_STATUS_SUCCESS != |
| 5316 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5317 | HAL_TXRX_FRM_802_11_MGMT, |
| 5318 | (tANI_U16) frameLen, |
| 5319 | (void **) &pAddBAReqBuffer, |
| 5320 | (void **) &pPacket ))) |
| 5321 | { |
| 5322 | // Log error |
| 5323 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5324 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5325 | frameLen, |
| 5326 | halStatus ); |
| 5327 | |
| 5328 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5329 | goto returnAfterError; |
| 5330 | } |
| 5331 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5332 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5333 | |
| 5334 | // Copy necessary info to BD |
| 5335 | if( eSIR_SUCCESS != |
| 5336 | (statusCode = limPopulateMacHeader( pMac, |
| 5337 | pAddBAReqBuffer, |
| 5338 | SIR_MAC_MGMT_FRAME, |
| 5339 | SIR_MAC_MGMT_ACTION, |
| 5340 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5341 | goto returnAfterError; |
| 5342 | |
| 5343 | // Update A3 with the BSSID |
| 5344 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5345 | |
| 5346 | #if 0 |
| 5347 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5348 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5349 | WNI_CFG_BSSID, |
| 5350 | (tANI_U8 *) pMacHdr->bssId, |
| 5351 | &cfgLen )) |
| 5352 | { |
| 5353 | limLog( pMac, LOGP, |
| 5354 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5355 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5356 | |
| 5357 | // FIXME - Need to convert to tSirRetStatus |
| 5358 | statusCode = eSIR_FAILURE; |
| 5359 | goto returnAfterError; |
| 5360 | } |
| 5361 | #endif//TO SUPPORT BT-AMP |
| 5362 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5363 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5364 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5365 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5366 | #endif |
| 5367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | // Now, we're ready to "pack" the frames |
| 5369 | nStatus = dot11fPackAddBAReq( pMac, |
| 5370 | &frmAddBAReq, |
| 5371 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5372 | nPayload, |
| 5373 | &nPayload ); |
| 5374 | |
| 5375 | if( DOT11F_FAILED( nStatus )) |
| 5376 | { |
| 5377 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5378 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5379 | nStatus ); |
| 5380 | |
| 5381 | // FIXME - Need to convert to tSirRetStatus |
| 5382 | statusCode = eSIR_FAILURE; |
| 5383 | goto returnAfterError; |
| 5384 | } |
| 5385 | else if( DOT11F_WARNED( nStatus )) |
| 5386 | { |
| 5387 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5388 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5389 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5390 | } |
| 5391 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5392 | limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with" |
| 5393 | " tid = %d policy = %d buffsize = %d " |
| 5394 | " amsduSupported = %d"), |
| 5395 | MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr), |
| 5396 | frmAddBAReq.AddBAParameterSet.tid, |
| 5397 | frmAddBAReq.AddBAParameterSet.policy, |
| 5398 | frmAddBAReq.AddBAParameterSet.bufferSize, |
| 5399 | frmAddBAReq.AddBAParameterSet.amsduSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5400 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5401 | limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ), |
| 5402 | frmAddBAReq.BAStartingSequenceControl.ssn, |
| 5403 | frmAddBAReq.BAStartingSequenceControl.fragNumber); |
| 5404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5405 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5406 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5407 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5408 | ) |
| 5409 | { |
| 5410 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5411 | } |
| 5412 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5413 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5414 | psessionEntry->peSessionId, |
| 5415 | pMacHdr->fc.subType)); |
| 5416 | halStatus = halTxFrame( pMac, |
| 5417 | pPacket, |
| 5418 | (tANI_U16) frameLen, |
| 5419 | HAL_TXRX_FRM_802_11_MGMT, |
| 5420 | ANI_TXDIR_TODS, |
| 5421 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5422 | limTxComplete, |
| 5423 | pAddBAReqBuffer, txFlag ); |
| 5424 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5425 | psessionEntry->peSessionId, |
| 5426 | halStatus)); |
| 5427 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5428 | { |
| 5429 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5430 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5431 | halStatus ); |
| 5432 | |
| 5433 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5434 | statusCode = eSIR_FAILURE; |
| 5435 | //Pkt will be freed up by the callback |
| 5436 | return statusCode; |
| 5437 | } |
| 5438 | else |
| 5439 | return eSIR_SUCCESS; |
| 5440 | |
| 5441 | returnAfterError: |
| 5442 | |
| 5443 | // Release buffer, if allocated |
| 5444 | if( NULL != pAddBAReqBuffer ) |
| 5445 | palPktFree( pMac->hHdd, |
| 5446 | HAL_TXRX_FRM_802_11_MGMT, |
| 5447 | (void *) pAddBAReqBuffer, |
| 5448 | (void *) pPacket ); |
| 5449 | |
| 5450 | return statusCode; |
| 5451 | } |
| 5452 | |
| 5453 | /** |
| 5454 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5455 | * |
| 5456 | * \sa limSendAddBARsp |
| 5457 | * |
| 5458 | * \param pMac The global tpAniSirGlobal object |
| 5459 | * |
| 5460 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5461 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5462 | * Frame to the peer |
| 5463 | * |
| 5464 | * \return eSIR_SUCCESS if setup completes successfully |
| 5465 | * eSIR_FAILURE is some problem is encountered |
| 5466 | */ |
| 5467 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5468 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5469 | tpPESession psessionEntry) |
| 5470 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5471 | tDot11fAddBARsp frmAddBARsp; |
| 5472 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5473 | tpSirMacMgmtHdr pMacHdr; |
| 5474 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5475 | tSirRetStatus statusCode; |
| 5476 | eHalStatus halStatus; |
| 5477 | void *pPacket; |
| 5478 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5479 | |
| 5480 | if(NULL == psessionEntry) |
| 5481 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5482 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5483 | return eSIR_FAILURE; |
| 5484 | } |
| 5485 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5486 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | |
| 5488 | // Category - 3 (BA) |
| 5489 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5490 | // Action - 1 (ADDBA Rsp) |
| 5491 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5492 | |
| 5493 | // Should be same as the one we received in the ADDBA Req |
| 5494 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5495 | |
| 5496 | // ADDBA Req status |
| 5497 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5498 | |
| 5499 | // Fill the ADDBA Parameter Set as provided by caller |
| 5500 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5501 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5502 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5503 | |
| 5504 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5505 | { |
| 5506 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5507 | psessionEntry->amsduSupportedInBA; |
| 5508 | } |
| 5509 | else |
| 5510 | { |
| 5511 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5512 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5513 | |
| 5514 | // BA timeout |
| 5515 | // 0 - indicates no BA timeout |
| 5516 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5517 | |
| 5518 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5519 | |
| 5520 | if( DOT11F_FAILED( nStatus )) |
| 5521 | { |
| 5522 | limLog( pMac, LOGW, |
| 5523 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5524 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5525 | nStatus ); |
| 5526 | |
| 5527 | // We'll fall back on the worst case scenario: |
| 5528 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5529 | } |
| 5530 | else if( DOT11F_WARNED( nStatus )) |
| 5531 | { |
| 5532 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5533 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5534 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5535 | nStatus ); |
| 5536 | } |
| 5537 | |
| 5538 | // Need to allocate a buffer for ADDBA AF |
| 5539 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5540 | |
| 5541 | // Allocate shared memory |
| 5542 | if( eHAL_STATUS_SUCCESS != |
| 5543 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5544 | HAL_TXRX_FRM_802_11_MGMT, |
| 5545 | (tANI_U16) frameLen, |
| 5546 | (void **) &pAddBARspBuffer, |
| 5547 | (void **) &pPacket ))) |
| 5548 | { |
| 5549 | // Log error |
| 5550 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5551 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5552 | frameLen, |
| 5553 | halStatus ); |
| 5554 | |
| 5555 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5556 | goto returnAfterError; |
| 5557 | } |
| 5558 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5559 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5560 | |
| 5561 | // Copy necessary info to BD |
| 5562 | if( eSIR_SUCCESS != |
| 5563 | (statusCode = limPopulateMacHeader( pMac, |
| 5564 | pAddBARspBuffer, |
| 5565 | SIR_MAC_MGMT_FRAME, |
| 5566 | SIR_MAC_MGMT_ACTION, |
| 5567 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5568 | goto returnAfterError; |
| 5569 | |
| 5570 | // Update A3 with the BSSID |
| 5571 | |
| 5572 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5573 | |
| 5574 | #if 0 |
| 5575 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5576 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5577 | WNI_CFG_BSSID, |
| 5578 | (tANI_U8 *) pMacHdr->bssId, |
| 5579 | &cfgLen )) |
| 5580 | { |
| 5581 | limLog( pMac, LOGP, |
| 5582 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5583 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | |
| 5585 | // FIXME - Need to convert to tSirRetStatus |
| 5586 | statusCode = eSIR_FAILURE; |
| 5587 | goto returnAfterError; |
| 5588 | } |
| 5589 | #endif // TO SUPPORT BT-AMP |
| 5590 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5591 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5592 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5593 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5594 | #endif |
| 5595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5596 | // Now, we're ready to "pack" the frames |
| 5597 | nStatus = dot11fPackAddBARsp( pMac, |
| 5598 | &frmAddBARsp, |
| 5599 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5600 | nPayload, |
| 5601 | &nPayload ); |
| 5602 | |
| 5603 | if( DOT11F_FAILED( nStatus )) |
| 5604 | { |
| 5605 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5606 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5607 | nStatus ); |
| 5608 | |
| 5609 | // FIXME - Need to convert to tSirRetStatus |
| 5610 | statusCode = eSIR_FAILURE; |
| 5611 | goto returnAfterError; |
| 5612 | } |
| 5613 | else if( DOT11F_WARNED( nStatus )) |
| 5614 | { |
| 5615 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5616 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5617 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5618 | } |
| 5619 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5620 | limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with" |
| 5621 | " tid = %d policy = %d buffsize = %d" |
| 5622 | " amsduSupported = %d status %d"), |
| 5623 | MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr), |
| 5624 | frmAddBARsp.AddBAParameterSet.tid, |
| 5625 | frmAddBARsp.AddBAParameterSet.policy, |
| 5626 | frmAddBARsp.AddBAParameterSet.bufferSize, |
| 5627 | frmAddBARsp.AddBAParameterSet.amsduSupported, |
| 5628 | frmAddBARsp.Status.status); |
| 5629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5630 | |
| 5631 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5633 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5634 | ) |
| 5635 | { |
| 5636 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5637 | } |
| 5638 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5639 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5640 | psessionEntry->peSessionId, |
| 5641 | pMacHdr->fc.subType)); |
| 5642 | halStatus = halTxFrame( pMac, |
| 5643 | pPacket, |
| 5644 | (tANI_U16) frameLen, |
| 5645 | HAL_TXRX_FRM_802_11_MGMT, |
| 5646 | ANI_TXDIR_TODS, |
| 5647 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5648 | limTxComplete, |
| 5649 | pAddBARspBuffer, txFlag ); |
| 5650 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5651 | psessionEntry->peSessionId, |
| 5652 | halStatus)); |
| 5653 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5654 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5656 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5657 | halStatus ); |
| 5658 | |
| 5659 | // FIXME - HAL error codes are different from PE error |
| 5660 | // codes!! And, this routine is returning tSirRetStatus |
| 5661 | statusCode = eSIR_FAILURE; |
| 5662 | //Pkt will be freed up by the callback |
| 5663 | return statusCode; |
| 5664 | } |
| 5665 | else |
| 5666 | return eSIR_SUCCESS; |
| 5667 | |
| 5668 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | // Release buffer, if allocated |
| 5670 | if( NULL != pAddBARspBuffer ) |
| 5671 | palPktFree( pMac->hHdd, |
| 5672 | HAL_TXRX_FRM_802_11_MGMT, |
| 5673 | (void *) pAddBARspBuffer, |
| 5674 | (void *) pPacket ); |
| 5675 | |
| 5676 | return statusCode; |
| 5677 | } |
| 5678 | |
| 5679 | /** |
| 5680 | * \brief Send a DELBA Indication Action Frame to peer |
| 5681 | * |
| 5682 | * \sa limSendDelBAInd |
| 5683 | * |
| 5684 | * \param pMac The global tpAniSirGlobal object |
| 5685 | * |
| 5686 | * \param peerMacAddr MAC Address of peer |
| 5687 | * |
| 5688 | * \param reasonCode Reason for the DELBA notification |
| 5689 | * |
| 5690 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5691 | * This identifies the TID for which the BA session is |
| 5692 | * being deleted. |
| 5693 | * |
| 5694 | * \return eSIR_SUCCESS if setup completes successfully |
| 5695 | * eSIR_FAILURE is some problem is encountered |
| 5696 | */ |
| 5697 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5698 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5699 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5700 | tDot11fDelBAInd frmDelBAInd; |
| 5701 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5702 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5703 | tpSirMacMgmtHdr pMacHdr; |
| 5704 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5705 | tSirRetStatus statusCode; |
| 5706 | eHalStatus halStatus; |
| 5707 | void *pPacket; |
| 5708 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5709 | |
| 5710 | if(NULL == psessionEntry) |
| 5711 | { |
| 5712 | return eSIR_FAILURE; |
| 5713 | } |
| 5714 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5715 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5716 | |
| 5717 | // Category - 3 (BA) |
| 5718 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5719 | // Action - 2 (DELBA) |
| 5720 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5721 | |
| 5722 | // Fill the DELBA Parameter Set as provided by caller |
| 5723 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5724 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5725 | |
| 5726 | // BA Starting Sequence Number |
| 5727 | // Fragment number will always be zero |
| 5728 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5729 | |
| 5730 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5731 | |
| 5732 | if( DOT11F_FAILED( nStatus )) |
| 5733 | { |
| 5734 | limLog( pMac, LOGW, |
| 5735 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5736 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5737 | nStatus ); |
| 5738 | |
| 5739 | // We'll fall back on the worst case scenario: |
| 5740 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5741 | } |
| 5742 | else if( DOT11F_WARNED( nStatus )) |
| 5743 | { |
| 5744 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5745 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5746 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5747 | nStatus ); |
| 5748 | } |
| 5749 | |
| 5750 | // Add the MGMT header to frame length |
| 5751 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5752 | |
| 5753 | // Allocate shared memory |
| 5754 | if( eHAL_STATUS_SUCCESS != |
| 5755 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5756 | HAL_TXRX_FRM_802_11_MGMT, |
| 5757 | (tANI_U16) frameLen, |
| 5758 | (void **) &pDelBAIndBuffer, |
| 5759 | (void **) &pPacket ))) |
| 5760 | { |
| 5761 | // Log error |
| 5762 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5763 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | frameLen, |
| 5765 | halStatus ); |
| 5766 | |
| 5767 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5768 | goto returnAfterError; |
| 5769 | } |
| 5770 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5771 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5772 | |
| 5773 | // Copy necessary info to BD |
| 5774 | if( eSIR_SUCCESS != |
| 5775 | (statusCode = limPopulateMacHeader( pMac, |
| 5776 | pDelBAIndBuffer, |
| 5777 | SIR_MAC_MGMT_FRAME, |
| 5778 | SIR_MAC_MGMT_ACTION, |
| 5779 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5780 | goto returnAfterError; |
| 5781 | |
| 5782 | // Update A3 with the BSSID |
| 5783 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5784 | |
| 5785 | #if 0 |
| 5786 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5787 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5788 | WNI_CFG_BSSID, |
| 5789 | (tANI_U8 *) pMacHdr->bssId, |
| 5790 | &cfgLen )) |
| 5791 | { |
| 5792 | limLog( pMac, LOGP, |
| 5793 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5794 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5795 | |
| 5796 | // FIXME - Need to convert to tSirRetStatus |
| 5797 | statusCode = eSIR_FAILURE; |
| 5798 | goto returnAfterError; |
| 5799 | } |
| 5800 | #endif //TO SUPPORT BT-AMP |
| 5801 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5802 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5803 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5804 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5805 | #endif |
| 5806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5807 | // Now, we're ready to "pack" the frames |
| 5808 | nStatus = dot11fPackDelBAInd( pMac, |
| 5809 | &frmDelBAInd, |
| 5810 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5811 | nPayload, |
| 5812 | &nPayload ); |
| 5813 | |
| 5814 | if( DOT11F_FAILED( nStatus )) |
| 5815 | { |
| 5816 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5817 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5818 | nStatus ); |
| 5819 | |
| 5820 | // FIXME - Need to convert to tSirRetStatus |
| 5821 | statusCode = eSIR_FAILURE; |
| 5822 | goto returnAfterError; |
| 5823 | } |
| 5824 | else if( DOT11F_WARNED( nStatus )) |
| 5825 | { |
| 5826 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5827 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5828 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5829 | } |
| 5830 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5831 | limLog( pMac, LOG1, |
| 5832 | FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d" |
| 5833 | " initiator = %d reason = %d" ), |
| 5834 | MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr), |
| 5835 | frmDelBAInd.DelBAParameterSet.tid, |
| 5836 | frmDelBAInd.DelBAParameterSet.initiator, |
| 5837 | frmDelBAInd.Reason.code); |
| 5838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5839 | |
| 5840 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5841 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5842 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5843 | ) |
| 5844 | { |
| 5845 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5846 | } |
| 5847 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5848 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5849 | psessionEntry->peSessionId, |
| 5850 | pMacHdr->fc.subType)); |
| 5851 | halStatus = halTxFrame( pMac, |
| 5852 | pPacket, |
| 5853 | (tANI_U16) frameLen, |
| 5854 | HAL_TXRX_FRM_802_11_MGMT, |
| 5855 | ANI_TXDIR_TODS, |
| 5856 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5857 | limTxComplete, |
| 5858 | pDelBAIndBuffer, txFlag ); |
| 5859 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5860 | psessionEntry->peSessionId, |
| 5861 | halStatus)); |
| 5862 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5863 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5864 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5865 | statusCode = eSIR_FAILURE; |
| 5866 | //Pkt will be freed up by the callback |
| 5867 | return statusCode; |
| 5868 | } |
| 5869 | else |
| 5870 | return eSIR_SUCCESS; |
| 5871 | |
| 5872 | returnAfterError: |
| 5873 | |
| 5874 | // Release buffer, if allocated |
| 5875 | if( NULL != pDelBAIndBuffer ) |
| 5876 | palPktFree( pMac->hHdd, |
| 5877 | HAL_TXRX_FRM_802_11_MGMT, |
| 5878 | (void *) pDelBAIndBuffer, |
| 5879 | (void *) pPacket ); |
| 5880 | |
| 5881 | return statusCode; |
| 5882 | } |
| 5883 | |
| 5884 | #if defined WLAN_FEATURE_VOWIFI |
| 5885 | |
| 5886 | /** |
| 5887 | * \brief Send a Neighbor Report Request Action frame |
| 5888 | * |
| 5889 | * |
| 5890 | * \param pMac Pointer to the global MAC structure |
| 5891 | * |
| 5892 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5893 | * |
| 5894 | * \param peer mac address of peer station. |
| 5895 | * |
| 5896 | * \param psessionEntry address of session entry. |
| 5897 | * |
| 5898 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5899 | * |
| 5900 | * |
| 5901 | */ |
| 5902 | |
| 5903 | tSirRetStatus |
| 5904 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5905 | tpSirMacNeighborReportReq pNeighborReq, |
| 5906 | tSirMacAddr peer, |
| 5907 | tpPESession psessionEntry |
| 5908 | ) |
| 5909 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5910 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5911 | tDot11fNeighborReportRequest frm; |
| 5912 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5913 | tpSirMacMgmtHdr pMacHdr; |
| 5914 | tANI_U32 nBytes, nPayload, nStatus; |
| 5915 | void *pPacket; |
| 5916 | eHalStatus halstatus; |
| 5917 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5918 | |
| 5919 | if ( psessionEntry == NULL ) |
| 5920 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5921 | 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] | 5922 | return eSIR_FAILURE; |
| 5923 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5924 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5925 | |
| 5926 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5927 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5928 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5929 | |
| 5930 | |
| 5931 | if( pNeighborReq->ssid_present ) |
| 5932 | { |
| 5933 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5934 | } |
| 5935 | |
| 5936 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5937 | if ( DOT11F_FAILED( nStatus ) ) |
| 5938 | { |
| 5939 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5940 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5941 | nStatus ); |
| 5942 | // We'll fall back on the worst case scenario: |
| 5943 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5944 | } |
| 5945 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5946 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5947 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5948 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5949 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | } |
| 5951 | |
| 5952 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5953 | |
| 5954 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5955 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5956 | { |
| 5957 | 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] | 5958 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | return eSIR_FAILURE; |
| 5960 | } |
| 5961 | |
| 5962 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5963 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5964 | |
| 5965 | // Copy necessary info to BD |
| 5966 | if( eSIR_SUCCESS != |
| 5967 | (statusCode = limPopulateMacHeader( pMac, |
| 5968 | pFrame, |
| 5969 | SIR_MAC_MGMT_FRAME, |
| 5970 | SIR_MAC_MGMT_ACTION, |
| 5971 | peer, psessionEntry->selfMacAddr))) |
| 5972 | goto returnAfterError; |
| 5973 | |
| 5974 | // Update A3 with the BSSID |
| 5975 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5976 | |
| 5977 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5978 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5979 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5980 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5981 | #endif |
| 5982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5983 | // Now, we're ready to "pack" the frames |
| 5984 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 5985 | &frm, |
| 5986 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5987 | nPayload, |
| 5988 | &nPayload ); |
| 5989 | |
| 5990 | if( DOT11F_FAILED( nStatus )) |
| 5991 | { |
| 5992 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5993 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5994 | nStatus ); |
| 5995 | |
| 5996 | // FIXME - Need to convert to tSirRetStatus |
| 5997 | statusCode = eSIR_FAILURE; |
| 5998 | goto returnAfterError; |
| 5999 | } |
| 6000 | else if( DOT11F_WARNED( nStatus )) |
| 6001 | { |
| 6002 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6003 | FL( "There were warnings while packing Neighbor Report " |
| 6004 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6005 | } |
| 6006 | |
| 6007 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6008 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6009 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6010 | |
| 6011 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6012 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6013 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | ) |
| 6015 | { |
| 6016 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6017 | } |
| 6018 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6019 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6020 | psessionEntry->peSessionId, |
| 6021 | pMacHdr->fc.subType)); |
| 6022 | halstatus = halTxFrame( pMac, |
| 6023 | pPacket, |
| 6024 | (tANI_U16) nBytes, |
| 6025 | HAL_TXRX_FRM_802_11_MGMT, |
| 6026 | ANI_TXDIR_TODS, |
| 6027 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6028 | limTxComplete, |
| 6029 | pFrame, txFlag ); |
| 6030 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6031 | psessionEntry->peSessionId, |
| 6032 | halstatus)); |
| 6033 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6034 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6035 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6036 | statusCode = eSIR_FAILURE; |
| 6037 | //Pkt will be freed up by the callback |
| 6038 | return statusCode; |
| 6039 | } |
| 6040 | else |
| 6041 | return eSIR_SUCCESS; |
| 6042 | |
| 6043 | returnAfterError: |
| 6044 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6045 | |
| 6046 | return statusCode; |
| 6047 | } // End limSendNeighborReportRequestFrame. |
| 6048 | |
| 6049 | /** |
| 6050 | * \brief Send a Link Report Action frame |
| 6051 | * |
| 6052 | * |
| 6053 | * \param pMac Pointer to the global MAC structure |
| 6054 | * |
| 6055 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6056 | * |
| 6057 | * \param peer mac address of peer station. |
| 6058 | * |
| 6059 | * \param psessionEntry address of session entry. |
| 6060 | * |
| 6061 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6062 | * |
| 6063 | * |
| 6064 | */ |
| 6065 | |
| 6066 | tSirRetStatus |
| 6067 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6068 | tpSirMacLinkReport pLinkReport, |
| 6069 | tSirMacAddr peer, |
| 6070 | tpPESession psessionEntry |
| 6071 | ) |
| 6072 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6073 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6074 | tDot11fLinkMeasurementReport frm; |
| 6075 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6076 | tpSirMacMgmtHdr pMacHdr; |
| 6077 | tANI_U32 nBytes, nPayload, nStatus; |
| 6078 | void *pPacket; |
| 6079 | eHalStatus halstatus; |
| 6080 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6081 | |
| 6082 | |
| 6083 | if ( psessionEntry == NULL ) |
| 6084 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6085 | 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] | 6086 | return eSIR_FAILURE; |
| 6087 | } |
| 6088 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6089 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6090 | |
| 6091 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6092 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6093 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6094 | |
| 6095 | |
| 6096 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6097 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6098 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6099 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6100 | //such case this way than changing the frame parser. |
| 6101 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6102 | frm.TPCEleLen.TPCLen = 2; |
| 6103 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6104 | frm.LinkMargin.linkMargin = 0; |
| 6105 | |
| 6106 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6107 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6108 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6109 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6110 | |
| 6111 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6112 | if ( DOT11F_FAILED( nStatus ) ) |
| 6113 | { |
| 6114 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6115 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6116 | nStatus ); |
| 6117 | // We'll fall back on the worst case scenario: |
| 6118 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6119 | } |
| 6120 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6121 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6122 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6123 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6124 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6125 | } |
| 6126 | |
| 6127 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6128 | |
| 6129 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6130 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6131 | { |
| 6132 | 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] | 6133 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6134 | return eSIR_FAILURE; |
| 6135 | } |
| 6136 | |
| 6137 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6138 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6139 | |
| 6140 | // Copy necessary info to BD |
| 6141 | if( eSIR_SUCCESS != |
| 6142 | (statusCode = limPopulateMacHeader( pMac, |
| 6143 | pFrame, |
| 6144 | SIR_MAC_MGMT_FRAME, |
| 6145 | SIR_MAC_MGMT_ACTION, |
| 6146 | peer, psessionEntry->selfMacAddr))) |
| 6147 | goto returnAfterError; |
| 6148 | |
| 6149 | // Update A3 with the BSSID |
| 6150 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6151 | |
| 6152 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6153 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6154 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6155 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6156 | #endif |
| 6157 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6158 | // Now, we're ready to "pack" the frames |
| 6159 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6160 | &frm, |
| 6161 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6162 | nPayload, |
| 6163 | &nPayload ); |
| 6164 | |
| 6165 | if( DOT11F_FAILED( nStatus )) |
| 6166 | { |
| 6167 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6168 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6169 | nStatus ); |
| 6170 | |
| 6171 | // FIXME - Need to convert to tSirRetStatus |
| 6172 | statusCode = eSIR_FAILURE; |
| 6173 | goto returnAfterError; |
| 6174 | } |
| 6175 | else if( DOT11F_WARNED( nStatus )) |
| 6176 | { |
| 6177 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6178 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6179 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | } |
| 6181 | |
| 6182 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6183 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6184 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6185 | |
| 6186 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6187 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6188 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6189 | ) |
| 6190 | { |
| 6191 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6192 | } |
| 6193 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6194 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6195 | psessionEntry->peSessionId, |
| 6196 | pMacHdr->fc.subType)); |
| 6197 | halstatus = halTxFrame( pMac, |
| 6198 | pPacket, |
| 6199 | (tANI_U16) nBytes, |
| 6200 | HAL_TXRX_FRM_802_11_MGMT, |
| 6201 | ANI_TXDIR_TODS, |
| 6202 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6203 | limTxComplete, |
| 6204 | pFrame, txFlag ); |
| 6205 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6206 | psessionEntry->peSessionId, |
| 6207 | halstatus)); |
| 6208 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6209 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6210 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6211 | statusCode = eSIR_FAILURE; |
| 6212 | //Pkt will be freed up by the callback |
| 6213 | return statusCode; |
| 6214 | } |
| 6215 | else |
| 6216 | return eSIR_SUCCESS; |
| 6217 | |
| 6218 | returnAfterError: |
| 6219 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6220 | |
| 6221 | return statusCode; |
| 6222 | } // End limSendLinkReportActionFrame. |
| 6223 | |
| 6224 | /** |
| 6225 | * \brief Send a Beacon Report Action frame |
| 6226 | * |
| 6227 | * |
| 6228 | * \param pMac Pointer to the global MAC structure |
| 6229 | * |
| 6230 | * \param dialog_token dialog token to be used in the action frame. |
| 6231 | * |
| 6232 | * \param num_report number of reports in pRRMReport. |
| 6233 | * |
| 6234 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6235 | * |
| 6236 | * \param peer mac address of peer station. |
| 6237 | * |
| 6238 | * \param psessionEntry address of session entry. |
| 6239 | * |
| 6240 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6241 | * |
| 6242 | * |
| 6243 | */ |
| 6244 | |
| 6245 | tSirRetStatus |
| 6246 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6247 | tANI_U8 dialog_token, |
| 6248 | tANI_U8 num_report, |
| 6249 | tpSirMacRadioMeasureReport pRRMReport, |
| 6250 | tSirMacAddr peer, |
| 6251 | tpPESession psessionEntry |
| 6252 | ) |
| 6253 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6254 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6255 | tANI_U8 *pFrame; |
| 6256 | tpSirMacMgmtHdr pMacHdr; |
| 6257 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6258 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6259 | eHalStatus halstatus; |
| 6260 | tANI_U8 i; |
| 6261 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6263 | tDot11fRadioMeasurementReport *frm = |
| 6264 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6265 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6266 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6267 | return eSIR_FAILURE; |
| 6268 | } |
| 6269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | if ( psessionEntry == NULL ) |
| 6271 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6272 | 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] | 6273 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6274 | return eSIR_FAILURE; |
| 6275 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6276 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6277 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6278 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6279 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6280 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6281 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6282 | 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] | 6283 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6284 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6285 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6286 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6287 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6288 | 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] | 6289 | switch( pRRMReport[i].type ) |
| 6290 | { |
| 6291 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6292 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6293 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6294 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6295 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6296 | break; |
| 6297 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6298 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6299 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6300 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6301 | break; |
| 6302 | } |
| 6303 | } |
| 6304 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6305 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6306 | if ( DOT11F_FAILED( nStatus ) ) |
| 6307 | { |
| 6308 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6309 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6310 | nStatus ); |
| 6311 | // We'll fall back on the worst case scenario: |
| 6312 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6313 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6314 | return eSIR_FAILURE; |
| 6315 | } |
| 6316 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6317 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6318 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6319 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6320 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6321 | } |
| 6322 | |
| 6323 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6324 | |
| 6325 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6326 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6327 | { |
| 6328 | 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] | 6329 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6330 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6331 | return eSIR_FAILURE; |
| 6332 | } |
| 6333 | |
| 6334 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6335 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6336 | |
| 6337 | // Copy necessary info to BD |
| 6338 | if( eSIR_SUCCESS != |
| 6339 | (statusCode = limPopulateMacHeader( pMac, |
| 6340 | pFrame, |
| 6341 | SIR_MAC_MGMT_FRAME, |
| 6342 | SIR_MAC_MGMT_ACTION, |
| 6343 | peer, psessionEntry->selfMacAddr))) |
| 6344 | goto returnAfterError; |
| 6345 | |
| 6346 | // Update A3 with the BSSID |
| 6347 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6348 | |
| 6349 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6350 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6351 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6352 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6353 | #endif |
| 6354 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6355 | // Now, we're ready to "pack" the frames |
| 6356 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6357 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6359 | nPayload, |
| 6360 | &nPayload ); |
| 6361 | |
| 6362 | if( DOT11F_FAILED( nStatus )) |
| 6363 | { |
| 6364 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6365 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6366 | nStatus ); |
| 6367 | |
| 6368 | // FIXME - Need to convert to tSirRetStatus |
| 6369 | statusCode = eSIR_FAILURE; |
| 6370 | goto returnAfterError; |
| 6371 | } |
| 6372 | else if( DOT11F_WARNED( nStatus )) |
| 6373 | { |
| 6374 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6375 | FL( "There were warnings while packing Radio " |
| 6376 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6377 | } |
| 6378 | |
| 6379 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6380 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6381 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6382 | |
| 6383 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6384 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6385 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6386 | ) |
| 6387 | { |
| 6388 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6389 | } |
| 6390 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6391 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6392 | psessionEntry->peSessionId, |
| 6393 | pMacHdr->fc.subType)); |
| 6394 | halstatus = halTxFrame( pMac, |
| 6395 | pPacket, |
| 6396 | (tANI_U16) nBytes, |
| 6397 | HAL_TXRX_FRM_802_11_MGMT, |
| 6398 | ANI_TXDIR_TODS, |
| 6399 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6400 | limTxComplete, |
| 6401 | pFrame, txFlag ); |
| 6402 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6403 | psessionEntry->peSessionId, |
| 6404 | halstatus)); |
| 6405 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6406 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6407 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | statusCode = eSIR_FAILURE; |
| 6409 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6410 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6411 | return statusCode; |
| 6412 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6413 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6414 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6415 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6416 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6417 | |
| 6418 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6419 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6420 | 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] | 6421 | return statusCode; |
| 6422 | } // End limSendBeaconReportActionFrame. |
| 6423 | |
| 6424 | #endif |
| 6425 | |
| 6426 | #ifdef WLAN_FEATURE_11W |
| 6427 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6428 | * \brief Send SA query request action frame to peer |
| 6429 | * |
| 6430 | * \sa limSendSaQueryRequestFrame |
| 6431 | * |
| 6432 | * |
| 6433 | * \param pMac The global tpAniSirGlobal object |
| 6434 | * |
| 6435 | * \param transId Transaction identifier |
| 6436 | * |
| 6437 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6438 | * |
| 6439 | * \param psessionEntry The PE session entry |
| 6440 | * |
| 6441 | * \return eSIR_SUCCESS if setup completes successfully |
| 6442 | * eSIR_FAILURE is some problem is encountered |
| 6443 | */ |
| 6444 | |
| 6445 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6446 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6447 | { |
| 6448 | |
| 6449 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6450 | tANI_U8 *pFrame; |
| 6451 | tSirRetStatus nSirStatus; |
| 6452 | tpSirMacMgmtHdr pMacHdr; |
| 6453 | tANI_U32 nBytes, nPayload, nStatus; |
| 6454 | void *pPacket; |
| 6455 | eHalStatus halstatus; |
| 6456 | tANI_U8 txFlag = 0; |
| 6457 | |
| 6458 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6459 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6460 | /* 11w action field is : |
| 6461 | action: 0 --> SA Query Request action frame |
| 6462 | action: 1 --> SA Query Response action frame */ |
| 6463 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6464 | /* 11w SA Query Request transId */ |
| 6465 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6466 | |
| 6467 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6468 | if ( DOT11F_FAILED( nStatus ) ) |
| 6469 | { |
| 6470 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6471 | "for an SA Query Request (0x%08x)."), |
| 6472 | nStatus ); |
| 6473 | // We'll fall back on the worst case scenario: |
| 6474 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6475 | } |
| 6476 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6477 | { |
| 6478 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6479 | "the packed size for an SA Query Request" |
| 6480 | " (0x%08x)."), nStatus ); |
| 6481 | } |
| 6482 | |
| 6483 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6484 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6485 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6486 | { |
| 6487 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6488 | "action frame"), nBytes ); |
| 6489 | return eSIR_FAILURE; |
| 6490 | } |
| 6491 | |
| 6492 | // Paranoia: |
| 6493 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6494 | |
| 6495 | // Copy necessary info to BD |
| 6496 | nSirStatus = limPopulateMacHeader( pMac, |
| 6497 | pFrame, |
| 6498 | SIR_MAC_MGMT_FRAME, |
| 6499 | SIR_MAC_MGMT_ACTION, |
| 6500 | peer, psessionEntry->selfMacAddr ); |
| 6501 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6502 | goto returnAfterError; |
| 6503 | |
| 6504 | // Update A3 with the BSSID |
| 6505 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6506 | |
| 6507 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6508 | |
| 6509 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6510 | // in the FC |
| 6511 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6512 | |
| 6513 | // Pack 11w SA Query Request frame |
| 6514 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6515 | &frm, |
| 6516 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6517 | nPayload, |
| 6518 | &nPayload ); |
| 6519 | |
| 6520 | if ( DOT11F_FAILED( nStatus )) |
| 6521 | { |
| 6522 | limLog( pMac, LOGE, |
| 6523 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6524 | nStatus ); |
| 6525 | // FIXME - Need to convert to tSirRetStatus |
| 6526 | nSirStatus = eSIR_FAILURE; |
| 6527 | goto returnAfterError; |
| 6528 | } |
| 6529 | else if ( DOT11F_WARNED( nStatus )) |
| 6530 | { |
| 6531 | limLog( pMac, LOGW, |
| 6532 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6533 | nStatus); |
| 6534 | } |
| 6535 | |
| 6536 | limLog( pMac, LOG1, |
| 6537 | FL( "Sending an SA Query Request to " )); |
| 6538 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6539 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6540 | limLog( pMac, LOGE, |
| 6541 | FL( "Sending an SA Query Request from " )); |
| 6542 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6543 | |
| 6544 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6545 | #ifdef WLAN_FEATURE_P2P |
| 6546 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6547 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6548 | #endif |
| 6549 | ) |
| 6550 | { |
| 6551 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6552 | } |
| 6553 | |
| 6554 | halstatus = halTxFrame( pMac, |
| 6555 | pPacket, |
| 6556 | (tANI_U16) nBytes, |
| 6557 | HAL_TXRX_FRM_802_11_MGMT, |
| 6558 | ANI_TXDIR_TODS, |
| 6559 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6560 | limTxComplete, |
| 6561 | pFrame, txFlag ); |
| 6562 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6563 | { |
| 6564 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6565 | nSirStatus = eSIR_FAILURE; |
| 6566 | //Pkt will be freed up by the callback |
| 6567 | return nSirStatus; |
| 6568 | } |
| 6569 | else { |
| 6570 | return eSIR_SUCCESS; |
| 6571 | } |
| 6572 | |
| 6573 | returnAfterError: |
| 6574 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6575 | return nSirStatus; |
| 6576 | } // End limSendSaQueryRequestFrame |
| 6577 | |
| 6578 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6579 | * \brief Send SA query response action frame to peer |
| 6580 | * |
| 6581 | * \sa limSendSaQueryResponseFrame |
| 6582 | * |
| 6583 | * |
| 6584 | * \param pMac The global tpAniSirGlobal object |
| 6585 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6586 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6587 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6588 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6589 | * |
| 6590 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6591 | * |
| 6592 | * \return eSIR_SUCCESS if setup completes successfully |
| 6593 | * eSIR_FAILURE is some problem is encountered |
| 6594 | */ |
| 6595 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6596 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6597 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6598 | { |
| 6599 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6600 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | tANI_U8 *pFrame; |
| 6602 | tSirRetStatus nSirStatus; |
| 6603 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6604 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | void *pPacket; |
| 6606 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6607 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6608 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6609 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6610 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6611 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6612 | action: 0 --> SA query request action frame |
| 6613 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6614 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6615 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6617 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6618 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6619 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6620 | if ( DOT11F_FAILED( nStatus ) ) |
| 6621 | { |
| 6622 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6623 | "or a SA Query Response (0x%08x)."), |
| 6624 | nStatus ); |
| 6625 | // We'll fall back on the worst case scenario: |
| 6626 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6627 | } |
| 6628 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6629 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6630 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6631 | "the packed size for an SA Query Response" |
| 6632 | " (0x%08x)."), nStatus ); |
| 6633 | } |
| 6634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6635 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6636 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6637 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6638 | { |
| 6639 | 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] | 6640 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | return eSIR_FAILURE; |
| 6642 | } |
| 6643 | |
| 6644 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6645 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6647 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6648 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6649 | pFrame, |
| 6650 | SIR_MAC_MGMT_FRAME, |
| 6651 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6652 | peer, psessionEntry->selfMacAddr ); |
| 6653 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6654 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6656 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6657 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6658 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6659 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6661 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6662 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6663 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6664 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6665 | // Pack 11w SA query response frame |
| 6666 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6667 | &frm, |
| 6668 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6669 | nPayload, |
| 6670 | &nPayload ); |
| 6671 | |
| 6672 | if ( DOT11F_FAILED( nStatus )) |
| 6673 | { |
| 6674 | limLog( pMac, LOGE, |
| 6675 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6676 | nStatus ); |
| 6677 | // FIXME - Need to convert to tSirRetStatus |
| 6678 | nSirStatus = eSIR_FAILURE; |
| 6679 | goto returnAfterError; |
| 6680 | } |
| 6681 | else if ( DOT11F_WARNED( nStatus )) |
| 6682 | { |
| 6683 | limLog( pMac, LOGW, |
| 6684 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6685 | nStatus); |
| 6686 | } |
| 6687 | |
| 6688 | limLog( pMac, LOG1, |
| 6689 | FL( "Sending a SA Query Response to " )); |
| 6690 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6691 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6692 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6693 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6694 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6695 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6696 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6697 | ) |
| 6698 | { |
| 6699 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6700 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6701 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6702 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6703 | psessionEntry->peSessionId, |
| 6704 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6705 | halstatus = halTxFrame( pMac, |
| 6706 | pPacket, |
| 6707 | (tANI_U16) nBytes, |
| 6708 | HAL_TXRX_FRM_802_11_MGMT, |
| 6709 | ANI_TXDIR_TODS, |
| 6710 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6711 | limTxComplete, |
| 6712 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6713 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6714 | psessionEntry->peSessionId, |
| 6715 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6716 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6717 | { |
| 6718 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6719 | nSirStatus = eSIR_FAILURE; |
| 6720 | //Pkt will be freed up by the callback |
| 6721 | return nSirStatus; |
| 6722 | } |
| 6723 | else { |
| 6724 | return eSIR_SUCCESS; |
| 6725 | } |
| 6726 | |
| 6727 | returnAfterError: |
| 6728 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6729 | return nSirStatus; |
| 6730 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6731 | #endif |