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