Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 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 |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 56 | #include "wniCfg.h" |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 57 | #endif |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 58 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 59 | #if defined WLAN_FEATURE_VOWIFI |
| 60 | #include "rrmApi.h" |
| 61 | #endif |
| 62 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 63 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 64 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 65 | #define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 66 | //////////////////////////////////////////////////////////////////////// |
| 67 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 68 | tSirRetStatus limStripOffExtCapIE(tpAniSirGlobal pMac, |
| 69 | tANI_U8 *addIE, |
| 70 | tANI_U16 *addnIELen, |
| 71 | tANI_U8 *pExtractedExtCapIEBuf ) |
| 72 | { |
| 73 | tANI_U8* tempbuf = NULL; |
| 74 | tANI_U16 tempLen = 0; |
| 75 | int left = *addnIELen; |
| 76 | tANI_U8 *ptr = addIE; |
| 77 | tANI_U8 elem_id, elem_len; |
| 78 | |
| 79 | if (NULL == addIE) |
| 80 | { |
| 81 | PELOGE(limLog(pMac, LOG1, FL("NULL addIE pointer"));) |
| 82 | return eSIR_IGNORE_IE ; |
| 83 | } |
| 84 | |
| 85 | tempbuf = vos_mem_malloc(left); |
| 86 | if ( NULL == tempbuf ) |
| 87 | { |
| 88 | PELOGE(limLog(pMac, LOGE, |
| 89 | FL("Unable to allocate memory to store addn IE"));) |
| 90 | return eSIR_MEM_ALLOC_FAILED; |
| 91 | } |
| 92 | |
| 93 | while(left >= 2) |
| 94 | { |
| 95 | elem_id = ptr[0]; |
| 96 | elem_len = ptr[1]; |
| 97 | left -= 2; |
| 98 | if (elem_len > left) |
| 99 | { |
| 100 | limLog( pMac, LOGE, |
| 101 | FL("Invalid IEs eid = %d elem_len=%d left=%d"), |
| 102 | elem_id,elem_len,left); |
| 103 | vos_mem_free(tempbuf); |
| 104 | return eSIR_FAILURE; |
| 105 | } |
| 106 | if ( !(DOT11F_EID_EXTCAP == elem_id) ) |
| 107 | { |
| 108 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
| 109 | tempLen += (elem_len + 2); |
| 110 | } |
| 111 | else |
| 112 | { /*Est Cap present size is 8 + 2 byte at present*/ |
| 113 | if ( NULL != pExtractedExtCapIEBuf ) |
| 114 | { |
| 115 | vos_mem_set(pExtractedExtCapIEBuf, |
| 116 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 117 | if (elem_len <= DOT11F_IE_EXTCAP_MAX_LEN ) |
| 118 | { |
| 119 | vos_mem_copy (pExtractedExtCapIEBuf, &ptr[0], |
| 120 | elem_len + 2); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | left -= elem_len; |
| 125 | ptr += (elem_len + 2); |
| 126 | } |
| 127 | vos_mem_copy (addIE, tempbuf, tempLen); |
| 128 | *addnIELen = tempLen; |
| 129 | vos_mem_free(tempbuf); |
| 130 | return eSIR_SUCCESS; |
| 131 | } |
| 132 | |
| 133 | void limUpdateExtCapIEtoStruct(tpAniSirGlobal pMac, |
| 134 | tANI_U8 *pBuf, |
| 135 | tDot11fIEExtCap *pDst) |
| 136 | { |
| 137 | tANI_U8 pOut[DOT11F_IE_EXTCAP_MAX_LEN]; |
| 138 | |
| 139 | if ( NULL == pBuf ) |
| 140 | { |
| 141 | limLog( pMac, LOGE, |
| 142 | FL("Invalid Buffer Address")); |
| 143 | return; |
| 144 | } |
| 145 | if(NULL == pDst) |
| 146 | { |
| 147 | PELOGE(limLog(pMac, LOGE, |
| 148 | FL("NULL pDst pointer"));) |
| 149 | return ; |
| 150 | } |
| 151 | |
| 152 | if ( DOT11F_EID_EXTCAP != pBuf[0] || |
| 153 | pBuf[1] > DOT11F_IE_EXTCAP_MAX_LEN ) |
| 154 | { |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 155 | limLog( pMac, LOG1, |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 156 | FL("Invalid IEs eid = %d elem_len=%d "), |
| 157 | pBuf[0],pBuf[1]); |
| 158 | return; |
| 159 | } |
| 160 | vos_mem_set(( tANI_U8* )&pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, 0); |
| 161 | /* conversion should follow 4, 2, 2 byte order */ |
| 162 | limUtilsframeshtonl(pMac, &pOut[0],*((tANI_U32*)&pBuf[2]),0); |
| 163 | limUtilsframeshtons(pMac, &pOut[4],*((tANI_U16*)&pBuf[6]),0); |
| 164 | limUtilsframeshtons(pMac, &pOut[6],*((tANI_U16*)&pBuf[8]),0); |
| 165 | |
| 166 | if ( DOT11F_PARSE_SUCCESS != dot11fUnpackIeExtCap( pMac, |
| 167 | &pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, pDst) ) |
| 168 | { |
| 169 | limLog( pMac, LOGE, |
| 170 | FL("dot11fUnpackIeExtCap Parse Error ")); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | tSirRetStatus limStripOffExtCapIEAndUpdateStruct(tpAniSirGlobal pMac, |
| 175 | tANI_U8* addIE, |
| 176 | tANI_U16 *addnIELen, |
| 177 | tDot11fIEExtCap * pDst ) |
| 178 | { |
| 179 | tANI_U8 pExtractedExtCapIEBuf[DOT11F_IE_EXTCAP_MAX_LEN + 2]; |
| 180 | tSirRetStatus nSirStatus; |
| 181 | |
| 182 | vos_mem_set(( tANI_U8* )&pExtractedExtCapIEBuf[0], |
| 183 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 184 | nSirStatus = limStripOffExtCapIE(pMac, addIE, addnIELen, |
| 185 | pExtractedExtCapIEBuf); |
| 186 | if ( eSIR_SUCCESS != nSirStatus ) |
| 187 | { |
| 188 | limLog( pMac, LOG1, FL("Failed to strip off in" |
| 189 | "limStripOffExtCapIE status = (%d)."), |
| 190 | nSirStatus ); |
| 191 | return nSirStatus; |
| 192 | } |
| 193 | /* update the extracted ExtCap to struct*/ |
| 194 | limUpdateExtCapIEtoStruct(pMac, pExtractedExtCapIEBuf, pDst); |
| 195 | return nSirStatus; |
| 196 | } |
| 197 | |
| 198 | void limMergeExtCapIEStruct(tDot11fIEExtCap *pDst, |
| 199 | tDot11fIEExtCap *pSrc) |
| 200 | { |
| 201 | tANI_U8 *tempDst = (tANI_U8 *)pDst; |
| 202 | tANI_U8 *tempSrc = (tANI_U8 *)pSrc; |
| 203 | tANI_U8 structlen = sizeof(tDot11fIEExtCap); |
| 204 | |
| 205 | while(tempDst && tempSrc && structlen--) |
| 206 | { |
| 207 | *tempDst |= *tempSrc; |
| 208 | tempDst++; |
| 209 | tempSrc++; |
| 210 | } |
| 211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 212 | |
| 213 | /** |
| 214 | * |
| 215 | * \brief This function is called by various LIM modules to prepare the |
| 216 | * 802.11 frame MAC header |
| 217 | * |
| 218 | * |
| 219 | * \param pMac Pointer to Global MAC structure |
| 220 | * |
| 221 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 222 | * |
| 223 | * \param type Type of the frame |
| 224 | * |
| 225 | * \param subType Subtype of the frame |
| 226 | * |
| 227 | * \return eHalStatus |
| 228 | * |
| 229 | * |
| 230 | * The pFrameBuf argument points to the beginning of the frame buffer to |
| 231 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 232 | * will be the MGMT frame payload The payload itself is populated by the |
| 233 | * caller API |
| 234 | * |
| 235 | * |
| 236 | */ |
| 237 | |
| 238 | tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac, |
| 239 | tANI_U8* pBD, |
| 240 | tANI_U8 type, |
| 241 | tANI_U8 subType, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 242 | tSirMacAddr peerAddr, tSirMacAddr selfMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 243 | { |
| 244 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 245 | tpSirMacMgmtHdr pMacHdr; |
| 246 | |
| 247 | /// Prepare MAC management header |
| 248 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 249 | |
| 250 | // Prepare FC |
| 251 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 252 | pMacHdr->fc.type = type; |
| 253 | pMacHdr->fc.subType = subType; |
| 254 | |
| 255 | // Prepare Address 1 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 256 | vos_mem_copy( (tANI_U8 *) pMacHdr->da, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | (tANI_U8 *) peerAddr, |
| 258 | sizeof( tSirMacAddr )); |
| 259 | |
| 260 | // Prepare Address 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 262 | |
| 263 | // Prepare Address 3 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 264 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | (tANI_U8 *) peerAddr, |
| 266 | sizeof( tSirMacAddr )); |
| 267 | return statusCode; |
| 268 | } /*** end limPopulateMacHeader() ***/ |
| 269 | |
| 270 | /** |
| 271 | * \brief limSendProbeReqMgmtFrame |
| 272 | * |
| 273 | * |
| 274 | * \param pMac Pointer to Global MAC structure |
| 275 | * |
| 276 | * \param pSsid SSID to be sent in Probe Request frame |
| 277 | * |
| 278 | * \param bssid BSSID to be sent in Probe Request frame |
| 279 | * |
| 280 | * \param nProbeDelay probe delay to be used before sending Probe Request |
| 281 | * frame |
| 282 | * |
| 283 | * \param nChannelNum Channel # on which the Probe Request is going out |
| 284 | * |
| 285 | * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame |
| 286 | * |
| 287 | * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame |
| 288 | * |
| 289 | * This function is called by various LIM modules to send Probe Request frame |
| 290 | * during active scan/learn phase. |
| 291 | * Probe request is sent out in the following scenarios: |
| 292 | * --heartbeat failure: session needed |
| 293 | * --join req: session needed |
| 294 | * --foreground scan: no session |
| 295 | * --background scan: no session |
| 296 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 297 | * |
| 298 | * |
| 299 | */ |
| 300 | tSirRetStatus |
| 301 | limSendProbeReqMgmtFrame(tpAniSirGlobal pMac, |
| 302 | tSirMacSSid *pSsid, |
| 303 | tSirMacAddr bssid, |
| 304 | tANI_U8 nChannelNum, |
| 305 | tSirMacAddr SelfMacAddr, |
| 306 | tANI_U32 dot11mode, |
| 307 | tANI_U32 nAdditionalIELen, |
| 308 | tANI_U8 *pAdditionalIE) |
| 309 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 310 | tDot11fProbeRequest pr; |
| 311 | tANI_U32 nStatus, nBytes, nPayload; |
| 312 | tSirRetStatus nSirStatus; |
| 313 | tANI_U8 *pFrame; |
| 314 | void *pPacket; |
| 315 | eHalStatus halstatus; |
| 316 | tpPESession psessionEntry; |
| 317 | tANI_U8 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | tANI_U8 *p2pIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 319 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | |
| 321 | #ifndef GEN4_SCAN |
| 322 | return eSIR_FAILURE; |
| 323 | #endif |
| 324 | |
| 325 | #if defined ( ANI_DVT_DEBUG ) |
| 326 | return eSIR_FAILURE; |
| 327 | #endif |
| 328 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame] | 329 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 330 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 331 | * is false and dot11mode is 11ac set it to 11n. |
| 332 | */ |
| 333 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 334 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 335 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 336 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 337 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | /* |
| 339 | * session context may or may not be present, when probe request needs to be sent out. |
| 340 | * following cases exist: |
| 341 | * --heartbeat failure: session needed |
| 342 | * --join req: session needed |
| 343 | * --foreground scan: no session |
| 344 | * --background scan: no session |
| 345 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 346 | * If session context does not exist, some IEs will be populated from CFGs, |
| 347 | * e.g. Supported and Extended rate set IEs |
| 348 | */ |
| 349 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 350 | |
| 351 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 352 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 353 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 354 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | |
| 356 | // & delegating to assorted helpers: |
| 357 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | if( nAdditionalIELen && pAdditionalIE ) |
| 360 | { |
| 361 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 362 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 363 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 364 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 365 | ( p2pIe != NULL ) && |
| 366 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 367 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 368 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 369 | ( ( psessionEntry != NULL ) && |
| 370 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 371 | ) |
| 372 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 373 | { |
| 374 | /* In the below API pass channel number > 14, do that it fills only |
| 375 | * 11a rates in supported rates */ |
| 376 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 377 | } |
| 378 | else |
| 379 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 381 | &pr.SuppRates,psessionEntry); |
| 382 | |
| 383 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 384 | { |
| 385 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 386 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | |
| 389 | #if defined WLAN_FEATURE_VOWIFI |
| 390 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 391 | //DS params "can" be present in RRM is disabled and "is" present if |
| 392 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 393 | //RRM is not enabled. |
| 394 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 395 | //Call RRM module to get the tx power for management used. |
| 396 | { |
| 397 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 398 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 399 | } |
| 400 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | |
| 402 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 403 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 405 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 407 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 408 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 409 | } else { //psessionEntry == NULL |
| 410 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 411 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 412 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | } |
| 414 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 415 | |
Hardik Kantilal Patel | bca5b00 | 2015-01-19 15:30:18 +0530 | [diff] [blame] | 416 | if((nChannelNum <= SIR_11B_CHANNEL_END) |
| 417 | && (!IS_HT40_OBSS_SCAN_FEATURE_ENABLE) |
| 418 | && (!pMac->roam.configParam.channelBondingMode24GHz)) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 419 | { |
| 420 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 421 | pr.HTCaps.shortGI40MHz = 0; |
| 422 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 423 | #ifdef WLAN_FEATURE_11AC |
| 424 | if (psessionEntry != NULL ) { |
| 425 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 426 | //Include HT Capability IE |
| 427 | if (psessionEntry->vhtCapability) |
| 428 | { |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 429 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, |
| 430 | psessionEntry->currentOperChannel , 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 | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 435 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, nChannelNum, 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 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 528 | if( ( psessionEntry != NULL ) && ( psessionEntry->is11Gonly == true ) && |
| 529 | ( !IS_BROADCAST_MAC(bssid) ) ){ |
| 530 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 531 | } |
| 532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 534 | HAL_TXRX_FRM_802_11_MGMT, |
| 535 | ANI_TXDIR_TODS, |
| 536 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 537 | limTxComplete, pFrame, txFlag ); |
| 538 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 539 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 540 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 541 | //Pkt will be freed up by the callback |
| 542 | return eSIR_FAILURE; |
| 543 | } |
| 544 | |
| 545 | return eSIR_SUCCESS; |
| 546 | } // End limSendProbeReqMgmtFrame. |
| 547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 549 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 550 | tANI_U8 probeReqP2pIe) |
| 551 | { |
| 552 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 553 | from additional IE */ |
| 554 | if(!probeReqP2pIe) |
| 555 | { |
| 556 | tANI_U8* tempbuf = NULL; |
| 557 | tANI_U16 tempLen = 0; |
| 558 | int left = *addnIELen; |
| 559 | v_U8_t *ptr = addIE; |
| 560 | v_U8_t elem_id, elem_len; |
| 561 | |
| 562 | if(NULL == addIE) |
| 563 | { |
| 564 | PELOGE(limLog(pMac, LOGE, |
| 565 | FL(" NULL addIE pointer"));) |
| 566 | return eSIR_FAILURE; |
| 567 | } |
| 568 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 569 | tempbuf = vos_mem_malloc(left); |
| 570 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 571 | { |
| 572 | PELOGE(limLog(pMac, LOGE, |
| 573 | FL("Unable to allocate memory to store addn IE"));) |
| 574 | return eSIR_MEM_ALLOC_FAILED; |
| 575 | } |
| 576 | |
| 577 | while(left >= 2) |
| 578 | { |
| 579 | elem_id = ptr[0]; |
| 580 | elem_len = ptr[1]; |
| 581 | left -= 2; |
| 582 | if(elem_len > left) |
| 583 | { |
| 584 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 585 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 586 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 587 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 588 | return eSIR_FAILURE; |
| 589 | } |
| 590 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 591 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 592 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 593 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 594 | tempLen += (elem_len + 2); |
| 595 | } |
| 596 | left -= elem_len; |
| 597 | ptr += (elem_len + 2); |
| 598 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 599 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 601 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | } |
| 603 | return eSIR_SUCCESS; |
| 604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 605 | |
| 606 | void |
| 607 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 608 | tSirMacAddr peerMacAddr, |
| 609 | tpAniSSID pSsid, |
| 610 | short nStaId, |
| 611 | tANI_U8 nKeepAlive, |
| 612 | tpPESession psessionEntry, |
| 613 | tANI_U8 probeReqP2pIe) |
| 614 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 615 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 616 | tSirRetStatus nSirStatus; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 617 | tANI_U32 cfg, nPayload, nStatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 618 | tpSirMacMgmtHdr pMacHdr; |
| 619 | tANI_U8 *pFrame; |
| 620 | void *pPacket; |
| 621 | eHalStatus halstatus; |
| 622 | tANI_U32 addnIEPresent; |
| 623 | tANI_U32 addnIE1Len=0; |
| 624 | tANI_U32 addnIE2Len=0; |
| 625 | tANI_U32 addnIE3Len=0; |
| 626 | tANI_U16 totalAddnIeLen = 0; |
| 627 | tANI_U32 wpsApEnable=0, tmp; |
| 628 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 629 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 630 | tANI_U8 *pP2pIe = NULL; |
| 631 | tANI_U8 noaLen = 0; |
| 632 | tANI_U8 total_noaLen = 0; |
| 633 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 634 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 635 | 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] | 636 | tDot11fIEExtCap extractedExtCap; |
| 637 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 638 | tANI_U32 nBytes = 0; |
| 639 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 640 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 641 | { |
| 642 | return; // in this case. |
| 643 | } |
| 644 | |
| 645 | if(NULL == psessionEntry) |
| 646 | { |
| 647 | return; |
| 648 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 649 | |
| 650 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 651 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 652 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 653 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 654 | return; |
| 655 | } |
| 656 | |
Girish Gowli | 0e82679 | 2014-05-17 17:56:44 +0530 | [diff] [blame] | 657 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | // Fill out 'frm', after which we'll just hand the struct off to |
| 660 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 661 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 662 | |
| 663 | // Timestamp to be updated by TFP, below. |
| 664 | |
| 665 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 666 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 667 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 668 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 669 | } |
| 670 | else |
| 671 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 672 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 673 | if (eSIR_SUCCESS != nSirStatus) |
| 674 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 675 | 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] | 676 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 677 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 678 | return; |
| 679 | } |
| 680 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 681 | } |
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 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 684 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 685 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 686 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 688 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 689 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 693 | { |
| 694 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 695 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 696 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 697 | } |
| 698 | } |
| 699 | else |
| 700 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 701 | 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] | 702 | 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] | 703 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 704 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 705 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 706 | if (wpsApEnable) |
| 707 | { |
| 708 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 709 | } |
| 710 | |
| 711 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 712 | { |
| 713 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 714 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 715 | } |
| 716 | |
| 717 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 718 | { |
| 719 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 720 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 724 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 725 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 726 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 727 | |
| 728 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 729 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 730 | |
| 731 | |
| 732 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 733 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 734 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 735 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 736 | |
| 737 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 738 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 739 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 740 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 741 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 742 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 743 | |
| 744 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 745 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 746 | * when operating in HT40 in 2.4GHz. |
| 747 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 748 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 749 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 750 | { |
| 751 | PopulateDot11fOBSSScanParameters( pMac, &pFrm->OBSSScanParameters, |
| 752 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 753 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 754 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 755 | * Mode in 40 MHz bit in HT capablity. |
| 756 | */ |
| 757 | pFrm->HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 758 | } |
| 759 | #endif |
| 760 | |
| 761 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
| 762 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 763 | #ifdef WLAN_FEATURE_11AC |
| 764 | if(psessionEntry->vhtCapability) |
| 765 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 766 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 767 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, |
| 768 | psessionEntry->currentOperChannel, eSIR_TRUE ); |
| 769 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation , |
| 770 | psessionEntry->currentOperChannel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 771 | // we do not support multi users yet |
| 772 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
| 773 | } |
| 774 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 775 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 776 | |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 777 | if ( psessionEntry->pLimStartBssReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 778 | { |
| 779 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 780 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 781 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 782 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 783 | } |
| 784 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 785 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 786 | |
| 787 | #if defined(FEATURE_WLAN_WAPI) |
| 788 | if( psessionEntry->pLimStartBssReq ) |
| 789 | { |
| 790 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 791 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | #endif // defined(FEATURE_WLAN_WAPI) |
| 795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 796 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 798 | { |
| 799 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 800 | } |
| 801 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 802 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 803 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | { |
| 805 | |
| 806 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 807 | &addnIEPresent) != eSIR_SUCCESS) |
| 808 | { |
| 809 | 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] | 810 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | return; |
| 812 | } |
| 813 | } |
| 814 | |
| 815 | if (addnIEPresent) |
| 816 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 817 | |
| 818 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 819 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | { |
| 821 | PELOGE(limLog(pMac, LOGE, |
| 822 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 823 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 824 | return; |
| 825 | } |
| 826 | |
| 827 | //Probe rsp IE available |
| 828 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 829 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 830 | { |
| 831 | 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] | 832 | vos_mem_free(addIE); |
| 833 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | return; |
| 835 | } |
| 836 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 837 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 838 | { |
| 839 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 840 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 841 | &addnIE1Len) ) |
| 842 | { |
| 843 | limLog(pMac, LOGP, |
| 844 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 845 | vos_mem_free(addIE); |
| 846 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 847 | return; |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | //Probe rsp IE available |
| 852 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 853 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 854 | { |
| 855 | 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] | 856 | vos_mem_free(addIE); |
| 857 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 858 | return; |
| 859 | } |
| 860 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 861 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 862 | { |
| 863 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 864 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 865 | &addnIE2Len) ) |
| 866 | { |
| 867 | limLog(pMac, LOGP, |
| 868 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 869 | vos_mem_free(addIE); |
| 870 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 871 | return; |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | //Probe rsp IE available |
| 876 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 877 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 878 | { |
| 879 | 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] | 880 | vos_mem_free(addIE); |
| 881 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 882 | return; |
| 883 | } |
| 884 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 885 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 886 | { |
| 887 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 888 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 889 | &addIE[addnIE1Len + addnIE2Len], |
| 890 | &addnIE3Len) ) |
| 891 | { |
| 892 | limLog(pMac, LOGP, |
| 893 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 894 | vos_mem_free(addIE); |
| 895 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 896 | return; |
| 897 | } |
| 898 | } |
| 899 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 902 | { |
| 903 | limLog(pMac, LOGP, |
| 904 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 905 | vos_mem_free(addIE); |
| 906 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | return; |
| 908 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 909 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 910 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 911 | addIE, |
| 912 | &totalAddnIeLen, |
| 913 | &extractedExtCap ); |
| 914 | if(eSIR_SUCCESS != nSirStatus ) |
| 915 | { |
| 916 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 917 | limLog(pMac, LOG1, |
| 918 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 919 | } |
| 920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 921 | nBytes = nBytes + totalAddnIeLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 922 | limLog(pMac, LOG1, |
| 923 | FL("probe rsp packet size is %d "), nBytes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 924 | if (probeReqP2pIe) |
| 925 | { |
| 926 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 927 | if (pP2pIe != NULL) |
| 928 | { |
| 929 | //get NoA attribute stream P2P IE |
| 930 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 931 | if (noaLen != 0) |
| 932 | { |
| 933 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 934 | &noaStream[0], noaLen); |
| 935 | nBytes = nBytes + total_noaLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 936 | limLog(pMac, LOG1, |
| 937 | FL("p2p probe rsp packet size is %d, noalength is %d"), |
| 938 | nBytes, total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 939 | } |
| 940 | } |
| 941 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 942 | } |
| 943 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 944 | /*merge ExtCap IE*/ |
| 945 | if (extractedExtCapFlag && extractedExtCap.present) |
| 946 | { |
| 947 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 948 | } |
| 949 | |
| 950 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 951 | if ( DOT11F_FAILED( nStatus ) ) |
| 952 | { |
| 953 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 954 | "or a Probe Response (0x%08x)."), |
| 955 | nStatus ); |
| 956 | // We'll fall back on the worst case scenario: |
| 957 | nPayload = sizeof( tDot11fProbeResponse ); |
| 958 | } |
| 959 | else if ( DOT11F_WARNED( nStatus ) ) |
| 960 | { |
| 961 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 962 | "the packed size for a Probe Response " |
| 963 | "(0x%08x)."), nStatus ); |
| 964 | } |
| 965 | |
| 966 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 968 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 969 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 970 | ( void** ) &pPacket ); |
| 971 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 972 | { |
| 973 | 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] | 974 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | if ( addIE != NULL ) |
| 976 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 977 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 979 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | return; |
| 981 | } |
| 982 | |
| 983 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 984 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | |
| 986 | // Next, we fill out the buffer descriptor: |
| 987 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 988 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 989 | if ( eSIR_SUCCESS != nSirStatus ) |
| 990 | { |
| 991 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 992 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 993 | nSirStatus ); |
| 994 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 995 | ( void* ) pFrame, ( void* ) pPacket ); |
| 996 | if ( addIE != NULL ) |
| 997 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 998 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 999 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1000 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1001 | return; |
| 1002 | } |
| 1003 | |
| 1004 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1005 | |
| 1006 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1007 | |
| 1008 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1009 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | nPayload, &nPayload ); |
| 1011 | if ( DOT11F_FAILED( nStatus ) ) |
| 1012 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1013 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1014 | nStatus ); |
| 1015 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1016 | if ( addIE != NULL ) |
| 1017 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1018 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1019 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1020 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1021 | return; // allocated! |
| 1022 | } |
| 1023 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1024 | { |
| 1025 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1026 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1027 | } |
| 1028 | |
| 1029 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1030 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1031 | |
| 1032 | pMac->sys.probeRespond++; |
| 1033 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1035 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1036 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1037 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | |
| 1040 | if ( addnIEPresent ) |
| 1041 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1042 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1043 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | if (noaLen != 0) |
| 1045 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1046 | 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] | 1047 | { |
| 1048 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1049 | FL("Not able to insert NoA because of length constraint." |
| 1050 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1051 | vos_mem_free(addIE); |
| 1052 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1053 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1054 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1055 | return; |
| 1056 | } |
| 1057 | else |
| 1058 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1059 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1060 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1061 | } |
| 1062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | |
| 1064 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1066 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1067 | ) |
| 1068 | { |
| 1069 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1070 | } |
| 1071 | |
| 1072 | // Queue Probe Response frame in high priority WQ |
| 1073 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1074 | ( tANI_U16 ) nBytes, |
| 1075 | HAL_TXRX_FRM_802_11_MGMT, |
| 1076 | ANI_TXDIR_TODS, |
| 1077 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1078 | limTxComplete, pFrame, txFlag ); |
| 1079 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1080 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1081 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1082 | //Pkt will be freed up by the callback |
| 1083 | } |
| 1084 | |
| 1085 | if ( addIE != NULL ) |
| 1086 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1087 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | } |
| 1089 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1090 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1091 | return; |
| 1092 | |
| 1093 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1094 | } // End limSendProbeRspMgmtFrame. |
| 1095 | |
| 1096 | void |
| 1097 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1098 | tSirMacAddr peerMacAddr, |
| 1099 | tSirAddtsReqInfo *pAddTS, |
| 1100 | tpPESession psessionEntry) |
| 1101 | { |
| 1102 | tANI_U16 i; |
| 1103 | tANI_U8 *pFrame; |
| 1104 | tSirRetStatus nSirStatus; |
| 1105 | tDot11fAddTSRequest AddTSReq; |
| 1106 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1107 | tANI_U32 nPayload, nBytes, nStatus; |
| 1108 | tpSirMacMgmtHdr pMacHdr; |
| 1109 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1110 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1111 | tANI_U32 phyMode; |
| 1112 | #endif |
| 1113 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1114 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1115 | |
| 1116 | if(NULL == psessionEntry) |
| 1117 | { |
| 1118 | return; |
| 1119 | } |
| 1120 | |
| 1121 | if ( ! pAddTS->wmeTspecPresent ) |
| 1122 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1123 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1124 | |
| 1125 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1126 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1127 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1128 | if ( pAddTS->lleTspecPresent ) |
| 1129 | { |
| 1130 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1131 | } |
| 1132 | else |
| 1133 | { |
| 1134 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1135 | } |
| 1136 | |
| 1137 | if ( pAddTS->lleTspecPresent ) |
| 1138 | { |
| 1139 | AddTSReq.num_WMMTCLAS = 0; |
| 1140 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1141 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1142 | { |
| 1143 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1144 | &AddTSReq.TCLAS[i] ); |
| 1145 | } |
| 1146 | } |
| 1147 | else |
| 1148 | { |
| 1149 | AddTSReq.num_TCLAS = 0; |
| 1150 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1151 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1152 | { |
| 1153 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1154 | &AddTSReq.WMMTCLAS[i] ); |
| 1155 | } |
| 1156 | } |
| 1157 | |
| 1158 | if ( pAddTS->tclasProcPresent ) |
| 1159 | { |
| 1160 | if ( pAddTS->lleTspecPresent ) |
| 1161 | { |
| 1162 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1163 | AddTSReq.TCLASSPROC.present = 1; |
| 1164 | } |
| 1165 | else |
| 1166 | { |
| 1167 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1168 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1169 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1170 | } |
| 1171 | } |
| 1172 | |
| 1173 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1174 | if ( DOT11F_FAILED( nStatus ) ) |
| 1175 | { |
| 1176 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1177 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1178 | nStatus ); |
| 1179 | // We'll fall back on the worst case scenario: |
| 1180 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1181 | } |
| 1182 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1183 | { |
| 1184 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1185 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1186 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1187 | } |
| 1188 | } |
| 1189 | else |
| 1190 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1191 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1192 | |
| 1193 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1194 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1195 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1196 | |
| 1197 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1198 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1199 | |
| 1200 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1201 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1202 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1203 | |
| 1204 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1205 | { |
| 1206 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1207 | } |
| 1208 | else |
| 1209 | { |
| 1210 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1211 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1212 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1213 | #endif |
| 1214 | // fillWmeTspecIE |
| 1215 | |
| 1216 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1217 | if ( DOT11F_FAILED( nStatus ) ) |
| 1218 | { |
| 1219 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1220 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1221 | nStatus ); |
| 1222 | // We'll fall back on the worst case scenario: |
| 1223 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1224 | } |
| 1225 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1226 | { |
| 1227 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1228 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1229 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1230 | } |
| 1231 | } |
| 1232 | |
| 1233 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1234 | |
| 1235 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1236 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1237 | ( void** ) &pPacket ); |
| 1238 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1239 | { |
| 1240 | 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] | 1241 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1242 | return; |
| 1243 | } |
| 1244 | |
| 1245 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1246 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1247 | |
| 1248 | // Next, we fill out the buffer descriptor: |
| 1249 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1250 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1251 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1252 | { |
| 1253 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1254 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1255 | nSirStatus ); |
| 1256 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1257 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1258 | return; |
| 1259 | } |
| 1260 | |
| 1261 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1262 | |
| 1263 | #if 0 |
| 1264 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1265 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1266 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1267 | { |
| 1268 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1269 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1270 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1271 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1272 | return; |
| 1273 | } |
| 1274 | #endif //TO SUPPORT BT-AMP |
| 1275 | |
| 1276 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1277 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1278 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1279 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1280 | #endif |
| 1281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | // That done, pack the struct: |
| 1283 | if ( ! pAddTS->wmeTspecPresent ) |
| 1284 | { |
| 1285 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1286 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1287 | nPayload, &nPayload ); |
| 1288 | if ( DOT11F_FAILED( nStatus ) ) |
| 1289 | { |
| 1290 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1291 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1292 | nStatus ); |
| 1293 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1294 | return; // allocated! |
| 1295 | } |
| 1296 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1297 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1298 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1299 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | } |
| 1301 | } |
| 1302 | else |
| 1303 | { |
| 1304 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1305 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1306 | nPayload, &nPayload ); |
| 1307 | if ( DOT11F_FAILED( nStatus ) ) |
| 1308 | { |
| 1309 | 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] | 1310 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | nStatus ); |
| 1312 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1313 | return; // allocated! |
| 1314 | } |
| 1315 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1316 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1317 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1318 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | } |
| 1320 | } |
| 1321 | |
Abhishek Singh | 127a844 | 2014-12-15 17:31:27 +0530 | [diff] [blame] | 1322 | limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") ); |
| 1323 | limPrintMacAddr( pMac, peerMacAddr, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | |
| 1325 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1326 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1327 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | ) |
| 1329 | { |
| 1330 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1331 | } |
| 1332 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1333 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1334 | psessionEntry->peSessionId, |
| 1335 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1336 | // Queue Addts Response frame in high priority WQ |
| 1337 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1338 | HAL_TXRX_FRM_802_11_MGMT, |
| 1339 | ANI_TXDIR_TODS, |
| 1340 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1341 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1342 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1343 | psessionEntry->peSessionId, |
| 1344 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1345 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1346 | { |
| 1347 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1348 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1349 | //Pkt will be freed up by the callback |
| 1350 | } |
| 1351 | |
| 1352 | } // End limSendAddtsReqActionFrame. |
| 1353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1354 | |
| 1355 | |
| 1356 | void |
| 1357 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1358 | tANI_U16 statusCode, |
| 1359 | tANI_U16 aid, |
| 1360 | tSirMacAddr peerMacAddr, |
| 1361 | tANI_U8 subType, |
| 1362 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1363 | { |
| 1364 | static tDot11fAssocResponse frm; |
| 1365 | tANI_U8 *pFrame, *macAddr; |
| 1366 | tpSirMacMgmtHdr pMacHdr; |
| 1367 | tSirRetStatus nSirStatus; |
| 1368 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1369 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1370 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1371 | void *pPacket; |
| 1372 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1373 | tUpdateBeaconParams beaconParams; |
| 1374 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1375 | tANI_U32 addnIEPresent = false; |
| 1376 | tANI_U32 addnIELen=0; |
| 1377 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1378 | tpSirAssocReq pAssocReq = NULL; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1379 | tANI_U16 addStripoffIELen = 0; |
| 1380 | tDot11fIEExtCap extractedExtCap; |
| 1381 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1382 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1383 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1384 | #ifdef WLAN_FEATURE_11W |
| 1385 | tANI_U32 retryInterval; |
| 1386 | tANI_U32 maxRetries; |
| 1387 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1388 | |
| 1389 | if(NULL == psessionEntry) |
| 1390 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1391 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1392 | return; |
| 1393 | } |
| 1394 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1395 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | |
| 1397 | limGetQosMode(psessionEntry, &qosMode); |
| 1398 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1399 | |
| 1400 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1401 | // STA sent a traffic spec. |
| 1402 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1403 | |
| 1404 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1405 | |
| 1406 | frm.Status.status = statusCode; |
| 1407 | |
| 1408 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1409 | |
| 1410 | if ( NULL == pSta ) |
| 1411 | { |
| 1412 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1413 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1414 | } |
| 1415 | else |
| 1416 | { |
| 1417 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1418 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1419 | } |
| 1420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1421 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1422 | { |
| 1423 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1424 | { |
| 1425 | pAssocReq = |
| 1426 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1427 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1428 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1429 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1431 | } |
| 1432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1433 | |
| 1434 | if ( NULL != pSta ) |
| 1435 | { |
| 1436 | if ( eHAL_SET == qosMode ) |
| 1437 | { |
| 1438 | if ( pSta->lleEnabled ) |
| 1439 | { |
| 1440 | lleMode = 1; |
| 1441 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1442 | { |
| 1443 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1444 | |
| 1445 | // FramesToDo:... |
| 1446 | // if ( fAddTS ) |
| 1447 | // { |
| 1448 | // tANI_U8 *pAf = pBody; |
| 1449 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1450 | // tANI_U32 tlen; |
| 1451 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1452 | // &tlen, bufLen - frameLen); |
| 1453 | // } // End if on Add TS. |
| 1454 | } |
| 1455 | } // End if on .11e enabled in 'pSta'. |
| 1456 | } // End if on QOS Mode on. |
| 1457 | |
| 1458 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1459 | { |
| 1460 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1461 | { |
| 1462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1463 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1464 | |
| 1465 | if ( pSta->wsmEnabled ) |
| 1466 | { |
| 1467 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1468 | } |
| 1469 | } |
| 1470 | } |
| 1471 | |
| 1472 | if ( pSta->aniPeer ) |
| 1473 | { |
| 1474 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1475 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1476 | { |
| 1477 | edcaInclude = 1; |
| 1478 | } |
| 1479 | |
| 1480 | } // End if on Airgo peer. |
| 1481 | |
| 1482 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1483 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1484 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1485 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Sachin Ahuja | c3a2623 | 2014-09-23 22:27:30 +0530 | [diff] [blame] | 1486 | /* |
| 1487 | *Check the STA capability and update the HTCaps accordingly |
| 1488 | */ |
| 1489 | frm.HTCaps.supportedChannelWidthSet = |
| 1490 | (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ? |
| 1491 | pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ; |
| 1492 | |
| 1493 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1494 | frm.HTCaps.shortGI40MHz = 0; |
| 1495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1497 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1498 | |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1499 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1500 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 1501 | * when operating in HT40 in 2.4GHz. |
| 1502 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 1503 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 1504 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1505 | { |
| 1506 | PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters, |
| 1507 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 1508 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 1509 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 1510 | * Mode in 40 MHz bit in HT capablity. |
| 1511 | */ |
| 1512 | frm.HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1513 | } |
| 1514 | #endif |
| 1515 | |
| 1516 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1517 | #ifdef WLAN_FEATURE_11AC |
| 1518 | if( pSta->mlmStaContext.vhtCapability && |
| 1519 | psessionEntry->vhtCapability ) |
| 1520 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1521 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 1522 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 1523 | psessionEntry->currentOperChannel, eSIR_TRUE ); |
| 1524 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation, |
| 1525 | psessionEntry->currentOperChannel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1526 | } |
| 1527 | #endif |
| 1528 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1529 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1530 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1531 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1532 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1533 | &maxRetries ) != eSIR_SUCCESS ) |
| 1534 | limLog( pMac, LOGE, |
| 1535 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1536 | else |
| 1537 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1538 | &retryInterval ) != eSIR_SUCCESS) |
| 1539 | limLog( pMac, LOGE, |
| 1540 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1541 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1542 | PopulateDot11fTimeoutInterval( |
| 1543 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1544 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1545 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1546 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1547 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1548 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1549 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1551 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1552 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1553 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1555 | |
| 1556 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1557 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1558 | |
| 1559 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1560 | |
| 1561 | //Send message to HAL about beacon parameter change. |
| 1562 | if(beaconParams.paramChangeBitmap) |
| 1563 | { |
| 1564 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1565 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1566 | } |
| 1567 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | if ( pAssocReq != NULL ) |
| 1569 | { |
| 1570 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1571 | &addnIEPresent) != eSIR_SUCCESS) |
| 1572 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1573 | limLog(pMac, LOGP, FL("Unable to get " |
| 1574 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1575 | return; |
| 1576 | } |
| 1577 | |
| 1578 | if (addnIEPresent) |
| 1579 | { |
| 1580 | //Assoc rsp IE available |
| 1581 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1582 | &addnIELen) != eSIR_SUCCESS) |
| 1583 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1584 | limLog(pMac, LOGP, FL("Unable to get " |
| 1585 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1586 | return; |
| 1587 | } |
| 1588 | |
| 1589 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1590 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1591 | { |
| 1592 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1593 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1594 | { |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1595 | |
| 1596 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1597 | sizeof( tDot11fIEExtCap ), 0); |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 1598 | addStripoffIELen = addnIELen; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1599 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1600 | &addIE[0], |
| 1601 | &addStripoffIELen, |
| 1602 | &extractedExtCap ); |
| 1603 | if(eSIR_SUCCESS != nSirStatus) |
| 1604 | { |
| 1605 | limLog(pMac, LOG1, |
| 1606 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1607 | } |
| 1608 | else |
| 1609 | { |
| 1610 | addnIELen = addStripoffIELen; |
| 1611 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1612 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1613 | nBytes = nBytes + addnIELen; |
| 1614 | } |
| 1615 | } |
| 1616 | } |
| 1617 | } |
| 1618 | |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1619 | /* merge the ExtCap struct*/ |
| 1620 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1621 | { |
| 1622 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap); |
| 1623 | } |
| 1624 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1625 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1626 | if ( DOT11F_FAILED( nStatus ) ) |
| 1627 | { |
| 1628 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1629 | "or an Association Response (0x%08x)."), |
| 1630 | nStatus ); |
| 1631 | return; |
| 1632 | } |
| 1633 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1634 | { |
| 1635 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1636 | "the packed size for an Association Re" |
| 1637 | "sponse (0x%08x)."), nStatus ); |
| 1638 | } |
| 1639 | |
| 1640 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1641 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1642 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1643 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1644 | ( void** ) &pPacket ); |
| 1645 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1646 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1647 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1648 | return; |
| 1649 | } |
| 1650 | |
| 1651 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1652 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1653 | |
| 1654 | // Next, we fill out the buffer descriptor: |
| 1655 | nSirStatus = limPopulateMacHeader( pMac, |
| 1656 | pFrame, |
| 1657 | SIR_MAC_MGMT_FRAME, |
| 1658 | ( LIM_ASSOC == subType ) ? |
| 1659 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1660 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1661 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1662 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1663 | { |
| 1664 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1665 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1666 | nSirStatus ); |
| 1667 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1668 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1669 | return; |
| 1670 | } |
| 1671 | |
| 1672 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1673 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1674 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1675 | |
| 1676 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1677 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1678 | nPayload, &nPayload ); |
| 1679 | if ( DOT11F_FAILED( nStatus ) ) |
| 1680 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1681 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1682 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1683 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1684 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1685 | return; // allocated! |
| 1686 | } |
| 1687 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1688 | { |
| 1689 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1690 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1691 | } |
| 1692 | |
| 1693 | macAddr = pMacHdr->da; |
| 1694 | |
| 1695 | if (subType == LIM_ASSOC) |
| 1696 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1697 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | FL("*** Sending Assoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1699 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | } |
| 1701 | else{ |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1702 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1703 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1704 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1705 | } |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1706 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1707 | |
| 1708 | if ( addnIEPresent ) |
| 1709 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1710 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1711 | } |
| 1712 | |
| 1713 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1714 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1715 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1716 | ) |
| 1717 | { |
| 1718 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1719 | } |
| 1720 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1721 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1722 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1723 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1724 | |
| 1725 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1726 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1727 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1728 | psessionEntry->peSessionId, |
| 1729 | pMacHdr->fc.subType)); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1730 | |
| 1731 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 1732 | { |
| 1733 | limLog(pMac, LOG1, FL("Re/AssocRsp - txBdToken %u"), pMac->lim.txBdToken); |
| 1734 | /// Queue Association Response frame in high priority WQ |
| 1735 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1736 | HAL_TXRX_FRM_802_11_MGMT, |
| 1737 | ANI_TXDIR_TODS, |
| 1738 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1739 | limTxComplete, pFrame, limTxBdComplete, |
| 1740 | txFlag, pMac->lim.txBdToken ); |
| 1741 | pMac->lim.txBdToken++; |
| 1742 | } |
| 1743 | else |
| 1744 | { |
| 1745 | /// Queue Association Response frame in high priority WQ |
| 1746 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1747 | HAL_TXRX_FRM_802_11_MGMT, |
| 1748 | ANI_TXDIR_TODS, |
| 1749 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1750 | limTxComplete, pFrame, txFlag ); |
| 1751 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1752 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1753 | psessionEntry->peSessionId, |
| 1754 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1755 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1756 | { |
| 1757 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1758 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1759 | nSirStatus); |
| 1760 | |
| 1761 | //Pkt will be freed up by the callback |
| 1762 | } |
| 1763 | |
| 1764 | // update the ANI peer station count |
| 1765 | //FIXME_PROTECTION : take care of different type of station |
| 1766 | // counter inside this function. |
| 1767 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1768 | |
| 1769 | } // End limSendAssocRspMgmtFrame. |
| 1770 | |
| 1771 | |
| 1772 | |
| 1773 | void |
| 1774 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1775 | tSirMacAddr peer, |
| 1776 | tANI_U16 nStatusCode, |
| 1777 | tSirAddtsReqInfo *pAddTS, |
| 1778 | tSirMacScheduleIE *pSchedule, |
| 1779 | tpPESession psessionEntry) |
| 1780 | { |
| 1781 | tANI_U8 *pFrame; |
| 1782 | tpSirMacMgmtHdr pMacHdr; |
| 1783 | tDot11fAddTSResponse AddTSRsp; |
| 1784 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1785 | tSirRetStatus nSirStatus; |
| 1786 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1787 | void *pPacket; |
| 1788 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1789 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1790 | |
| 1791 | if(NULL == psessionEntry) |
| 1792 | { |
| 1793 | return; |
| 1794 | } |
| 1795 | |
| 1796 | if ( ! pAddTS->wmeTspecPresent ) |
| 1797 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1798 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1799 | |
| 1800 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1801 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1802 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1803 | AddTSRsp.Status.status = nStatusCode; |
| 1804 | |
| 1805 | // The TsDelay information element is only filled in for a specific |
| 1806 | // status code: |
| 1807 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1808 | { |
| 1809 | if ( pAddTS->wsmTspecPresent ) |
| 1810 | { |
| 1811 | AddTSRsp.WMMTSDelay.version = 1; |
| 1812 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1813 | AddTSRsp.WMMTSDelay.present = 1; |
| 1814 | } |
| 1815 | else |
| 1816 | { |
| 1817 | AddTSRsp.TSDelay.delay = 10; |
| 1818 | AddTSRsp.TSDelay.present = 1; |
| 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | if ( pAddTS->wsmTspecPresent ) |
| 1823 | { |
| 1824 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1825 | } |
| 1826 | else |
| 1827 | { |
| 1828 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1829 | } |
| 1830 | |
| 1831 | if ( pAddTS->wsmTspecPresent ) |
| 1832 | { |
| 1833 | AddTSRsp.num_WMMTCLAS = 0; |
| 1834 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1835 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1836 | { |
| 1837 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1838 | &AddTSRsp.TCLAS[i] ); |
| 1839 | } |
| 1840 | } |
| 1841 | else |
| 1842 | { |
| 1843 | AddTSRsp.num_TCLAS = 0; |
| 1844 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1845 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1846 | { |
| 1847 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1848 | &AddTSRsp.WMMTCLAS[i] ); |
| 1849 | } |
| 1850 | } |
| 1851 | |
| 1852 | if ( pAddTS->tclasProcPresent ) |
| 1853 | { |
| 1854 | if ( pAddTS->wsmTspecPresent ) |
| 1855 | { |
| 1856 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1857 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1858 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1859 | } |
| 1860 | else |
| 1861 | { |
| 1862 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1863 | AddTSRsp.TCLASSPROC.present = 1; |
| 1864 | } |
| 1865 | } |
| 1866 | |
| 1867 | // schedule element is included only if requested in the tspec and we are |
| 1868 | // using hcca (or both edca and hcca) |
| 1869 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1870 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1871 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1872 | // sta figure it out |
| 1873 | if ((pSchedule != NULL) && |
| 1874 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1875 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1876 | { |
| 1877 | if ( pAddTS->wsmTspecPresent ) |
| 1878 | { |
| 1879 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1880 | } |
| 1881 | else |
| 1882 | { |
| 1883 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1884 | } |
| 1885 | } |
| 1886 | |
| 1887 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1888 | if ( DOT11F_FAILED( nStatus ) ) |
| 1889 | { |
| 1890 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1891 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | nStatus ); |
| 1893 | // We'll fall back on the worst case scenario: |
| 1894 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1895 | } |
| 1896 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1897 | { |
| 1898 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1899 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1900 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | } |
| 1902 | } |
| 1903 | else |
| 1904 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1905 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1906 | |
| 1907 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1908 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1909 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1910 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1911 | |
| 1912 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1913 | |
| 1914 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1915 | if ( DOT11F_FAILED( nStatus ) ) |
| 1916 | { |
| 1917 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1918 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1919 | nStatus ); |
| 1920 | // We'll fall back on the worst case scenario: |
| 1921 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1922 | } |
| 1923 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1924 | { |
| 1925 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1926 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1927 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | } |
| 1929 | } |
| 1930 | |
| 1931 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1932 | |
| 1933 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1934 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1935 | { |
| 1936 | 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] | 1937 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1938 | return; |
| 1939 | } |
| 1940 | |
| 1941 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1942 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | |
| 1944 | // Next, we fill out the buffer descriptor: |
| 1945 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1946 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1947 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1948 | { |
| 1949 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1950 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | nSirStatus ); |
| 1952 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1953 | return; // allocated! |
| 1954 | } |
| 1955 | |
| 1956 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1957 | |
| 1958 | |
| 1959 | #if 0 |
| 1960 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1961 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1962 | { |
| 1963 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1964 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1966 | return; // allocated! |
| 1967 | } |
| 1968 | #endif //TO SUPPORT BT-AMP |
| 1969 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1970 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1971 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1972 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1973 | #endif |
| 1974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1975 | // That done, pack the struct: |
| 1976 | if ( ! pAddTS->wmeTspecPresent ) |
| 1977 | { |
| 1978 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1979 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1980 | nPayload, &nPayload ); |
| 1981 | if ( DOT11F_FAILED( nStatus ) ) |
| 1982 | { |
| 1983 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1984 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1985 | nStatus ); |
| 1986 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1987 | return; |
| 1988 | } |
| 1989 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1990 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1991 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1992 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1993 | } |
| 1994 | } |
| 1995 | else |
| 1996 | { |
| 1997 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1998 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1999 | nPayload, &nPayload ); |
| 2000 | if ( DOT11F_FAILED( nStatus ) ) |
| 2001 | { |
| 2002 | 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] | 2003 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | nStatus ); |
| 2005 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2006 | return; |
| 2007 | } |
| 2008 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2009 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2010 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2011 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | } |
| 2013 | } |
| 2014 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2015 | limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2016 | nStatusCode ); |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2017 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2018 | |
| 2019 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2020 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2021 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2022 | ) |
| 2023 | { |
| 2024 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2025 | } |
| 2026 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2027 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2028 | psessionEntry->peSessionId, |
| 2029 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2030 | // Queue the frame in high priority WQ: |
| 2031 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2032 | HAL_TXRX_FRM_802_11_MGMT, |
| 2033 | ANI_TXDIR_TODS, |
| 2034 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2035 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2036 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2037 | psessionEntry->peSessionId, |
| 2038 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2039 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2040 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2041 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2042 | nSirStatus ); |
| 2043 | //Pkt will be freed up by the callback |
| 2044 | } |
| 2045 | |
| 2046 | } // End limSendAddtsRspActionFrame. |
| 2047 | |
| 2048 | void |
| 2049 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 2050 | tSirMacAddr peer, |
| 2051 | tANI_U8 wmmTspecPresent, |
| 2052 | tSirMacTSInfo *pTsinfo, |
| 2053 | tSirMacTspecIE *pTspecIe, |
| 2054 | tpPESession psessionEntry) |
| 2055 | { |
| 2056 | tANI_U8 *pFrame; |
| 2057 | tpSirMacMgmtHdr pMacHdr; |
| 2058 | tDot11fDelTS DelTS; |
| 2059 | tDot11fWMMDelTS WMMDelTS; |
| 2060 | tSirRetStatus nSirStatus; |
| 2061 | tANI_U32 nBytes, nPayload, nStatus; |
| 2062 | void *pPacket; |
| 2063 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2064 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2065 | |
| 2066 | if(NULL == psessionEntry) |
| 2067 | { |
| 2068 | return; |
| 2069 | } |
| 2070 | |
| 2071 | if ( ! wmmTspecPresent ) |
| 2072 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2073 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2074 | |
| 2075 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2076 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2077 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2078 | |
| 2079 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2080 | if ( DOT11F_FAILED( nStatus ) ) |
| 2081 | { |
| 2082 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2083 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2084 | nStatus ); |
| 2085 | // We'll fall back on the worst case scenario: |
| 2086 | nPayload = sizeof( tDot11fDelTS ); |
| 2087 | } |
| 2088 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2089 | { |
| 2090 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2091 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2092 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2093 | } |
| 2094 | } |
| 2095 | else |
| 2096 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2097 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2098 | |
| 2099 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2100 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2101 | WMMDelTS.DialogToken.token = 0; |
| 2102 | WMMDelTS.StatusCode.statusCode = 0; |
| 2103 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2104 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2105 | if ( DOT11F_FAILED( nStatus ) ) |
| 2106 | { |
| 2107 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2108 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2109 | nStatus ); |
| 2110 | // We'll fall back on the worst case scenario: |
| 2111 | nPayload = sizeof( tDot11fDelTS ); |
| 2112 | } |
| 2113 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2114 | { |
| 2115 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2116 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2117 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2118 | } |
| 2119 | } |
| 2120 | |
| 2121 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2122 | |
| 2123 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2124 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2125 | { |
| 2126 | 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] | 2127 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2128 | return; |
| 2129 | } |
| 2130 | |
| 2131 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2132 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2133 | |
| 2134 | // Next, we fill out the buffer descriptor: |
| 2135 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2136 | SIR_MAC_MGMT_ACTION, peer, |
| 2137 | psessionEntry->selfMacAddr); |
| 2138 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2139 | { |
| 2140 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2141 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2142 | nSirStatus ); |
| 2143 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2144 | return; // allocated! |
| 2145 | } |
| 2146 | |
| 2147 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2148 | |
| 2149 | #if 0 |
| 2150 | |
| 2151 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2152 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2153 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2154 | { |
| 2155 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2156 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2157 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2158 | return; // allocated! |
| 2159 | } |
| 2160 | #endif //TO SUPPORT BT-AMP |
| 2161 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2162 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2163 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2164 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2165 | #endif |
| 2166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | // That done, pack the struct: |
| 2168 | if ( !wmmTspecPresent ) |
| 2169 | { |
| 2170 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2171 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2172 | nPayload, &nPayload ); |
| 2173 | if ( DOT11F_FAILED( nStatus ) ) |
| 2174 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2175 | 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] | 2176 | nStatus ); |
| 2177 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2178 | return; // allocated! |
| 2179 | } |
| 2180 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2181 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2182 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2183 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2184 | } |
| 2185 | } |
| 2186 | else |
| 2187 | { |
| 2188 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2189 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2190 | nPayload, &nPayload ); |
| 2191 | if ( DOT11F_FAILED( nStatus ) ) |
| 2192 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2193 | 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] | 2194 | nStatus ); |
| 2195 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2196 | return; // allocated! |
| 2197 | } |
| 2198 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2199 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2200 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2201 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2202 | } |
| 2203 | } |
| 2204 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2205 | limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2206 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | |
| 2208 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2210 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | ) |
| 2212 | { |
| 2213 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2214 | } |
| 2215 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2216 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2217 | psessionEntry->peSessionId, |
| 2218 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2220 | HAL_TXRX_FRM_802_11_MGMT, |
| 2221 | ANI_TXDIR_TODS, |
| 2222 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2223 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2224 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2225 | psessionEntry->peSessionId, |
| 2226 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2227 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2228 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2229 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2230 | nSirStatus ); |
| 2231 | //Pkt will be freed up by the callback |
| 2232 | } |
| 2233 | |
| 2234 | } // End limSendDeltsReqActionFrame. |
| 2235 | |
| 2236 | void |
| 2237 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2238 | tLimMlmAssocReq *pMlmAssocReq, |
| 2239 | tpPESession psessionEntry) |
| 2240 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2241 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2242 | tANI_U16 caps; |
| 2243 | tANI_U8 *pFrame; |
| 2244 | tSirRetStatus nSirStatus; |
| 2245 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2246 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2248 | void *pPacket; |
| 2249 | eHalStatus halstatus; |
| 2250 | tANI_U16 nAddIELen; |
| 2251 | tANI_U8 *pAddIE; |
| 2252 | tANI_U8 *wpsIe = NULL; |
| 2253 | #if defined WLAN_FEATURE_VOWIFI |
| 2254 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2255 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2256 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2257 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2258 | tDot11fIEExtCap extractedExtCap; |
| 2259 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2260 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | |
| 2262 | if(NULL == psessionEntry) |
| 2263 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2264 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2265 | return; |
| 2266 | } |
| 2267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | /* check this early to avoid unncessary operation */ |
| 2269 | if(NULL == psessionEntry->pLimJoinReq) |
| 2270 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2271 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | return; |
| 2273 | } |
| 2274 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2275 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2276 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2277 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2278 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2279 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2280 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2281 | return; |
| 2282 | } |
| 2283 | |
| 2284 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2285 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2286 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2287 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 2288 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
| 2289 | &nAddIELen, |
| 2290 | &extractedExtCap ); |
| 2291 | if(eSIR_SUCCESS != nSirStatus ) |
| 2292 | { |
| 2293 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2294 | limLog(pMac, LOG1, |
| 2295 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2296 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2297 | /* TODO:remove this code once driver provides the call back function |
| 2298 | * to supplicant for set_qos_map |
| 2299 | */ |
| 2300 | else |
| 2301 | { |
| 2302 | if(extractedExtCap.interworkingService) |
| 2303 | { |
| 2304 | extractedExtCap.qosMap = 1; |
| 2305 | } |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 2306 | /* No need to merge the EXT Cap from Supplicant |
| 2307 | * if interworkingService is not set, as currently |
| 2308 | * driver is only interested in interworkingService |
| 2309 | * capability from supplicant. if in |
| 2310 | * future any other EXT Cap info is required from |
| 2311 | * supplicant it needs to be handled here. |
| 2312 | */ |
| 2313 | else |
| 2314 | { |
| 2315 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2316 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2317 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2319 | caps = pMlmAssocReq->capabilityInfo; |
| 2320 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2321 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2322 | #if defined(FEATURE_WLAN_WAPI) |
| 2323 | /* CR: 262463 : |
| 2324 | According to WAPI standard: |
| 2325 | 7.3.1.4 Capability Information field |
| 2326 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2327 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2328 | Reassociation management frames. */ |
| 2329 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2330 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2331 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2332 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2333 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2334 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2335 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2336 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2337 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2338 | |
| 2339 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2340 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2341 | |
| 2342 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2343 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2344 | |
| 2345 | // We prefer .11e asociations: |
| 2346 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2347 | |
| 2348 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2349 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2350 | |
| 2351 | if ( psessionEntry->lim11hEnable && |
| 2352 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2353 | { |
| 2354 | #if defined WLAN_FEATURE_VOWIFI |
| 2355 | PowerCapsPopulated = TRUE; |
| 2356 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2357 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2358 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2359 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2360 | |
| 2361 | } |
| 2362 | |
| 2363 | #if defined WLAN_FEATURE_VOWIFI |
| 2364 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2365 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2366 | { |
| 2367 | if (PowerCapsPopulated == FALSE) |
| 2368 | { |
| 2369 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2370 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | } |
| 2372 | } |
| 2373 | #endif |
| 2374 | |
| 2375 | if ( fQosEnabled && |
| 2376 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2377 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | |
| 2379 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2380 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | |
| 2382 | #if defined WLAN_FEATURE_VOWIFI |
| 2383 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2384 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2385 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2386 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | } |
| 2388 | #endif |
| 2389 | // The join request *should* contain zero or one of the WPA and RSN |
| 2390 | // IEs. The payload send along with the request is a |
| 2391 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2392 | |
| 2393 | // typedef struct sSirRSNie |
| 2394 | // { |
| 2395 | // tANI_U16 length; |
| 2396 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2397 | // } tSirRSNie, *tpSirRSNie; |
| 2398 | |
| 2399 | // So, we should be able to make the following two calls harmlessly, |
| 2400 | // since they do nothing if they don't find the given IE in the |
| 2401 | // bytestream with which they're provided. |
| 2402 | |
| 2403 | // The net effect of this will be to faithfully transmit whatever |
| 2404 | // security IE is in the join request. |
| 2405 | |
| 2406 | // *However*, if we're associating for the purpose of WPS |
| 2407 | // enrollment, and we've been configured to indicate that by |
| 2408 | // eliding the WPA or RSN IE, we just skip this: |
| 2409 | if( nAddIELen && pAddIE ) |
| 2410 | { |
| 2411 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2412 | } |
| 2413 | if ( NULL == wpsIe ) |
| 2414 | { |
| 2415 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2416 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2417 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2418 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2419 | #if defined(FEATURE_WLAN_WAPI) |
| 2420 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2421 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2422 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2423 | } |
| 2424 | |
| 2425 | // include WME EDCA IE as well |
| 2426 | if ( fWmeEnabled ) |
| 2427 | { |
| 2428 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2429 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2430 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2431 | } |
| 2432 | |
| 2433 | if ( fWsmEnabled && |
| 2434 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2435 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2436 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2437 | } |
| 2438 | } |
| 2439 | |
| 2440 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2441 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2442 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2443 | pMac->lim.htCapabilityPresentInBeacon) |
| 2444 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2445 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2446 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2447 | |
| 2448 | /* |
| 2449 | * To resolve the interop problem with Broadcom AP, |
| 2450 | * where TQ STA could not pass traffic with GF enabled, |
| 2451 | * TQ STA will do Greenfield only with TQ AP, for |
| 2452 | * everybody else it will be turned off. |
| 2453 | */ |
| 2454 | |
| 2455 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2456 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2457 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2458 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2459 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2460 | } |
| 2461 | #endif |
| 2462 | |
| 2463 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2464 | #ifdef WLAN_FEATURE_11AC |
| 2465 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2466 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2467 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2468 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 2469 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, |
| 2470 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 2471 | |
| 2472 | if (SIR_11B_CHANNEL_END >= psessionEntry->currentOperChannel) |
| 2473 | PopulateDot11fOperatingMode(pMac, &pFrm->OperatingMode, |
| 2474 | psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2475 | } |
| 2476 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2477 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2478 | |
| 2479 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2480 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2481 | { |
| 2482 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2483 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2484 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2485 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2486 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2487 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2488 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2489 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2490 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2491 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2492 | { |
| 2493 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2494 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2495 | } |
| 2496 | #endif |
| 2497 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2498 | #ifdef FEATURE_WLAN_ESE |
| 2499 | /* For ESE Associations fill the ESE IEs */ |
| 2500 | if (psessionEntry->isESEconnection && |
| 2501 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2502 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2503 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2504 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2505 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2506 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2507 | } |
| 2508 | #endif |
| 2509 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2510 | /* merge the ExtCap struct*/ |
| 2511 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2512 | { |
| 2513 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap); |
| 2514 | } |
| 2515 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2516 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2517 | if ( DOT11F_FAILED( nStatus ) ) |
| 2518 | { |
| 2519 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2520 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2521 | nStatus ); |
| 2522 | // We'll fall back on the worst case scenario: |
| 2523 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2524 | } |
| 2525 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2526 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2527 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2528 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2529 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2530 | } |
| 2531 | |
| 2532 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2533 | |
| 2534 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2535 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2536 | ( void** ) &pPacket ); |
| 2537 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2538 | { |
| 2539 | 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] | 2540 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2541 | |
| 2542 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2543 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | |
| 2545 | |
| 2546 | /* Update PE session id*/ |
| 2547 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2548 | |
| 2549 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2550 | |
| 2551 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2552 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2553 | |
| 2554 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2555 | ( tANI_U32* ) &mlmAssocCnf); |
| 2556 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2557 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2558 | return; |
| 2559 | } |
| 2560 | |
| 2561 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2562 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2563 | |
| 2564 | // Next, we fill out the buffer descriptor: |
| 2565 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2566 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2567 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2568 | { |
| 2569 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2570 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2571 | nSirStatus ); |
| 2572 | 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] | 2573 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2574 | return; |
| 2575 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2576 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2577 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2578 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2579 | sizeof(tSirMacMgmtHdr), |
| 2580 | nPayload, &nPayload ); |
| 2581 | if ( DOT11F_FAILED( nStatus ) ) |
| 2582 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2583 | 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] | 2584 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2585 | nStatus ); |
| 2586 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2587 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2588 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2589 | return; |
| 2590 | } |
| 2591 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2592 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2593 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2594 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2595 | } |
| 2596 | |
| 2597 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2598 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2599 | nBytes );) |
| 2600 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2601 | |
| 2602 | if( psessionEntry->assocReq != NULL ) |
| 2603 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2604 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2605 | psessionEntry->assocReq = NULL; |
| 2606 | } |
| 2607 | |
| 2608 | if( nAddIELen ) |
| 2609 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2610 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2611 | pAddIE, |
| 2612 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2613 | nPayload += nAddIELen; |
| 2614 | } |
| 2615 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2616 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2617 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2618 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2619 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2620 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2621 | } |
| 2622 | else |
| 2623 | { |
| 2624 | //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] | 2625 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2626 | psessionEntry->assocReqLen = nPayload; |
| 2627 | } |
| 2628 | |
| 2629 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2630 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2631 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2632 | ) |
| 2633 | { |
| 2634 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2635 | } |
| 2636 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 2637 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 2638 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2639 | { |
| 2640 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2641 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2642 | |
| 2643 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2644 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2645 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2646 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2647 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2648 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2649 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2650 | psessionEntry->peSessionId, |
| 2651 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 2652 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 2653 | if( ( psessionEntry->is11Gonly == true ) && |
| 2654 | ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){ |
| 2655 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2656 | } |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 2657 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 2658 | { |
| 2659 | limLog(pMac, LOG1, FL("Assoc Req - txBdToken %u"), pMac->lim.txBdToken); |
| 2660 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 2661 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2662 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2663 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2664 | limTxComplete, pFrame, limTxBdComplete, txFlag, |
| 2665 | pMac->lim.txBdToken); |
| 2666 | pMac->lim.txBdToken++; |
| 2667 | } |
| 2668 | else |
| 2669 | { |
| 2670 | halstatus = halTxFrame( pMac, pPacket, |
| 2671 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2672 | HAL_TXRX_FRM_802_11_MGMT, |
| 2673 | ANI_TXDIR_TODS, |
| 2674 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2675 | limTxComplete, pFrame, txFlag ); |
| 2676 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2677 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2678 | psessionEntry->peSessionId, |
| 2679 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2680 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2681 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2682 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | halstatus ); |
| 2684 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2685 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2686 | return; |
| 2687 | } |
| 2688 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 2689 | //Enable caching only if Assoc Request is successfully submitted to the h/w |
| 2690 | WLANTL_EnableCaching(psessionEntry->staId); |
| 2691 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2692 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2693 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2694 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2695 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2696 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2697 | } // End limSendAssocReqMgmtFrame |
| 2698 | |
| 2699 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2700 | #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] | 2701 | /*------------------------------------------------------------------------------------ |
| 2702 | * |
| 2703 | * Send Reassoc Req with FTIEs. |
| 2704 | * |
| 2705 | *----------------------------------------------------------------------------------- |
| 2706 | */ |
| 2707 | void |
| 2708 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2709 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2710 | { |
| 2711 | static tDot11fReAssocRequest frm; |
| 2712 | tANI_U16 caps; |
| 2713 | tANI_U8 *pFrame; |
| 2714 | tSirRetStatus nSirStatus; |
| 2715 | tANI_U32 nBytes, nPayload, nStatus; |
| 2716 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2717 | void *pPacket; |
| 2718 | eHalStatus halstatus; |
| 2719 | #if defined WLAN_FEATURE_VOWIFI |
| 2720 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2721 | #endif |
| 2722 | tANI_U16 ft_ies_length = 0; |
| 2723 | tANI_U8 *pBody; |
| 2724 | tANI_U16 nAddIELen; |
| 2725 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2726 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | tANI_U8 *wpsIe = NULL; |
| 2728 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2729 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2730 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2731 | |
| 2732 | if (NULL == psessionEntry) |
| 2733 | { |
| 2734 | return; |
| 2735 | } |
| 2736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2737 | /* check this early to avoid unncessary operation */ |
| 2738 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2739 | { |
| 2740 | return; |
| 2741 | } |
| 2742 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2743 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2744 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2745 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2746 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2747 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2748 | |
| 2749 | caps = pMlmReassocReq->capabilityInfo; |
| 2750 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2751 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2752 | #if defined(FEATURE_WLAN_WAPI) |
| 2753 | /* CR: 262463 : |
| 2754 | According to WAPI standard: |
| 2755 | 7.3.1.4 Capability Information field |
| 2756 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2757 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2758 | Reassociation management frames. */ |
| 2759 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2760 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2761 | #endif |
| 2762 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2763 | |
| 2764 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2765 | |
| 2766 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2767 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2768 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2769 | |
| 2770 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2771 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2772 | &frm.SuppRates,psessionEntry); |
| 2773 | |
| 2774 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2775 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2776 | |
| 2777 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2778 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2779 | |
| 2780 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2781 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2782 | |
| 2783 | if ( psessionEntry->lim11hEnable && |
| 2784 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2785 | { |
| 2786 | #if defined WLAN_FEATURE_VOWIFI |
| 2787 | PowerCapsPopulated = TRUE; |
| 2788 | |
| 2789 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2790 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2791 | #endif |
| 2792 | } |
| 2793 | |
| 2794 | #if defined WLAN_FEATURE_VOWIFI |
| 2795 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2796 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2797 | { |
| 2798 | if (PowerCapsPopulated == FALSE) |
| 2799 | { |
| 2800 | PowerCapsPopulated = TRUE; |
| 2801 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2802 | } |
| 2803 | } |
| 2804 | #endif |
| 2805 | |
| 2806 | if ( fQosEnabled && |
| 2807 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2808 | { |
| 2809 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2810 | } |
| 2811 | |
| 2812 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2813 | &frm.ExtSuppRates, psessionEntry ); |
| 2814 | |
| 2815 | #if defined WLAN_FEATURE_VOWIFI |
| 2816 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2817 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2818 | { |
| 2819 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2820 | } |
| 2821 | #endif |
| 2822 | |
| 2823 | // Ideally this should be enabled for 11r also. But 11r does |
| 2824 | // not follow the usual norm of using the Opaque object |
| 2825 | // for rsnie and fties. Instead we just add |
| 2826 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2827 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2828 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2829 | // |
| 2830 | // The join request *should* contain zero or one of the WPA and RSN |
| 2831 | // IEs. The payload send along with the request is a |
| 2832 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2833 | |
| 2834 | // typedef struct sSirRSNie |
| 2835 | // { |
| 2836 | // tANI_U16 length; |
| 2837 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2838 | // } tSirRSNie, *tpSirRSNie; |
| 2839 | |
| 2840 | // So, we should be able to make the following two calls harmlessly, |
| 2841 | // since they do nothing if they don't find the given IE in the |
| 2842 | // bytestream with which they're provided. |
| 2843 | |
| 2844 | // The net effect of this will be to faithfully transmit whatever |
| 2845 | // security IE is in the join request. |
| 2846 | |
| 2847 | // *However*, if we're associating for the purpose of WPS |
| 2848 | // enrollment, and we've been configured to indicate that by |
| 2849 | // eliding the WPA or RSN IE, we just skip this: |
| 2850 | if (!psessionEntry->is11Rconnection) |
| 2851 | { |
| 2852 | if( nAddIELen && pAddIE ) |
| 2853 | { |
| 2854 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2855 | } |
| 2856 | if ( NULL == wpsIe ) |
| 2857 | { |
| 2858 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2859 | &frm.RSNOpaque ); |
| 2860 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2861 | &frm.WPAOpaque ); |
| 2862 | } |
| 2863 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2864 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2865 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2866 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2867 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2868 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2869 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2870 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2871 | } |
| 2872 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2873 | #ifdef FEATURE_WLAN_ESE |
| 2874 | // For ESE Associations fill the ESE IEs |
| 2875 | if (psessionEntry->isESEconnection && |
| 2876 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2878 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2879 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2880 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2881 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2882 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2883 | #endif //FEATURE_WLAN_ESE |
| 2884 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2885 | |
| 2886 | // include WME EDCA IE as well |
| 2887 | if ( fWmeEnabled ) |
| 2888 | { |
| 2889 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2890 | { |
| 2891 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2892 | } |
| 2893 | |
| 2894 | if ( fWsmEnabled && |
| 2895 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2896 | { |
| 2897 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2898 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2899 | #ifdef FEATURE_WLAN_ESE |
| 2900 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2901 | { |
| 2902 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2903 | |
| 2904 | // 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] | 2905 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2906 | { |
| 2907 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2908 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2909 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2910 | |
| 2911 | tsrsIE.tsid = 0; |
| 2912 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2913 | { |
| 2914 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2915 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2916 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2917 | { |
| 2918 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2919 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2920 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2921 | } |
| 2922 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2923 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2924 | } |
| 2925 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2926 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2927 | pMac->lim.htCapabilityPresentInBeacon) |
| 2928 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2929 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2930 | } |
| 2931 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2932 | #if defined WLAN_FEATURE_VOWIFI_11R |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 2933 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && |
| 2934 | (pMac->ft.ftSmeContext.addMDIE == TRUE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2935 | #if defined FEATURE_WLAN_ESE |
| 2936 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2937 | #endif |
| 2938 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2939 | { |
| 2940 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2941 | } |
| 2942 | #endif |
| 2943 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2944 | #ifdef WLAN_FEATURE_11AC |
| 2945 | if ( psessionEntry->vhtCapability && |
| 2946 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2947 | { |
| 2948 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 2949 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 2950 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 2951 | |
| 2952 | if (SIR_11B_CHANNEL_END >= psessionEntry->currentOperChannel) |
| 2953 | PopulateDot11fOperatingMode(pMac, &frm.OperatingMode, |
| 2954 | psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2955 | } |
| 2956 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2957 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2958 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2959 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2960 | if ( DOT11F_FAILED( nStatus ) ) |
| 2961 | { |
| 2962 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2963 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2964 | nStatus ); |
| 2965 | // We'll fall back on the worst case scenario: |
| 2966 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2967 | } |
| 2968 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2969 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2970 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2972 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2973 | } |
| 2974 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2975 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2976 | |
| 2977 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2978 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2979 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2980 | #endif |
| 2981 | |
| 2982 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2983 | if (psessionEntry->is11Rconnection) |
| 2984 | { |
| 2985 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2986 | } |
| 2987 | #endif |
| 2988 | |
| 2989 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2990 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2991 | ( void** ) &pPacket ); |
| 2992 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2993 | { |
| 2994 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2995 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2996 | 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] | 2997 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2998 | goto end; |
| 2999 | } |
| 3000 | |
| 3001 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3002 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3003 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3004 | #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] | 3005 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3006 | #endif |
| 3007 | // Next, we fill out the buffer descriptor: |
| 3008 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3009 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3010 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3011 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3012 | { |
| 3013 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3014 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3015 | nSirStatus ); |
| 3016 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3017 | goto end; |
| 3018 | } |
| 3019 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3020 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3021 | // That done, pack the ReAssoc Request: |
| 3022 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3023 | sizeof(tSirMacMgmtHdr), |
| 3024 | nPayload, &nPayload ); |
| 3025 | if ( DOT11F_FAILED( nStatus ) ) |
| 3026 | { |
| 3027 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3028 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3029 | nStatus ); |
| 3030 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3031 | goto end; |
| 3032 | } |
| 3033 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3034 | { |
| 3035 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3036 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3037 | } |
| 3038 | |
| 3039 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3040 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3041 | nBytes, nPayload );) |
| 3042 | if( psessionEntry->assocReq != NULL ) |
| 3043 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3044 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3045 | psessionEntry->assocReq = NULL; |
| 3046 | } |
| 3047 | |
| 3048 | if( nAddIELen ) |
| 3049 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3050 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3051 | pAddIE, |
| 3052 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3053 | nPayload += nAddIELen; |
| 3054 | } |
| 3055 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3056 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3057 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | { |
| 3059 | 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] | 3060 | } |
| 3061 | else |
| 3062 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3063 | //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] | 3064 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3065 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3066 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3067 | |
| 3068 | if (psessionEntry->is11Rconnection) |
| 3069 | { |
| 3070 | { |
| 3071 | int i = 0; |
| 3072 | |
| 3073 | pBody = pFrame + nBytes; |
| 3074 | for (i=0; i<ft_ies_length; i++) |
| 3075 | { |
| 3076 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 3077 | pBody++; |
| 3078 | } |
| 3079 | } |
| 3080 | } |
| 3081 | |
| 3082 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3083 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 3084 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3085 | (tANI_U8 *)pFrame, |
| 3086 | (nBytes + ft_ies_length));) |
| 3087 | #endif |
| 3088 | |
| 3089 | |
| 3090 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3091 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3092 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3093 | ) |
| 3094 | { |
| 3095 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3096 | } |
| 3097 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3098 | if( NULL != psessionEntry->assocReq ) |
| 3099 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3100 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3101 | psessionEntry->assocReq = NULL; |
| 3102 | } |
| 3103 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3104 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3105 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3106 | { |
| 3107 | 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] | 3108 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3109 | } |
| 3110 | else |
| 3111 | { |
| 3112 | //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] | 3113 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3114 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3115 | psessionEntry->assocReqLen = (ft_ies_length); |
| 3116 | } |
| 3117 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3118 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3119 | psessionEntry->peSessionId, |
| 3120 | pMacHdr->fc.subType)); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3121 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3122 | { |
| 3123 | limLog( pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken); |
| 3124 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3125 | ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3126 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3127 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3128 | limTxComplete, pFrame, limTxBdComplete, txFlag, |
| 3129 | pMac->lim.txBdToken); |
| 3130 | pMac->lim.txBdToken++; |
| 3131 | } |
| 3132 | else |
| 3133 | { |
| 3134 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3135 | HAL_TXRX_FRM_802_11_MGMT, |
| 3136 | ANI_TXDIR_TODS, |
| 3137 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3138 | limTxComplete, pFrame, txFlag ); |
| 3139 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3140 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3141 | psessionEntry->peSessionId, |
| 3142 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3143 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3144 | { |
| 3145 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3146 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3147 | nSirStatus ); |
| 3148 | //Pkt will be freed up by the callback |
| 3149 | goto end; |
| 3150 | } |
| 3151 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 3152 | // Enable TL cahching in case of roaming |
| 3153 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3155 | end: |
| 3156 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3157 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3158 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3159 | |
| 3160 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3161 | |
| 3162 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3163 | tLimMlmReassocReq *pMlmReassocReq, |
| 3164 | tpPESession psessionEntry) |
| 3165 | { |
| 3166 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3167 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
Sachin Ahuja | 07a4301 | 2015-01-30 17:04:38 +0530 | [diff] [blame] | 3168 | #ifdef FEATURE_WLAN_ESE |
| 3169 | tANI_U32 val=0; |
| 3170 | #endif |
| 3171 | if (pMlmReassocReq == NULL) |
| 3172 | { |
| 3173 | limLog(pMac, LOGE, |
| 3174 | FL("Invalid pMlmReassocReq")); |
| 3175 | goto end; |
| 3176 | } |
Hema Aparna Medicharla | 43d0f7b | 2015-02-12 17:07:59 +0530 | [diff] [blame] | 3177 | |
| 3178 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3179 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3180 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3181 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3182 | |
| 3183 | // Prepare and send Reassociation request frame |
| 3184 | // start reassoc timer. |
Sachin Ahuja | 07a4301 | 2015-01-30 17:04:38 +0530 | [diff] [blame] | 3185 | #ifdef FEATURE_WLAN_ESE |
| 3186 | /* |
| 3187 | * In case of Ese Reassociation, change the reassoc timer |
| 3188 | * value. |
| 3189 | */ |
| 3190 | val = pMlmReassocReq->reassocFailureTimeout; |
| 3191 | if (psessionEntry->isESEconnection) |
| 3192 | { |
| 3193 | val = val/LIM_MAX_REASSOC_RETRY_LIMIT; |
| 3194 | } |
| 3195 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) != |
| 3196 | TX_SUCCESS) |
| 3197 | { |
| 3198 | limLog(pMac, LOGP, |
| 3199 | FL("unable to deactivate Reassoc failure timer")); |
| 3200 | } |
| 3201 | val = SYS_MS_TO_TICKS(val); |
| 3202 | if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer, |
| 3203 | val, 0) != TX_SUCCESS) |
| 3204 | { |
| 3205 | limLog(pMac, LOGP, |
| 3206 | FL("unable to change Reassociation failure timer")); |
| 3207 | } |
| 3208 | #endif |
| 3209 | |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3210 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3211 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3212 | 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] | 3213 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3214 | != TX_SUCCESS) |
| 3215 | { |
| 3216 | // Could not start reassoc failure timer. |
| 3217 | // Log error |
| 3218 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3219 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3220 | // Return Reassoc confirm with |
| 3221 | // Resources Unavailable |
| 3222 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3223 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3224 | goto end; |
| 3225 | } |
| 3226 | |
| 3227 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3228 | return; |
| 3229 | |
| 3230 | end: |
| 3231 | // Free up buffer allocated for reassocReq |
| 3232 | if (pMlmReassocReq != NULL) |
| 3233 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3234 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3235 | pMlmReassocReq = NULL; |
| 3236 | } |
| 3237 | if (pTmpMlmReassocReq != NULL) |
| 3238 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3239 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3240 | pTmpMlmReassocReq = NULL; |
| 3241 | } |
| 3242 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3243 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3244 | /* Update PE sessio Id*/ |
| 3245 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3246 | |
| 3247 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3248 | } |
| 3249 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3250 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3251 | |
| 3252 | |
| 3253 | void |
| 3254 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3255 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3256 | { |
| 3257 | static tDot11fReAssocRequest frm; |
| 3258 | tANI_U16 caps; |
| 3259 | tANI_U8 *pFrame; |
| 3260 | tSirRetStatus nSirStatus; |
| 3261 | tANI_U32 nBytes, nPayload, nStatus; |
| 3262 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3263 | void *pPacket; |
| 3264 | eHalStatus halstatus; |
| 3265 | tANI_U16 nAddIELen; |
| 3266 | tANI_U8 *pAddIE; |
| 3267 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3268 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3269 | #if defined WLAN_FEATURE_VOWIFI |
| 3270 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3271 | #endif |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3272 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3273 | |
| 3274 | if(NULL == psessionEntry) |
| 3275 | { |
| 3276 | return; |
| 3277 | } |
| 3278 | |
| 3279 | /* check this early to avoid unncessary operation */ |
| 3280 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3281 | { |
| 3282 | return; |
| 3283 | } |
| 3284 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3285 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3286 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3287 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | |
| 3289 | caps = pMlmReassocReq->capabilityInfo; |
| 3290 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3291 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3292 | #if defined(FEATURE_WLAN_WAPI) |
| 3293 | /* CR: 262463 : |
| 3294 | According to WAPI standard: |
| 3295 | 7.3.1.4 Capability Information field |
| 3296 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3297 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3298 | Reassociation management frames. */ |
| 3299 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3300 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3301 | #endif |
| 3302 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3303 | |
| 3304 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3305 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3306 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3307 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3308 | |
| 3309 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3310 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3311 | &frm.SuppRates,psessionEntry); |
| 3312 | |
| 3313 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3314 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3315 | |
| 3316 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3317 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3318 | |
| 3319 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3320 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3321 | |
| 3322 | |
| 3323 | if ( psessionEntry->lim11hEnable && |
| 3324 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3325 | { |
| 3326 | #if defined WLAN_FEATURE_VOWIFI |
| 3327 | PowerCapsPopulated = TRUE; |
| 3328 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3329 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3330 | #endif |
| 3331 | } |
| 3332 | |
| 3333 | #if defined WLAN_FEATURE_VOWIFI |
| 3334 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3335 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3336 | { |
| 3337 | if (PowerCapsPopulated == FALSE) |
| 3338 | { |
| 3339 | PowerCapsPopulated = TRUE; |
| 3340 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3341 | } |
| 3342 | } |
| 3343 | #endif |
| 3344 | |
| 3345 | if ( fQosEnabled && |
| 3346 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3347 | { |
| 3348 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3349 | } |
| 3350 | |
| 3351 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3352 | &frm.ExtSuppRates, psessionEntry ); |
| 3353 | |
| 3354 | #if defined WLAN_FEATURE_VOWIFI |
| 3355 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3356 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3357 | { |
| 3358 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3359 | } |
| 3360 | #endif |
| 3361 | // The join request *should* contain zero or one of the WPA and RSN |
| 3362 | // IEs. The payload send along with the request is a |
| 3363 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3364 | |
| 3365 | // typedef struct sSirRSNie |
| 3366 | // { |
| 3367 | // tANI_U16 length; |
| 3368 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3369 | // } tSirRSNie, *tpSirRSNie; |
| 3370 | |
| 3371 | // So, we should be able to make the following two calls harmlessly, |
| 3372 | // since they do nothing if they don't find the given IE in the |
| 3373 | // bytestream with which they're provided. |
| 3374 | |
| 3375 | // The net effect of this will be to faithfully transmit whatever |
| 3376 | // security IE is in the join request. |
| 3377 | |
| 3378 | // *However*, if we're associating for the purpose of WPS |
| 3379 | // enrollment, and we've been configured to indicate that by |
| 3380 | // eliding the WPA or RSN IE, we just skip this: |
| 3381 | if( nAddIELen && pAddIE ) |
| 3382 | { |
| 3383 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3384 | } |
| 3385 | if ( NULL == wpsIe ) |
| 3386 | { |
| 3387 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3388 | &frm.RSNOpaque ); |
| 3389 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3390 | &frm.WPAOpaque ); |
| 3391 | #if defined(FEATURE_WLAN_WAPI) |
| 3392 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3393 | &frm.WAPIOpaque ); |
| 3394 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3395 | } |
| 3396 | |
| 3397 | // include WME EDCA IE as well |
| 3398 | if ( fWmeEnabled ) |
| 3399 | { |
| 3400 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3401 | { |
| 3402 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3403 | } |
| 3404 | |
| 3405 | if ( fWsmEnabled && |
| 3406 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3407 | { |
| 3408 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3409 | } |
| 3410 | } |
| 3411 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3412 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3413 | pMac->lim.htCapabilityPresentInBeacon) |
| 3414 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3415 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3417 | #ifdef WLAN_FEATURE_11AC |
| 3418 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3419 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3420 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3421 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame^] | 3422 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 3423 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3424 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 3425 | |
| 3426 | if (SIR_11B_CHANNEL_END >= psessionEntry->currentOperChannel) |
| 3427 | PopulateDot11fOperatingMode(pMac, &frm.OperatingMode, |
| 3428 | psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3429 | } |
| 3430 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3431 | |
| 3432 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3433 | if ( DOT11F_FAILED( nStatus ) ) |
| 3434 | { |
| 3435 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3436 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | nStatus ); |
| 3438 | // We'll fall back on the worst case scenario: |
| 3439 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3440 | } |
| 3441 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3442 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3443 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3444 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3445 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3446 | } |
| 3447 | |
| 3448 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3449 | |
| 3450 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3451 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3452 | ( void** ) &pPacket ); |
| 3453 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3454 | { |
| 3455 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3456 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3457 | 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] | 3458 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3459 | goto end; |
| 3460 | } |
| 3461 | |
| 3462 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3463 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3464 | |
| 3465 | // Next, we fill out the buffer descriptor: |
| 3466 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3467 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3468 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3469 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3470 | { |
| 3471 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3472 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3473 | nSirStatus ); |
| 3474 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3475 | goto end; |
| 3476 | } |
| 3477 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3478 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3479 | // That done, pack the Probe Request: |
| 3480 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3481 | sizeof(tSirMacMgmtHdr), |
| 3482 | nPayload, &nPayload ); |
| 3483 | if ( DOT11F_FAILED( nStatus ) ) |
| 3484 | { |
| 3485 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3486 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3487 | nStatus ); |
| 3488 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3489 | goto end; |
| 3490 | } |
| 3491 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3492 | { |
| 3493 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3494 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3495 | } |
| 3496 | |
| 3497 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3498 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3499 | nBytes );) |
| 3500 | |
| 3501 | if( psessionEntry->assocReq != NULL ) |
| 3502 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3503 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3504 | psessionEntry->assocReq = NULL; |
| 3505 | } |
| 3506 | |
| 3507 | if( nAddIELen ) |
| 3508 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3509 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3510 | pAddIE, |
| 3511 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3512 | nPayload += nAddIELen; |
| 3513 | } |
| 3514 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3515 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3516 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3517 | { |
| 3518 | 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] | 3519 | } |
| 3520 | else |
| 3521 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3522 | //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] | 3523 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3524 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3526 | |
| 3527 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3528 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3529 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | ) |
| 3531 | { |
| 3532 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3533 | } |
| 3534 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 3535 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 3536 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3537 | { |
| 3538 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3539 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3540 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3541 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3542 | psessionEntry->peSessionId, |
| 3543 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 3544 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3545 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3546 | { |
| 3547 | limLog(pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken); |
| 3548 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3549 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3550 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3551 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3552 | limTxComplete, pFrame, limTxBdComplete, |
| 3553 | txFlag, pMac->lim.txBdToken ); |
| 3554 | pMac->lim.txBdToken++; |
| 3555 | } |
| 3556 | else |
| 3557 | { |
| 3558 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3559 | HAL_TXRX_FRM_802_11_MGMT, |
| 3560 | ANI_TXDIR_TODS, |
| 3561 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3562 | limTxComplete, pFrame, txFlag ); |
| 3563 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3564 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3565 | psessionEntry->peSessionId, |
| 3566 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3567 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3568 | { |
| 3569 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3570 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3571 | nSirStatus ); |
| 3572 | //Pkt will be freed up by the callback |
| 3573 | goto end; |
| 3574 | } |
| 3575 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 3576 | // enable caching |
| 3577 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3579 | end: |
| 3580 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3581 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3582 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3583 | |
| 3584 | } // limSendReassocReqMgmtFrame |
| 3585 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3586 | eHalStatus limAuthTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3587 | { |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3588 | tANI_U32 txCompleteSuccess; |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3589 | tpSirTxBdStatus pTxBdStatus; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3590 | |
| 3591 | if (!pData) |
| 3592 | { |
| 3593 | limLog(pMac, LOG1, |
| 3594 | FL(" pData is NULL")); |
| 3595 | return eHAL_STATUS_FAILURE; |
| 3596 | } |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3597 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3598 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3599 | { |
| 3600 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 3601 | txCompleteSuccess = pTxBdStatus->txCompleteStatus; |
| 3602 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 3603 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 3604 | } |
| 3605 | else |
| 3606 | { |
| 3607 | txCompleteSuccess = *((tANI_U32*) pData); |
| 3608 | limLog(pMac, LOG1, |
| 3609 | FL("txCompleteSuccess= %d"), txCompleteSuccess); |
| 3610 | } |
| 3611 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3612 | if(txCompleteSuccess) |
| 3613 | { |
| 3614 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS; |
| 3615 | // 'Change' timer for future activations |
| 3616 | limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER); |
| 3617 | } |
| 3618 | else |
| 3619 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE; |
| 3620 | return eHAL_STATUS_SUCCESS; |
| 3621 | } |
| 3622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3623 | /** |
| 3624 | * \brief Send an Authentication frame |
| 3625 | * |
| 3626 | * |
| 3627 | * \param pMac Pointer to Global MAC structure |
| 3628 | * |
| 3629 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3630 | * to be sent |
| 3631 | * |
| 3632 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3633 | * frame is destined |
| 3634 | * |
| 3635 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3636 | * Authentication frame3 |
| 3637 | * |
| 3638 | * |
| 3639 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3640 | * is formatted and sent when this function is called. |
| 3641 | * |
| 3642 | * |
| 3643 | */ |
| 3644 | |
| 3645 | void |
| 3646 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3647 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3648 | tSirMacAddr peerMacAddr, |
| 3649 | tANI_U8 wepBit, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3650 | tpPESession psessionEntry, |
| 3651 | tAniBool waitForAck |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3652 | ) |
| 3653 | { |
| 3654 | tANI_U8 *pFrame, *pBody; |
| 3655 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3656 | tpSirMacMgmtHdr pMacHdr; |
| 3657 | tANI_U16 i; |
| 3658 | void *pPacket; |
| 3659 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3660 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3661 | |
| 3662 | if(NULL == psessionEntry) |
| 3663 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3664 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | return; |
| 3666 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3667 | |
| 3668 | limLog(pMac, LOG1, |
| 3669 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3670 | pAuthFrameBody->authTransactionSeqNumber, |
| 3671 | pAuthFrameBody->authStatusCode, |
| 3672 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3673 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3674 | if (wepBit == LIM_WEP_IN_FC) |
| 3675 | { |
| 3676 | /// Auth frame3 to be sent with encrypted framebody |
| 3677 | /** |
| 3678 | * Allocate buffer for Authenticaton frame of size equal |
| 3679 | * to management frame header length plus 2 bytes each for |
| 3680 | * auth algorithm number, transaction number, status code, |
| 3681 | * 128 bytes for challenge text and 4 bytes each for |
| 3682 | * IV & ICV. |
| 3683 | */ |
| 3684 | |
| 3685 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3686 | |
| 3687 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3688 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3689 | else |
| 3690 | { |
| 3691 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3692 | { |
| 3693 | case SIR_MAC_AUTH_FRAME_1: |
| 3694 | /** |
| 3695 | * Allocate buffer for Authenticaton frame of size |
| 3696 | * equal to management frame header length plus 2 bytes |
| 3697 | * each for auth algorithm number, transaction number |
| 3698 | * and status code. |
| 3699 | */ |
| 3700 | |
| 3701 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3702 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3703 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3704 | |
| 3705 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3706 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3707 | { |
| 3708 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3709 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3710 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3711 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3712 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3713 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3714 | else |
| 3715 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3716 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3717 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3718 | frameLen += (2+SIR_MDIE_SIZE); |
| 3719 | } |
| 3720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3721 | #endif |
| 3722 | break; |
| 3723 | |
| 3724 | case SIR_MAC_AUTH_FRAME_2: |
| 3725 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3726 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3727 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3728 | { |
| 3729 | /** |
| 3730 | * Allocate buffer for Authenticaton frame of size |
| 3731 | * equal to management frame header length plus |
| 3732 | * 2 bytes each for auth algorithm number, |
| 3733 | * transaction number and status code. |
| 3734 | */ |
| 3735 | |
| 3736 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3737 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3738 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3739 | } |
| 3740 | else |
| 3741 | { |
| 3742 | // Shared Key algorithm with challenge text |
| 3743 | // to be sent |
| 3744 | /** |
| 3745 | * Allocate buffer for Authenticaton frame of size |
| 3746 | * equal to management frame header length plus |
| 3747 | * 2 bytes each for auth algorithm number, |
| 3748 | * transaction number, status code and 128 bytes |
| 3749 | * for challenge text. |
| 3750 | */ |
| 3751 | |
| 3752 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3753 | sizeof(tSirMacAuthFrame); |
| 3754 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3755 | } |
| 3756 | |
| 3757 | break; |
| 3758 | |
| 3759 | case SIR_MAC_AUTH_FRAME_3: |
| 3760 | /// Auth frame3 to be sent without encrypted framebody |
| 3761 | /** |
| 3762 | * Allocate buffer for Authenticaton frame of size equal |
| 3763 | * to management frame header length plus 2 bytes each |
| 3764 | * for auth algorithm number, transaction number and |
| 3765 | * status code. |
| 3766 | */ |
| 3767 | |
| 3768 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3769 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3770 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3771 | |
| 3772 | break; |
| 3773 | |
| 3774 | case SIR_MAC_AUTH_FRAME_4: |
| 3775 | /** |
| 3776 | * Allocate buffer for Authenticaton frame of size equal |
| 3777 | * to management frame header length plus 2 bytes each |
| 3778 | * for auth algorithm number, transaction number and |
| 3779 | * status code. |
| 3780 | */ |
| 3781 | |
| 3782 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3783 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3784 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3785 | |
| 3786 | break; |
| 3787 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3788 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3789 | |
| 3790 | |
| 3791 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3792 | |
| 3793 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3794 | { |
| 3795 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3796 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3797 | |
| 3798 | return; |
| 3799 | } |
| 3800 | |
| 3801 | for (i = 0; i < frameLen; i++) |
| 3802 | pFrame[i] = 0; |
| 3803 | |
| 3804 | // Prepare BD |
| 3805 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3806 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3807 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3808 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3809 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3810 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3811 | return; |
| 3812 | } |
| 3813 | |
| 3814 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3815 | pMacHdr->fc.wep = wepBit; |
| 3816 | |
| 3817 | // Prepare BSSId |
| 3818 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3819 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3820 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3821 | (tANI_U8 *) psessionEntry->bssId, |
| 3822 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3823 | } |
| 3824 | |
| 3825 | /// Prepare Authentication frame body |
| 3826 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3827 | |
| 3828 | if (wepBit == LIM_WEP_IN_FC) |
| 3829 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3830 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3831 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3832 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3833 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3834 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3835 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3836 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3838 | } |
| 3839 | else |
| 3840 | { |
| 3841 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3842 | pBody += sizeof(tANI_U16); |
| 3843 | bodyLen -= sizeof(tANI_U16); |
| 3844 | |
| 3845 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3846 | pBody += sizeof(tANI_U16); |
| 3847 | bodyLen -= sizeof(tANI_U16); |
| 3848 | |
| 3849 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3850 | pBody += sizeof(tANI_U16); |
| 3851 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3852 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3853 | sizeof (pAuthFrameBody->length) + |
| 3854 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3855 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3856 | |
| 3857 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3858 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3859 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3860 | { |
| 3861 | |
| 3862 | { |
| 3863 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3864 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3865 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3866 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3867 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3868 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3869 | (tANI_U8 *)pBody, |
| 3870 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3871 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3872 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3873 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3874 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3875 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3876 | } |
| 3877 | } |
| 3878 | else |
| 3879 | { |
| 3880 | /* MDID attr is 54*/ |
| 3881 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3882 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3883 | *pBody = SIR_MDIE_SIZE; |
| 3884 | pBody++; |
| 3885 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3886 | { |
| 3887 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3888 | pBody++; |
| 3889 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3890 | } |
| 3891 | } |
| 3892 | } |
| 3893 | #endif |
| 3894 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3895 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3896 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3897 | pAuthFrameBody->authTransactionSeqNumber, |
| 3898 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3899 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3900 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | } |
| 3902 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3903 | |
| 3904 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3905 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3906 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3907 | #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] | 3908 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3909 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3910 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3911 | ) |
| 3912 | { |
| 3913 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3914 | } |
| 3915 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 3916 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 3917 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3918 | { |
| 3919 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3920 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3921 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3922 | limLog( pMac, LOG1, |
| 3923 | FL("Sending Auth Frame over WQ5 with waitForAck %d to "MAC_ADDRESS_STR |
| 3924 | " From " MAC_ADDRESS_STR), waitForAck, MAC_ADDR_ARRAY(pMacHdr->da), |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 3925 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3926 | |
| 3927 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3928 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3929 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3930 | psessionEntry->peSessionId, |
| 3931 | pMacHdr->fc.subType)); |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 3932 | |
| 3933 | if( ( psessionEntry->is11Gonly == true ) && |
| 3934 | ( !IS_BROADCAST_MAC(peerMacAddr) ) ){ |
| 3935 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3936 | } |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3937 | if(eSIR_TRUE == waitForAck) |
| 3938 | { |
| 3939 | pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD; |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 3940 | limLog(pMac, LOG1, FL("Auth frame - txBdToken %u"), |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3941 | pMac->lim.txBdToken); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3942 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3943 | ( tANI_U16 ) frameLen, |
| 3944 | HAL_TXRX_FRM_802_11_MGMT, |
| 3945 | ANI_TXDIR_TODS, |
| 3946 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3947 | limTxComplete, pFrame, limAuthTxCompleteCnf, txFlag, |
| 3948 | pMac->lim.txBdToken); |
| 3949 | pMac->lim.txBdToken++; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3950 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3951 | psessionEntry->peSessionId, |
| 3952 | halstatus)); |
| 3953 | if (!HAL_STATUS_SUCCESS(halstatus)) |
| 3954 | { |
| 3955 | limLog( pMac, LOGE, |
| 3956 | FL("Could not send Auth frame, retCode=%X "), |
| 3957 | halstatus ); |
| 3958 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE; |
| 3959 | //Pkt will be freed up by the callback |
| 3960 | } |
| 3961 | } |
| 3962 | else |
| 3963 | { |
| 3964 | /// Queue Authentication frame in high priority WQ |
| 3965 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3966 | HAL_TXRX_FRM_802_11_MGMT, |
| 3967 | ANI_TXDIR_TODS, |
| 3968 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3969 | limTxComplete, pFrame, txFlag ); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3970 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3971 | psessionEntry->peSessionId, |
| 3972 | halstatus)); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3973 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3974 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3975 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3976 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3977 | halstatus); |
| 3978 | |
| 3979 | //Pkt will be freed up by the callback |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3980 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3981 | } |
| 3982 | |
| 3983 | return; |
| 3984 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3985 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3986 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3987 | { |
| 3988 | tANI_U16 aid; |
| 3989 | tpDphHashNode pStaDs; |
| 3990 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3991 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3992 | tpPESession psessionEntry; |
| 3993 | |
| 3994 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3995 | if (pMlmDeauthReq) |
| 3996 | { |
| 3997 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3998 | { |
| 3999 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4000 | } |
| 4001 | |
| 4002 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 4003 | { |
| 4004 | |
| 4005 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4006 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4007 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4008 | goto end; |
| 4009 | } |
| 4010 | |
| 4011 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4012 | if (pStaDs == NULL) |
| 4013 | { |
| 4014 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4015 | goto end; |
| 4016 | } |
| 4017 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4018 | /// Receive path cleanup with dummy packet |
| 4019 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4020 | |
| 4021 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4022 | if ( psessionEntry->limSystemRole == eLIM_STA_ROLE ) |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4023 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4024 | PELOGE(limLog(pMac, LOG1, |
| 4025 | FL("FT Preauth SessionId %d Cleanup" |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4026 | #ifdef FEATURE_WLAN_ESE |
| 4027 | " isESE %d" |
| 4028 | #endif |
| 4029 | #ifdef FEATURE_WLAN_LFR |
| 4030 | " isLFR %d" |
| 4031 | #endif |
| 4032 | " is11r %d, Deauth reason %d Trigger = %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4033 | psessionEntry->peSessionId, |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4034 | #ifdef FEATURE_WLAN_ESE |
| 4035 | psessionEntry->isESEconnection, |
| 4036 | #endif |
| 4037 | #ifdef FEATURE_WLAN_LFR |
| 4038 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 4039 | #endif |
| 4040 | psessionEntry->is11Rconnection, |
| 4041 | pMlmDeauthReq->reasonCode, |
| 4042 | pMlmDeauthReq->deauthTrigger);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4043 | |
| 4044 | limFTCleanup(pMac); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4045 | } |
| 4046 | #endif |
| 4047 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4048 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4049 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4050 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 4051 | } |
| 4052 | return eHAL_STATUS_SUCCESS; |
| 4053 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4054 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4055 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 4056 | sizeof(tSirMacAddr)); |
| 4057 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 4058 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 4059 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 4060 | |
| 4061 | // Free up buffer allocated |
| 4062 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4063 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4064 | |
| 4065 | limPostSmeMessage(pMac, |
| 4066 | LIM_MLM_DEAUTH_CNF, |
| 4067 | (tANI_U32 *) &mlmDeauthCnf); |
| 4068 | return eHAL_STATUS_SUCCESS; |
| 4069 | } |
| 4070 | |
| 4071 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 4072 | { |
| 4073 | tANI_U16 aid; |
| 4074 | tpDphHashNode pStaDs; |
| 4075 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 4076 | tpPESession psessionEntry; |
| 4077 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 4078 | |
| 4079 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 4080 | if (pMlmDisassocReq) |
| 4081 | { |
| 4082 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4083 | { |
| 4084 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4085 | } |
| 4086 | |
| 4087 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 4088 | { |
| 4089 | |
| 4090 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4091 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4092 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4093 | goto end; |
| 4094 | } |
| 4095 | |
| 4096 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4097 | if (pStaDs == NULL) |
| 4098 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 4099 | limLog(pMac, LOGE, |
| 4100 | FL("StaDs Null")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4101 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4102 | goto end; |
| 4103 | } |
| 4104 | |
| 4105 | /// Receive path cleanup with dummy packet |
| 4106 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 4107 | { |
| 4108 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 4109 | limLog(pMac, LOGE, |
| 4110 | FL("CleanupRxPath error")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4111 | goto end; |
| 4112 | } |
| 4113 | |
| 4114 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4115 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 4116 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4117 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4118 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4119 | PELOGE(limLog(pMac, LOG1, |
| 4120 | FL("FT Preauth SessionId %d Cleanup" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4121 | #ifdef FEATURE_WLAN_ESE |
| 4122 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4123 | #endif |
| 4124 | #ifdef FEATURE_WLAN_LFR |
| 4125 | " isLFR %d" |
| 4126 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4127 | " is11r %d reason %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4128 | psessionEntry->peSessionId, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4129 | #ifdef FEATURE_WLAN_ESE |
| 4130 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4131 | #endif |
| 4132 | #ifdef FEATURE_WLAN_LFR |
| 4133 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 4134 | #endif |
| 4135 | psessionEntry->is11Rconnection, |
| 4136 | pMlmDisassocReq->reasonCode);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4137 | limFTCleanup(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4138 | } |
| 4139 | #endif |
| 4140 | |
| 4141 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4142 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4143 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 4144 | return eHAL_STATUS_SUCCESS; |
| 4145 | } |
| 4146 | else |
| 4147 | { |
| 4148 | return eHAL_STATUS_SUCCESS; |
| 4149 | } |
| 4150 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4151 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4152 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 4153 | sizeof(tSirMacAddr)); |
| 4154 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 4155 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 4156 | |
| 4157 | /* Update PE session ID*/ |
| 4158 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 4159 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 4160 | if(pMlmDisassocReq != NULL) |
| 4161 | { |
| 4162 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4163 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 4164 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 4165 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4166 | |
| 4167 | limPostSmeMessage(pMac, |
| 4168 | LIM_MLM_DISASSOC_CNF, |
| 4169 | (tANI_U32 *) &mlmDisassocCnf); |
| 4170 | return eHAL_STATUS_SUCCESS; |
| 4171 | } |
| 4172 | |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 4173 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4174 | { |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 4175 | if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 4176 | { |
| 4177 | tpSirTxBdStatus pTxBdStatus; |
| 4178 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 4179 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 4180 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 4181 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4182 | return limSendDisassocCnf(pMac); |
| 4183 | } |
| 4184 | |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 4185 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4186 | { |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 4187 | if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 4188 | { |
| 4189 | tpSirTxBdStatus pTxBdStatus; |
| 4190 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 4191 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 4192 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 4193 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4194 | return limSendDeauthCnf(pMac); |
| 4195 | } |
| 4196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | /** |
| 4198 | * \brief This function is called to send Disassociate frame. |
| 4199 | * |
| 4200 | * |
| 4201 | * \param pMac Pointer to Global MAC structure |
| 4202 | * |
| 4203 | * \param nReason Indicates the reason that need to be sent in |
| 4204 | * Disassociation frame |
| 4205 | * |
| 4206 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 4207 | * sent |
| 4208 | * |
| 4209 | * |
| 4210 | */ |
| 4211 | |
| 4212 | void |
| 4213 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 4214 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4215 | tSirMacAddr peer, |
| 4216 | tpPESession psessionEntry, |
| 4217 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | { |
| 4219 | tDot11fDisassociation frm; |
| 4220 | tANI_U8 *pFrame; |
| 4221 | tSirRetStatus nSirStatus; |
| 4222 | tpSirMacMgmtHdr pMacHdr; |
| 4223 | tANI_U32 nBytes, nPayload, nStatus; |
| 4224 | void *pPacket; |
| 4225 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4226 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4227 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4228 | if(NULL == psessionEntry) |
| 4229 | { |
| 4230 | return; |
| 4231 | } |
| 4232 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4233 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4234 | |
| 4235 | frm.Reason.code = nReason; |
| 4236 | |
| 4237 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 4238 | if ( DOT11F_FAILED( nStatus ) ) |
| 4239 | { |
| 4240 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4241 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4242 | nStatus ); |
| 4243 | // We'll fall back on the worst case scenario: |
| 4244 | nPayload = sizeof( tDot11fDisassociation ); |
| 4245 | } |
| 4246 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4247 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4248 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4249 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4250 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4251 | } |
| 4252 | |
| 4253 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4254 | |
| 4255 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4256 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4257 | ( void** ) &pPacket ); |
| 4258 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4259 | { |
| 4260 | 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] | 4261 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4262 | return; |
| 4263 | } |
| 4264 | |
| 4265 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4266 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4267 | |
| 4268 | // Next, we fill out the buffer descriptor: |
| 4269 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4270 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4271 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4272 | { |
| 4273 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4274 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4275 | nSirStatus ); |
| 4276 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4277 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4278 | return; // just allocated... |
| 4279 | } |
| 4280 | |
| 4281 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4282 | |
| 4283 | // Prepare the BSSID |
| 4284 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4285 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4286 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4287 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4288 | #endif |
| 4289 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4290 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4291 | sizeof(tSirMacMgmtHdr), |
| 4292 | nPayload, &nPayload ); |
| 4293 | if ( DOT11F_FAILED( nStatus ) ) |
| 4294 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4295 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4296 | nStatus ); |
| 4297 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4298 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4299 | return; // allocated! |
| 4300 | } |
| 4301 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4302 | { |
| 4303 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4304 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4305 | } |
| 4306 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4307 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4308 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4309 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4310 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4311 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4312 | |
| 4313 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4314 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4315 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4316 | ) |
| 4317 | { |
| 4318 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4319 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4320 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4321 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4322 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4323 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4324 | { |
| 4325 | /* This frame will be sent on air by firmware, |
| 4326 | which will ensure that this frame goes out |
| 4327 | even though DEL_STA is sent immediately */ |
| 4328 | /* Without this for DEL_STA command there is |
| 4329 | risk of flushing frame in BTQM queue without |
| 4330 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4331 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4332 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4333 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4334 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4335 | } |
| 4336 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4337 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4338 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4339 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4340 | psessionEntry->peSessionId, |
| 4341 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4342 | // Queue Disassociation frame in high priority WQ |
| 4343 | /* get the duration from the request */ |
| 4344 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4345 | HAL_TXRX_FRM_802_11_MGMT, |
| 4346 | ANI_TXDIR_TODS, |
| 4347 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4348 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 4349 | txFlag, |
| 4350 | pMac->lim.txBdToken++); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4351 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4352 | psessionEntry->peSessionId, |
| 4353 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4354 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4355 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4356 | if (tx_timer_change( |
| 4357 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4358 | != TX_SUCCESS) |
| 4359 | { |
| 4360 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4361 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4362 | return; |
| 4363 | } |
| 4364 | else if(TX_SUCCESS != tx_timer_activate( |
| 4365 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4366 | { |
| 4367 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4368 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4369 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4370 | return; |
| 4371 | } |
| 4372 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4373 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4374 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4375 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4376 | psessionEntry->peSessionId, |
| 4377 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4378 | // Queue Disassociation frame in high priority WQ |
| 4379 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4380 | HAL_TXRX_FRM_802_11_MGMT, |
| 4381 | ANI_TXDIR_TODS, |
| 4382 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4383 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4384 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4385 | psessionEntry->peSessionId, |
| 4386 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4387 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4388 | { |
| 4389 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4390 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4391 | nSirStatus ); |
| 4392 | //Pkt will be freed up by the callback |
| 4393 | return; |
| 4394 | } |
| 4395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4396 | } // End limSendDisassocMgmtFrame. |
| 4397 | |
| 4398 | /** |
| 4399 | * \brief This function is called to send a Deauthenticate frame |
| 4400 | * |
| 4401 | * |
| 4402 | * \param pMac Pointer to global MAC structure |
| 4403 | * |
| 4404 | * \param nReason Indicates the reason that need to be sent in the |
| 4405 | * Deauthenticate frame |
| 4406 | * |
| 4407 | * \param peeer address of the STA to which the frame is to be sent |
| 4408 | * |
| 4409 | * |
| 4410 | */ |
| 4411 | |
| 4412 | void |
| 4413 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4414 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4415 | tSirMacAddr peer, |
| 4416 | tpPESession psessionEntry, |
| 4417 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4418 | { |
| 4419 | tDot11fDeAuth frm; |
| 4420 | tANI_U8 *pFrame; |
| 4421 | tSirRetStatus nSirStatus; |
| 4422 | tpSirMacMgmtHdr pMacHdr; |
| 4423 | tANI_U32 nBytes, nPayload, nStatus; |
| 4424 | void *pPacket; |
| 4425 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4426 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4427 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4428 | #ifdef FEATURE_WLAN_TDLS |
| 4429 | tANI_U16 aid; |
| 4430 | tpDphHashNode pStaDs; |
| 4431 | #endif |
| 4432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4433 | if(NULL == psessionEntry) |
| 4434 | { |
| 4435 | return; |
| 4436 | } |
| 4437 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4438 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4439 | |
| 4440 | frm.Reason.code = nReason; |
| 4441 | |
| 4442 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4443 | if ( DOT11F_FAILED( nStatus ) ) |
| 4444 | { |
| 4445 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4446 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4447 | nStatus ); |
| 4448 | // We'll fall back on the worst case scenario: |
| 4449 | nPayload = sizeof( tDot11fDeAuth ); |
| 4450 | } |
| 4451 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4452 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4453 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4454 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4455 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4456 | } |
| 4457 | |
| 4458 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4459 | |
| 4460 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4461 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4462 | ( void** ) &pPacket ); |
| 4463 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4464 | { |
| 4465 | 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] | 4466 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4467 | return; |
| 4468 | } |
| 4469 | |
| 4470 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4471 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4472 | |
| 4473 | // Next, we fill out the buffer descriptor: |
| 4474 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4475 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4476 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4477 | { |
| 4478 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4479 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | nSirStatus ); |
| 4481 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4482 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4483 | return; // just allocated... |
| 4484 | } |
| 4485 | |
| 4486 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4487 | |
| 4488 | // Prepare the BSSID |
| 4489 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4490 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4491 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4492 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4493 | #endif |
| 4494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4495 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4496 | sizeof(tSirMacMgmtHdr), |
| 4497 | nPayload, &nPayload ); |
| 4498 | if ( DOT11F_FAILED( nStatus ) ) |
| 4499 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4500 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4501 | nStatus ); |
| 4502 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4503 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4504 | return; |
| 4505 | } |
| 4506 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4507 | { |
| 4508 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4509 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4510 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4511 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4512 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4513 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4514 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4515 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4516 | |
| 4517 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4518 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4519 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4520 | ) |
| 4521 | { |
| 4522 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4523 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4524 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4525 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4526 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4527 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4528 | { |
| 4529 | /* This frame will be sent on air by firmware, |
| 4530 | which will ensure that this frame goes out |
| 4531 | even though DEL_STA is sent immediately */ |
| 4532 | /* Without this for DEL_STA command there is |
| 4533 | risk of flushing frame in BTQM queue without |
| 4534 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4535 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4536 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4537 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4538 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4539 | } |
| 4540 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4541 | #ifdef FEATURE_WLAN_TDLS |
| 4542 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4543 | #endif |
| 4544 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4545 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4546 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4547 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4548 | psessionEntry->peSessionId, |
| 4549 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4550 | // Queue Disassociation frame in high priority WQ |
| 4551 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4552 | HAL_TXRX_FRM_802_11_MGMT, |
| 4553 | ANI_TXDIR_TODS, |
| 4554 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 4555 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag, |
| 4556 | pMac->lim.txBdToken++); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4557 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4558 | psessionEntry->peSessionId, |
| 4559 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4560 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4561 | { |
| 4562 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4563 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4564 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4565 | //Pkt will be freed up by the callback limTxComplete |
| 4566 | |
| 4567 | /*Call limProcessDeauthAckTimeout which will send |
| 4568 | * DeauthCnf for this frame |
| 4569 | */ |
| 4570 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4571 | return; |
| 4572 | } |
| 4573 | |
| 4574 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4575 | |
| 4576 | if (tx_timer_change( |
| 4577 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4578 | != TX_SUCCESS) |
| 4579 | { |
| 4580 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4581 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4582 | return; |
| 4583 | } |
| 4584 | else if(TX_SUCCESS != tx_timer_activate( |
| 4585 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4586 | { |
| 4587 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4588 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4589 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4590 | return; |
| 4591 | } |
| 4592 | } |
| 4593 | else |
| 4594 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4595 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4596 | psessionEntry->peSessionId, |
| 4597 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4598 | #ifdef FEATURE_WLAN_TDLS |
| 4599 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4600 | { |
| 4601 | // Queue Disassociation frame in high priority WQ |
| 4602 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4603 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4604 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4605 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4606 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4607 | } |
| 4608 | else |
| 4609 | { |
| 4610 | #endif |
| 4611 | // Queue Disassociation frame in high priority WQ |
| 4612 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4613 | HAL_TXRX_FRM_802_11_MGMT, |
| 4614 | ANI_TXDIR_TODS, |
| 4615 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4616 | limTxComplete, pFrame, txFlag ); |
| 4617 | #ifdef FEATURE_WLAN_TDLS |
| 4618 | } |
| 4619 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4620 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4621 | psessionEntry->peSessionId, |
| 4622 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4623 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4624 | { |
| 4625 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4626 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4627 | nSirStatus ); |
| 4628 | //Pkt will be freed up by the callback |
| 4629 | return; |
| 4630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4631 | } |
| 4632 | |
| 4633 | } // End limSendDeauthMgmtFrame. |
| 4634 | |
| 4635 | |
| 4636 | #ifdef ANI_SUPPORT_11H |
| 4637 | /** |
| 4638 | * \brief Send a Measurement Report Action frame |
| 4639 | * |
| 4640 | * |
| 4641 | * \param pMac Pointer to the global MAC structure |
| 4642 | * |
| 4643 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4644 | * |
| 4645 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4646 | * |
| 4647 | * |
| 4648 | */ |
| 4649 | |
| 4650 | tSirRetStatus |
| 4651 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4652 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4653 | tSirMacAddr peer) |
| 4654 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4655 | tDot11fMeasurementReport frm; |
| 4656 | tANI_U8 *pFrame; |
| 4657 | tSirRetStatus nSirStatus; |
| 4658 | tpSirMacMgmtHdr pMacHdr; |
| 4659 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4660 | void *pPacket; |
| 4661 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4662 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4663 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4664 | |
| 4665 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4666 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4667 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4668 | |
| 4669 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4670 | { |
| 4671 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4672 | nSirStatus = |
| 4673 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4674 | &frm.MeasurementReport ); |
| 4675 | break; |
| 4676 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4677 | nSirStatus = |
| 4678 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4679 | &frm.MeasurementReport ); |
| 4680 | break; |
| 4681 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4682 | nSirStatus = |
| 4683 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4684 | &frm.MeasurementReport ); |
| 4685 | break; |
| 4686 | default: |
| 4687 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4688 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4689 | pMeasReqFrame->measReqIE.measType ); |
| 4690 | return eSIR_FAILURE; |
| 4691 | } |
| 4692 | |
| 4693 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4694 | |
| 4695 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4696 | if ( DOT11F_FAILED( nStatus ) ) |
| 4697 | { |
| 4698 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4699 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4700 | nStatus ); |
| 4701 | // We'll fall back on the worst case scenario: |
| 4702 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4703 | } |
| 4704 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4705 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4706 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4707 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4708 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4709 | } |
| 4710 | |
| 4711 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4712 | |
| 4713 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4714 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4715 | { |
| 4716 | 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] | 4717 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4718 | return eSIR_FAILURE; |
| 4719 | } |
| 4720 | |
| 4721 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4722 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4723 | |
| 4724 | // Next, we fill out the buffer descriptor: |
| 4725 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4726 | SIR_MAC_MGMT_ACTION, peer); |
| 4727 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4728 | { |
| 4729 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4730 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4731 | nSirStatus ); |
| 4732 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4733 | return eSIR_FAILURE; // just allocated... |
| 4734 | } |
| 4735 | |
| 4736 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4737 | |
| 4738 | nCfg = 6; |
| 4739 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4740 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4741 | { |
| 4742 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4743 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4744 | nSirStatus ); |
| 4745 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4746 | return eSIR_FAILURE; // just allocated... |
| 4747 | } |
| 4748 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4749 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4750 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4751 | #endif |
| 4752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4753 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4754 | sizeof(tSirMacMgmtHdr), |
| 4755 | nPayload, &nPayload ); |
| 4756 | if ( DOT11F_FAILED( nStatus ) ) |
| 4757 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4758 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4759 | nStatus ); |
| 4760 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4761 | return eSIR_FAILURE; // allocated! |
| 4762 | } |
| 4763 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4764 | { |
| 4765 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4766 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4767 | } |
| 4768 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4769 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4770 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4771 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4772 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4773 | HAL_TXRX_FRM_802_11_MGMT, |
| 4774 | ANI_TXDIR_TODS, |
| 4775 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4776 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4777 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4778 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4779 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4780 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4781 | { |
| 4782 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4783 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4784 | nSirStatus ); |
| 4785 | //Pkt will be freed up by the callback |
| 4786 | return eSIR_FAILURE; // just allocated... |
| 4787 | } |
| 4788 | |
| 4789 | return eSIR_SUCCESS; |
| 4790 | |
| 4791 | } // End limSendMeasReportFrame. |
| 4792 | |
| 4793 | |
| 4794 | /** |
| 4795 | * \brief Send a TPC Request Action frame |
| 4796 | * |
| 4797 | * |
| 4798 | * \param pMac Pointer to the global MAC datastructure |
| 4799 | * |
| 4800 | * \param peer MAC address to which the frame should be sent |
| 4801 | * |
| 4802 | * |
| 4803 | */ |
| 4804 | |
| 4805 | void |
| 4806 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4807 | tSirMacAddr peer) |
| 4808 | { |
| 4809 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4810 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4811 | tSirRetStatus nSirStatus; |
| 4812 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4813 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4814 | void *pPacket; |
| 4815 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4816 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4817 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4818 | |
| 4819 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4820 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4821 | frm.DialogToken.token = 1; |
| 4822 | frm.TPCRequest.present = 1; |
| 4823 | |
| 4824 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4825 | if ( DOT11F_FAILED( nStatus ) ) |
| 4826 | { |
| 4827 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4828 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4829 | nStatus ); |
| 4830 | // We'll fall back on the worst case scenario: |
| 4831 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4832 | } |
| 4833 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4834 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4835 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4836 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4837 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4838 | } |
| 4839 | |
| 4840 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4841 | |
| 4842 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4843 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4844 | { |
| 4845 | 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] | 4846 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4847 | return; |
| 4848 | } |
| 4849 | |
| 4850 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4851 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4852 | |
| 4853 | // Next, we fill out the buffer descriptor: |
| 4854 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4855 | SIR_MAC_MGMT_ACTION, peer); |
| 4856 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4857 | { |
| 4858 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4859 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4860 | nSirStatus ); |
| 4861 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4862 | return; // just allocated... |
| 4863 | } |
| 4864 | |
| 4865 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4866 | |
| 4867 | nCfg = 6; |
| 4868 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4869 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4870 | { |
| 4871 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4872 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4873 | nSirStatus ); |
| 4874 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4875 | return; // just allocated... |
| 4876 | } |
| 4877 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4878 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4879 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4880 | #endif |
| 4881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4882 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4883 | sizeof(tSirMacMgmtHdr), |
| 4884 | nPayload, &nPayload ); |
| 4885 | if ( DOT11F_FAILED( nStatus ) ) |
| 4886 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4887 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4888 | nStatus ); |
| 4889 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4890 | return; // allocated! |
| 4891 | } |
| 4892 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4893 | { |
| 4894 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4895 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4896 | } |
| 4897 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4898 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4899 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4900 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4901 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4902 | HAL_TXRX_FRM_802_11_MGMT, |
| 4903 | ANI_TXDIR_TODS, |
| 4904 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4905 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4906 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4907 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4908 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4909 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4910 | { |
| 4911 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4912 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4913 | nSirStatus ); |
| 4914 | //Pkt will be freed up by the callback |
| 4915 | return; |
| 4916 | } |
| 4917 | |
| 4918 | } // End limSendTpcRequestFrame. |
| 4919 | |
| 4920 | |
| 4921 | /** |
| 4922 | * \brief Send a TPC Report Action frame |
| 4923 | * |
| 4924 | * |
| 4925 | * \param pMac Pointer to the global MAC datastructure |
| 4926 | * |
| 4927 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4928 | * |
| 4929 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4930 | * |
| 4931 | * |
| 4932 | */ |
| 4933 | |
| 4934 | tSirRetStatus |
| 4935 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4936 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4937 | tSirMacAddr peer) |
| 4938 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4939 | tDot11fTPCReport frm; |
| 4940 | tANI_U8 *pFrame; |
| 4941 | tSirRetStatus nSirStatus; |
| 4942 | tpSirMacMgmtHdr pMacHdr; |
| 4943 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4944 | void *pPacket; |
| 4945 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4946 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4947 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | |
| 4949 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4950 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4951 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4952 | |
| 4953 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4954 | // "misplaced this function, need to replace: |
| 4955 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4956 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4957 | frm.TPCReport.tx_power = 0; |
| 4958 | frm.TPCReport.link_margin = 0; |
| 4959 | frm.TPCReport.present = 1; |
| 4960 | |
| 4961 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4962 | if ( DOT11F_FAILED( nStatus ) ) |
| 4963 | { |
| 4964 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4965 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4966 | nStatus ); |
| 4967 | // We'll fall back on the worst case scenario: |
| 4968 | nPayload = sizeof( tDot11fTPCReport ); |
| 4969 | } |
| 4970 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4971 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4972 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4973 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4974 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4975 | } |
| 4976 | |
| 4977 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4978 | |
| 4979 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4980 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4981 | { |
| 4982 | 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] | 4983 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4984 | return eSIR_FAILURE; |
| 4985 | } |
| 4986 | |
| 4987 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4988 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4989 | |
| 4990 | // Next, we fill out the buffer descriptor: |
| 4991 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4992 | SIR_MAC_MGMT_ACTION, peer); |
| 4993 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4994 | { |
| 4995 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4996 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | nSirStatus ); |
| 4998 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4999 | return eSIR_FAILURE; // just allocated... |
| 5000 | } |
| 5001 | |
| 5002 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5003 | |
| 5004 | nCfg = 6; |
| 5005 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 5006 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5007 | { |
| 5008 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5009 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5010 | nSirStatus ); |
| 5011 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5012 | return eSIR_FAILURE; // just allocated... |
| 5013 | } |
| 5014 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5015 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5016 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5017 | #endif |
| 5018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5019 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 5020 | sizeof(tSirMacMgmtHdr), |
| 5021 | nPayload, &nPayload ); |
| 5022 | if ( DOT11F_FAILED( nStatus ) ) |
| 5023 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5024 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5025 | nStatus ); |
| 5026 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5027 | return eSIR_FAILURE; // allocated! |
| 5028 | } |
| 5029 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5030 | { |
| 5031 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5032 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5033 | } |
| 5034 | |
| 5035 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5036 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5037 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5038 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5040 | HAL_TXRX_FRM_802_11_MGMT, |
| 5041 | ANI_TXDIR_TODS, |
| 5042 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5043 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5044 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5045 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5046 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5047 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5048 | { |
| 5049 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5050 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5051 | nSirStatus ); |
| 5052 | //Pkt will be freed up by the callback |
| 5053 | return eSIR_FAILURE; // just allocated... |
| 5054 | } |
| 5055 | |
| 5056 | return eSIR_SUCCESS; |
| 5057 | |
| 5058 | } // End limSendTpcReportFrame. |
| 5059 | #endif //ANI_SUPPORT_11H |
| 5060 | |
| 5061 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5062 | /** |
| 5063 | * \brief Send a Channel Switch Announcement |
| 5064 | * |
| 5065 | * |
| 5066 | * \param pMac Pointer to the global MAC datastructure |
| 5067 | * |
| 5068 | * \param peer MAC address to which this frame will be sent |
| 5069 | * |
| 5070 | * \param nMode |
| 5071 | * |
| 5072 | * \param nNewChannel |
| 5073 | * |
| 5074 | * \param nCount |
| 5075 | * |
| 5076 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5077 | * |
| 5078 | * |
| 5079 | */ |
| 5080 | |
| 5081 | tSirRetStatus |
| 5082 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5083 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5084 | tANI_U8 nMode, |
| 5085 | tANI_U8 nNewChannel, |
| 5086 | tANI_U8 nCount, |
| 5087 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5088 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5089 | tDot11fChannelSwitch frm; |
| 5090 | tANI_U8 *pFrame; |
| 5091 | tSirRetStatus nSirStatus; |
| 5092 | tpSirMacMgmtHdr pMacHdr; |
| 5093 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5094 | void *pPacket; |
| 5095 | eHalStatus halstatus; |
| 5096 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5097 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5098 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5099 | |
| 5100 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5101 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5102 | frm.ChanSwitchAnn.switchMode = nMode; |
| 5103 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5104 | frm.ChanSwitchAnn.switchCount = nCount; |
| 5105 | frm.ChanSwitchAnn.present = 1; |
| 5106 | |
| 5107 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5108 | if ( DOT11F_FAILED( nStatus ) ) |
| 5109 | { |
| 5110 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5111 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5112 | nStatus ); |
| 5113 | // We'll fall back on the worst case scenario: |
| 5114 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5115 | } |
| 5116 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5117 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5118 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5119 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5120 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5121 | } |
| 5122 | |
| 5123 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5124 | |
| 5125 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5126 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5127 | { |
| 5128 | 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] | 5129 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5130 | return eSIR_FAILURE; |
| 5131 | } |
| 5132 | |
| 5133 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5134 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5135 | |
| 5136 | // Next, we fill out the buffer descriptor: |
| 5137 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5138 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5139 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5140 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5141 | (tANI_U8 *) psessionEntry->bssId, |
| 5142 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5143 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5144 | { |
| 5145 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5146 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | nSirStatus ); |
| 5148 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5149 | return eSIR_FAILURE; // just allocated... |
| 5150 | } |
| 5151 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5152 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5153 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5154 | |
| 5155 | nCfg = 6; |
| 5156 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 5157 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5158 | { |
| 5159 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5160 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5161 | nSirStatus ); |
| 5162 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5163 | return eSIR_FAILURE; // just allocated... |
| 5164 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5165 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5166 | |
| 5167 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5168 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5169 | #endif |
| 5170 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5172 | sizeof(tSirMacMgmtHdr), |
| 5173 | nPayload, &nPayload ); |
| 5174 | if ( DOT11F_FAILED( nStatus ) ) |
| 5175 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5176 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5177 | nStatus ); |
| 5178 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5179 | return eSIR_FAILURE; // allocated! |
| 5180 | } |
| 5181 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5182 | { |
| 5183 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5184 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5185 | } |
| 5186 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5187 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5188 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5189 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5190 | ) |
| 5191 | { |
| 5192 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5193 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5194 | |
| 5195 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5196 | psessionEntry->peSessionId, |
| 5197 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5198 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5199 | HAL_TXRX_FRM_802_11_MGMT, |
| 5200 | ANI_TXDIR_TODS, |
| 5201 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5202 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5203 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5204 | psessionEntry->peSessionId, |
| 5205 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5207 | { |
| 5208 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5209 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5210 | nSirStatus ); |
| 5211 | //Pkt will be freed up by the callback |
| 5212 | return eSIR_FAILURE; |
| 5213 | } |
| 5214 | |
| 5215 | return eSIR_SUCCESS; |
| 5216 | |
| 5217 | } // End limSendChannelSwitchMgmtFrame. |
| 5218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5219 | |
| 5220 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5221 | #ifdef WLAN_FEATURE_11AC |
| 5222 | tSirRetStatus |
| 5223 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 5224 | tSirMacAddr peer, |
| 5225 | tANI_U8 nMode, |
| 5226 | tpPESession psessionEntry ) |
| 5227 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5228 | tDot11fOperatingMode frm; |
| 5229 | tANI_U8 *pFrame; |
| 5230 | tSirRetStatus nSirStatus; |
| 5231 | tpSirMacMgmtHdr pMacHdr; |
| 5232 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 5233 | void *pPacket; |
| 5234 | eHalStatus halstatus; |
| 5235 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5236 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5237 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5238 | |
| 5239 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5240 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5241 | frm.OperatingMode.chanWidth = nMode; |
| 5242 | frm.OperatingMode.rxNSS = 0; |
| 5243 | frm.OperatingMode.rxNSSType = 0; |
| 5244 | |
| 5245 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5246 | if ( DOT11F_FAILED( nStatus ) ) |
| 5247 | { |
| 5248 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5249 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5250 | nStatus ); |
| 5251 | // We'll fall back on the worst case scenario: |
| 5252 | nPayload = sizeof( tDot11fOperatingMode); |
| 5253 | } |
| 5254 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5255 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5256 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5257 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5258 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5259 | } |
| 5260 | |
| 5261 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5262 | |
| 5263 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5264 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5265 | { |
| 5266 | 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] | 5267 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5268 | return eSIR_FAILURE; |
| 5269 | } |
| 5270 | |
| 5271 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5272 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5273 | |
| 5274 | |
| 5275 | // Next, we fill out the buffer descriptor: |
| 5276 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5277 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5278 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5279 | } else |
| 5280 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5281 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5282 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5283 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5284 | (tANI_U8 *) psessionEntry->bssId, |
| 5285 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5286 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5287 | { |
| 5288 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5289 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5290 | nSirStatus ); |
| 5291 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5292 | return eSIR_FAILURE; // just allocated... |
| 5293 | } |
| 5294 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5295 | sizeof(tSirMacMgmtHdr), |
| 5296 | nPayload, &nPayload ); |
| 5297 | if ( DOT11F_FAILED( nStatus ) ) |
| 5298 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5299 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5300 | nStatus ); |
| 5301 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5302 | return eSIR_FAILURE; // allocated! |
| 5303 | } |
| 5304 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5305 | { |
| 5306 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5307 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5308 | } |
| 5309 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5310 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5311 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5312 | ) |
| 5313 | { |
| 5314 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5315 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5316 | |
| 5317 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5318 | psessionEntry->peSessionId, |
| 5319 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5320 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5321 | HAL_TXRX_FRM_802_11_MGMT, |
| 5322 | ANI_TXDIR_TODS, |
| 5323 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5324 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5325 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5326 | psessionEntry->peSessionId, |
| 5327 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5328 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5329 | { |
| 5330 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5331 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5332 | nSirStatus ); |
| 5333 | //Pkt will be freed up by the callback |
| 5334 | return eSIR_FAILURE; |
| 5335 | } |
| 5336 | |
| 5337 | return eSIR_SUCCESS; |
| 5338 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5339 | |
| 5340 | /** |
| 5341 | * \brief Send a VHT Channel Switch Announcement |
| 5342 | * |
| 5343 | * |
| 5344 | * \param pMac Pointer to the global MAC datastructure |
| 5345 | * |
| 5346 | * \param peer MAC address to which this frame will be sent |
| 5347 | * |
| 5348 | * \param nChanWidth |
| 5349 | * |
| 5350 | * \param nNewChannel |
| 5351 | * |
| 5352 | * |
| 5353 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5354 | * |
| 5355 | * |
| 5356 | */ |
| 5357 | |
| 5358 | tSirRetStatus |
| 5359 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5360 | tSirMacAddr peer, |
| 5361 | tANI_U8 nChanWidth, |
| 5362 | tANI_U8 nNewChannel, |
| 5363 | tANI_U8 ncbMode, |
| 5364 | tpPESession psessionEntry ) |
| 5365 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5366 | tDot11fChannelSwitch frm; |
| 5367 | tANI_U8 *pFrame; |
| 5368 | tSirRetStatus nSirStatus; |
| 5369 | tpSirMacMgmtHdr pMacHdr; |
| 5370 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5371 | void *pPacket; |
| 5372 | eHalStatus halstatus; |
| 5373 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5374 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5375 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5376 | |
| 5377 | |
| 5378 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5379 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5380 | frm.ChanSwitchAnn.switchMode = 1; |
| 5381 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5382 | frm.ChanSwitchAnn.switchCount = 1; |
| 5383 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5384 | frm.ExtChanSwitchAnn.present = 1; |
| 5385 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5386 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5387 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5388 | frm.ChanSwitchAnn.present = 1; |
| 5389 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5390 | |
| 5391 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5392 | if ( DOT11F_FAILED( nStatus ) ) |
| 5393 | { |
| 5394 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5395 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5396 | nStatus ); |
| 5397 | // We'll fall back on the worst case scenario: |
| 5398 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5399 | } |
| 5400 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5401 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5402 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5403 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5404 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5405 | } |
| 5406 | |
| 5407 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5408 | |
| 5409 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5410 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5411 | { |
| 5412 | 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] | 5413 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5414 | return eSIR_FAILURE; |
| 5415 | } |
| 5416 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5417 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5418 | |
| 5419 | // Next, we fill out the buffer descriptor: |
| 5420 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5421 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5422 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5423 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5424 | (tANI_U8 *) psessionEntry->bssId, |
| 5425 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5426 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5427 | { |
| 5428 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5429 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5430 | nSirStatus ); |
| 5431 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5432 | return eSIR_FAILURE; // just allocated... |
| 5433 | } |
| 5434 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5435 | sizeof(tSirMacMgmtHdr), |
| 5436 | nPayload, &nPayload ); |
| 5437 | if ( DOT11F_FAILED( nStatus ) ) |
| 5438 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5439 | 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] | 5440 | nStatus ); |
| 5441 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5442 | return eSIR_FAILURE; // allocated! |
| 5443 | } |
| 5444 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5445 | { |
| 5446 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5447 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5448 | } |
| 5449 | |
| 5450 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5451 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5452 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5453 | ) |
| 5454 | { |
| 5455 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5456 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5457 | |
| 5458 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5459 | psessionEntry->peSessionId, |
| 5460 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5461 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5462 | HAL_TXRX_FRM_802_11_MGMT, |
| 5463 | ANI_TXDIR_TODS, |
| 5464 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5465 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5466 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5467 | psessionEntry->peSessionId, |
| 5468 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5469 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5470 | { |
| 5471 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5472 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5473 | nSirStatus ); |
| 5474 | //Pkt will be freed up by the callback |
| 5475 | return eSIR_FAILURE; |
| 5476 | } |
| 5477 | |
| 5478 | return eSIR_SUCCESS; |
| 5479 | |
| 5480 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5481 | |
| 5482 | |
| 5483 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5484 | #endif |
| 5485 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5486 | /** |
| 5487 | * \brief Send an ADDBA Req Action Frame to peer |
| 5488 | * |
| 5489 | * \sa limSendAddBAReq |
| 5490 | * |
| 5491 | * \param pMac The global tpAniSirGlobal object |
| 5492 | * |
| 5493 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5494 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5495 | * Frame to the peer |
| 5496 | * |
| 5497 | * \return eSIR_SUCCESS if setup completes successfully |
| 5498 | * eSIR_FAILURE is some problem is encountered |
| 5499 | */ |
| 5500 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5501 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5503 | tDot11fAddBAReq frmAddBAReq; |
| 5504 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5505 | tpSirMacMgmtHdr pMacHdr; |
| 5506 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5507 | tSirRetStatus statusCode; |
| 5508 | eHalStatus halStatus; |
| 5509 | void *pPacket; |
| 5510 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5511 | |
| 5512 | if(NULL == psessionEntry) |
| 5513 | { |
| 5514 | return eSIR_FAILURE; |
| 5515 | } |
| 5516 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5517 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5518 | |
| 5519 | // Category - 3 (BA) |
| 5520 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5521 | |
| 5522 | // Action - 0 (ADDBA Req) |
| 5523 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5524 | |
| 5525 | // FIXME - Dialog Token, generalize this... |
| 5526 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5527 | |
| 5528 | // Fill the ADDBA Parameter Set |
| 5529 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5530 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5531 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5532 | |
| 5533 | // BA timeout |
| 5534 | // 0 - indicates no BA timeout |
| 5535 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5536 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5537 | /* Send SSN whatever we get from FW. |
| 5538 | */ |
| 5539 | frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5540 | |
| 5541 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5542 | |
| 5543 | if( DOT11F_FAILED( nStatus )) |
| 5544 | { |
| 5545 | limLog( pMac, LOGW, |
| 5546 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5547 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | nStatus ); |
| 5549 | |
| 5550 | // We'll fall back on the worst case scenario: |
| 5551 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5552 | } |
| 5553 | else if( DOT11F_WARNED( nStatus )) |
| 5554 | { |
| 5555 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5556 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5557 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5558 | nStatus ); |
| 5559 | } |
| 5560 | |
| 5561 | // Add the MGMT header to frame length |
| 5562 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5563 | |
| 5564 | // Need to allocate a buffer for ADDBA AF |
| 5565 | if( eHAL_STATUS_SUCCESS != |
| 5566 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5567 | HAL_TXRX_FRM_802_11_MGMT, |
| 5568 | (tANI_U16) frameLen, |
| 5569 | (void **) &pAddBAReqBuffer, |
| 5570 | (void **) &pPacket ))) |
| 5571 | { |
| 5572 | // Log error |
| 5573 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5574 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5575 | frameLen, |
| 5576 | halStatus ); |
| 5577 | |
| 5578 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5579 | goto returnAfterError; |
| 5580 | } |
| 5581 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5582 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5583 | |
| 5584 | // Copy necessary info to BD |
| 5585 | if( eSIR_SUCCESS != |
| 5586 | (statusCode = limPopulateMacHeader( pMac, |
| 5587 | pAddBAReqBuffer, |
| 5588 | SIR_MAC_MGMT_FRAME, |
| 5589 | SIR_MAC_MGMT_ACTION, |
| 5590 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5591 | goto returnAfterError; |
| 5592 | |
| 5593 | // Update A3 with the BSSID |
| 5594 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5595 | |
| 5596 | #if 0 |
| 5597 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5598 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5599 | WNI_CFG_BSSID, |
| 5600 | (tANI_U8 *) pMacHdr->bssId, |
| 5601 | &cfgLen )) |
| 5602 | { |
| 5603 | limLog( pMac, LOGP, |
| 5604 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5605 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5606 | |
| 5607 | // FIXME - Need to convert to tSirRetStatus |
| 5608 | statusCode = eSIR_FAILURE; |
| 5609 | goto returnAfterError; |
| 5610 | } |
| 5611 | #endif//TO SUPPORT BT-AMP |
| 5612 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5613 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5614 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5615 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5616 | #endif |
| 5617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5618 | // Now, we're ready to "pack" the frames |
| 5619 | nStatus = dot11fPackAddBAReq( pMac, |
| 5620 | &frmAddBAReq, |
| 5621 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5622 | nPayload, |
| 5623 | &nPayload ); |
| 5624 | |
| 5625 | if( DOT11F_FAILED( nStatus )) |
| 5626 | { |
| 5627 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5628 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5629 | nStatus ); |
| 5630 | |
| 5631 | // FIXME - Need to convert to tSirRetStatus |
| 5632 | statusCode = eSIR_FAILURE; |
| 5633 | goto returnAfterError; |
| 5634 | } |
| 5635 | else if( DOT11F_WARNED( nStatus )) |
| 5636 | { |
| 5637 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5638 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5639 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5640 | } |
| 5641 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5642 | limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with" |
| 5643 | " tid = %d policy = %d buffsize = %d " |
| 5644 | " amsduSupported = %d"), |
| 5645 | MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr), |
| 5646 | frmAddBAReq.AddBAParameterSet.tid, |
| 5647 | frmAddBAReq.AddBAParameterSet.policy, |
| 5648 | frmAddBAReq.AddBAParameterSet.bufferSize, |
| 5649 | frmAddBAReq.AddBAParameterSet.amsduSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5650 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5651 | limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ), |
| 5652 | frmAddBAReq.BAStartingSequenceControl.ssn, |
| 5653 | frmAddBAReq.BAStartingSequenceControl.fragNumber); |
| 5654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5656 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5657 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5658 | ) |
| 5659 | { |
| 5660 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5661 | } |
| 5662 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5663 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5664 | psessionEntry->peSessionId, |
| 5665 | pMacHdr->fc.subType)); |
| 5666 | halStatus = halTxFrame( pMac, |
| 5667 | pPacket, |
| 5668 | (tANI_U16) frameLen, |
| 5669 | HAL_TXRX_FRM_802_11_MGMT, |
| 5670 | ANI_TXDIR_TODS, |
| 5671 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5672 | limTxComplete, |
| 5673 | pAddBAReqBuffer, txFlag ); |
| 5674 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5675 | psessionEntry->peSessionId, |
| 5676 | halStatus)); |
| 5677 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5678 | { |
| 5679 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5680 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5681 | halStatus ); |
| 5682 | |
| 5683 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5684 | statusCode = eSIR_FAILURE; |
| 5685 | //Pkt will be freed up by the callback |
| 5686 | return statusCode; |
| 5687 | } |
| 5688 | else |
| 5689 | return eSIR_SUCCESS; |
| 5690 | |
| 5691 | returnAfterError: |
| 5692 | |
| 5693 | // Release buffer, if allocated |
| 5694 | if( NULL != pAddBAReqBuffer ) |
| 5695 | palPktFree( pMac->hHdd, |
| 5696 | HAL_TXRX_FRM_802_11_MGMT, |
| 5697 | (void *) pAddBAReqBuffer, |
| 5698 | (void *) pPacket ); |
| 5699 | |
| 5700 | return statusCode; |
| 5701 | } |
| 5702 | |
| 5703 | /** |
| 5704 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5705 | * |
| 5706 | * \sa limSendAddBARsp |
| 5707 | * |
| 5708 | * \param pMac The global tpAniSirGlobal object |
| 5709 | * |
| 5710 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5711 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5712 | * Frame to the peer |
| 5713 | * |
| 5714 | * \return eSIR_SUCCESS if setup completes successfully |
| 5715 | * eSIR_FAILURE is some problem is encountered |
| 5716 | */ |
| 5717 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5718 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5719 | tpPESession psessionEntry) |
| 5720 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5721 | tDot11fAddBARsp frmAddBARsp; |
| 5722 | tANI_U8 *pAddBARspBuffer = NULL; |
| 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 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5732 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | return eSIR_FAILURE; |
| 5734 | } |
| 5735 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5736 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5737 | |
| 5738 | // Category - 3 (BA) |
| 5739 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5740 | // Action - 1 (ADDBA Rsp) |
| 5741 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5742 | |
| 5743 | // Should be same as the one we received in the ADDBA Req |
| 5744 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5745 | |
| 5746 | // ADDBA Req status |
| 5747 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5748 | |
| 5749 | // Fill the ADDBA Parameter Set as provided by caller |
| 5750 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5751 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5752 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5753 | |
| 5754 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5755 | { |
| 5756 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5757 | psessionEntry->amsduSupportedInBA; |
| 5758 | } |
| 5759 | else |
| 5760 | { |
| 5761 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5762 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5763 | |
| 5764 | // BA timeout |
| 5765 | // 0 - indicates no BA timeout |
| 5766 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5767 | |
| 5768 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5769 | |
| 5770 | if( DOT11F_FAILED( nStatus )) |
| 5771 | { |
| 5772 | limLog( pMac, LOGW, |
| 5773 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5774 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | nStatus ); |
| 5776 | |
| 5777 | // We'll fall back on the worst case scenario: |
| 5778 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5779 | } |
| 5780 | else if( DOT11F_WARNED( nStatus )) |
| 5781 | { |
| 5782 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5783 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5784 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | nStatus ); |
| 5786 | } |
| 5787 | |
| 5788 | // Need to allocate a buffer for ADDBA AF |
| 5789 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5790 | |
| 5791 | // Allocate shared memory |
| 5792 | if( eHAL_STATUS_SUCCESS != |
| 5793 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5794 | HAL_TXRX_FRM_802_11_MGMT, |
| 5795 | (tANI_U16) frameLen, |
| 5796 | (void **) &pAddBARspBuffer, |
| 5797 | (void **) &pPacket ))) |
| 5798 | { |
| 5799 | // Log error |
| 5800 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5801 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5802 | frameLen, |
| 5803 | halStatus ); |
| 5804 | |
| 5805 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5806 | goto returnAfterError; |
| 5807 | } |
| 5808 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5809 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5810 | |
| 5811 | // Copy necessary info to BD |
| 5812 | if( eSIR_SUCCESS != |
| 5813 | (statusCode = limPopulateMacHeader( pMac, |
| 5814 | pAddBARspBuffer, |
| 5815 | SIR_MAC_MGMT_FRAME, |
| 5816 | SIR_MAC_MGMT_ACTION, |
| 5817 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5818 | goto returnAfterError; |
| 5819 | |
| 5820 | // Update A3 with the BSSID |
| 5821 | |
| 5822 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5823 | |
| 5824 | #if 0 |
| 5825 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5826 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5827 | WNI_CFG_BSSID, |
| 5828 | (tANI_U8 *) pMacHdr->bssId, |
| 5829 | &cfgLen )) |
| 5830 | { |
| 5831 | limLog( pMac, LOGP, |
| 5832 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5833 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5834 | |
| 5835 | // FIXME - Need to convert to tSirRetStatus |
| 5836 | statusCode = eSIR_FAILURE; |
| 5837 | goto returnAfterError; |
| 5838 | } |
| 5839 | #endif // TO SUPPORT BT-AMP |
| 5840 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5841 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5842 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5843 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5844 | #endif |
| 5845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | // Now, we're ready to "pack" the frames |
| 5847 | nStatus = dot11fPackAddBARsp( pMac, |
| 5848 | &frmAddBARsp, |
| 5849 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5850 | nPayload, |
| 5851 | &nPayload ); |
| 5852 | |
| 5853 | if( DOT11F_FAILED( nStatus )) |
| 5854 | { |
| 5855 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5856 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5857 | nStatus ); |
| 5858 | |
| 5859 | // FIXME - Need to convert to tSirRetStatus |
| 5860 | statusCode = eSIR_FAILURE; |
| 5861 | goto returnAfterError; |
| 5862 | } |
| 5863 | else if( DOT11F_WARNED( nStatus )) |
| 5864 | { |
| 5865 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5866 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5867 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5868 | } |
| 5869 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5870 | limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with" |
| 5871 | " tid = %d policy = %d buffsize = %d" |
| 5872 | " amsduSupported = %d status %d"), |
| 5873 | MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr), |
| 5874 | frmAddBARsp.AddBAParameterSet.tid, |
| 5875 | frmAddBARsp.AddBAParameterSet.policy, |
| 5876 | frmAddBARsp.AddBAParameterSet.bufferSize, |
| 5877 | frmAddBARsp.AddBAParameterSet.amsduSupported, |
| 5878 | frmAddBARsp.Status.status); |
| 5879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5880 | |
| 5881 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5882 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5883 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5884 | ) |
| 5885 | { |
| 5886 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5887 | } |
| 5888 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5889 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5890 | psessionEntry->peSessionId, |
| 5891 | pMacHdr->fc.subType)); |
| 5892 | halStatus = halTxFrame( pMac, |
| 5893 | pPacket, |
| 5894 | (tANI_U16) frameLen, |
| 5895 | HAL_TXRX_FRM_802_11_MGMT, |
| 5896 | ANI_TXDIR_TODS, |
| 5897 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5898 | limTxComplete, |
| 5899 | pAddBARspBuffer, txFlag ); |
| 5900 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5901 | psessionEntry->peSessionId, |
| 5902 | halStatus)); |
| 5903 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5904 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5905 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5906 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5907 | halStatus ); |
| 5908 | |
| 5909 | // FIXME - HAL error codes are different from PE error |
| 5910 | // codes!! And, this routine is returning tSirRetStatus |
| 5911 | statusCode = eSIR_FAILURE; |
| 5912 | //Pkt will be freed up by the callback |
| 5913 | return statusCode; |
| 5914 | } |
| 5915 | else |
| 5916 | return eSIR_SUCCESS; |
| 5917 | |
| 5918 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5919 | // Release buffer, if allocated |
| 5920 | if( NULL != pAddBARspBuffer ) |
| 5921 | palPktFree( pMac->hHdd, |
| 5922 | HAL_TXRX_FRM_802_11_MGMT, |
| 5923 | (void *) pAddBARspBuffer, |
| 5924 | (void *) pPacket ); |
| 5925 | |
| 5926 | return statusCode; |
| 5927 | } |
| 5928 | |
| 5929 | /** |
| 5930 | * \brief Send a DELBA Indication Action Frame to peer |
| 5931 | * |
| 5932 | * \sa limSendDelBAInd |
| 5933 | * |
| 5934 | * \param pMac The global tpAniSirGlobal object |
| 5935 | * |
| 5936 | * \param peerMacAddr MAC Address of peer |
| 5937 | * |
| 5938 | * \param reasonCode Reason for the DELBA notification |
| 5939 | * |
| 5940 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5941 | * This identifies the TID for which the BA session is |
| 5942 | * being deleted. |
| 5943 | * |
| 5944 | * \return eSIR_SUCCESS if setup completes successfully |
| 5945 | * eSIR_FAILURE is some problem is encountered |
| 5946 | */ |
| 5947 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5948 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5949 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5950 | tDot11fDelBAInd frmDelBAInd; |
| 5951 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5952 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5953 | tpSirMacMgmtHdr pMacHdr; |
| 5954 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5955 | tSirRetStatus statusCode; |
| 5956 | eHalStatus halStatus; |
| 5957 | void *pPacket; |
| 5958 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | |
| 5960 | if(NULL == psessionEntry) |
| 5961 | { |
| 5962 | return eSIR_FAILURE; |
| 5963 | } |
| 5964 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5965 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5966 | |
| 5967 | // Category - 3 (BA) |
| 5968 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5969 | // Action - 2 (DELBA) |
| 5970 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5971 | |
| 5972 | // Fill the DELBA Parameter Set as provided by caller |
| 5973 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5974 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5975 | |
| 5976 | // BA Starting Sequence Number |
| 5977 | // Fragment number will always be zero |
| 5978 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5979 | |
| 5980 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5981 | |
| 5982 | if( DOT11F_FAILED( nStatus )) |
| 5983 | { |
| 5984 | limLog( pMac, LOGW, |
| 5985 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5986 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | nStatus ); |
| 5988 | |
| 5989 | // We'll fall back on the worst case scenario: |
| 5990 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5991 | } |
| 5992 | else if( DOT11F_WARNED( nStatus )) |
| 5993 | { |
| 5994 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5995 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5996 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5997 | nStatus ); |
| 5998 | } |
| 5999 | |
| 6000 | // Add the MGMT header to frame length |
| 6001 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6002 | |
| 6003 | // Allocate shared memory |
| 6004 | if( eHAL_STATUS_SUCCESS != |
| 6005 | (halStatus = palPktAlloc( pMac->hHdd, |
| 6006 | HAL_TXRX_FRM_802_11_MGMT, |
| 6007 | (tANI_U16) frameLen, |
| 6008 | (void **) &pDelBAIndBuffer, |
| 6009 | (void **) &pPacket ))) |
| 6010 | { |
| 6011 | // Log error |
| 6012 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6013 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | frameLen, |
| 6015 | halStatus ); |
| 6016 | |
| 6017 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 6018 | goto returnAfterError; |
| 6019 | } |
| 6020 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6021 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6022 | |
| 6023 | // Copy necessary info to BD |
| 6024 | if( eSIR_SUCCESS != |
| 6025 | (statusCode = limPopulateMacHeader( pMac, |
| 6026 | pDelBAIndBuffer, |
| 6027 | SIR_MAC_MGMT_FRAME, |
| 6028 | SIR_MAC_MGMT_ACTION, |
| 6029 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 6030 | goto returnAfterError; |
| 6031 | |
| 6032 | // Update A3 with the BSSID |
| 6033 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 6034 | |
| 6035 | #if 0 |
| 6036 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 6037 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 6038 | WNI_CFG_BSSID, |
| 6039 | (tANI_U8 *) pMacHdr->bssId, |
| 6040 | &cfgLen )) |
| 6041 | { |
| 6042 | limLog( pMac, LOGP, |
| 6043 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6044 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6045 | |
| 6046 | // FIXME - Need to convert to tSirRetStatus |
| 6047 | statusCode = eSIR_FAILURE; |
| 6048 | goto returnAfterError; |
| 6049 | } |
| 6050 | #endif //TO SUPPORT BT-AMP |
| 6051 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 6052 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6053 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6054 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6055 | #endif |
| 6056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6057 | // Now, we're ready to "pack" the frames |
| 6058 | nStatus = dot11fPackDelBAInd( pMac, |
| 6059 | &frmDelBAInd, |
| 6060 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 6061 | nPayload, |
| 6062 | &nPayload ); |
| 6063 | |
| 6064 | if( DOT11F_FAILED( nStatus )) |
| 6065 | { |
| 6066 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6067 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6068 | nStatus ); |
| 6069 | |
| 6070 | // FIXME - Need to convert to tSirRetStatus |
| 6071 | statusCode = eSIR_FAILURE; |
| 6072 | goto returnAfterError; |
| 6073 | } |
| 6074 | else if( DOT11F_WARNED( nStatus )) |
| 6075 | { |
| 6076 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6077 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 6078 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6079 | } |
| 6080 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 6081 | limLog( pMac, LOG1, |
| 6082 | FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d" |
| 6083 | " initiator = %d reason = %d" ), |
| 6084 | MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr), |
| 6085 | frmDelBAInd.DelBAParameterSet.tid, |
| 6086 | frmDelBAInd.DelBAParameterSet.initiator, |
| 6087 | frmDelBAInd.Reason.code); |
| 6088 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6089 | |
| 6090 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6091 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6092 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6093 | ) |
| 6094 | { |
| 6095 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6096 | } |
| 6097 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6098 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6099 | psessionEntry->peSessionId, |
| 6100 | pMacHdr->fc.subType)); |
| 6101 | halStatus = halTxFrame( pMac, |
| 6102 | pPacket, |
| 6103 | (tANI_U16) frameLen, |
| 6104 | HAL_TXRX_FRM_802_11_MGMT, |
| 6105 | ANI_TXDIR_TODS, |
| 6106 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6107 | limTxComplete, |
| 6108 | pDelBAIndBuffer, txFlag ); |
| 6109 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6110 | psessionEntry->peSessionId, |
| 6111 | halStatus)); |
| 6112 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6113 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6114 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6115 | statusCode = eSIR_FAILURE; |
| 6116 | //Pkt will be freed up by the callback |
| 6117 | return statusCode; |
| 6118 | } |
| 6119 | else |
| 6120 | return eSIR_SUCCESS; |
| 6121 | |
| 6122 | returnAfterError: |
| 6123 | |
| 6124 | // Release buffer, if allocated |
| 6125 | if( NULL != pDelBAIndBuffer ) |
| 6126 | palPktFree( pMac->hHdd, |
| 6127 | HAL_TXRX_FRM_802_11_MGMT, |
| 6128 | (void *) pDelBAIndBuffer, |
| 6129 | (void *) pPacket ); |
| 6130 | |
| 6131 | return statusCode; |
| 6132 | } |
| 6133 | |
| 6134 | #if defined WLAN_FEATURE_VOWIFI |
| 6135 | |
| 6136 | /** |
| 6137 | * \brief Send a Neighbor Report Request Action frame |
| 6138 | * |
| 6139 | * |
| 6140 | * \param pMac Pointer to the global MAC structure |
| 6141 | * |
| 6142 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 6143 | * |
| 6144 | * \param peer mac address of peer station. |
| 6145 | * |
| 6146 | * \param psessionEntry address of session entry. |
| 6147 | * |
| 6148 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6149 | * |
| 6150 | * |
| 6151 | */ |
| 6152 | |
| 6153 | tSirRetStatus |
| 6154 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 6155 | tpSirMacNeighborReportReq pNeighborReq, |
| 6156 | tSirMacAddr peer, |
| 6157 | tpPESession psessionEntry |
| 6158 | ) |
| 6159 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6160 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6161 | tDot11fNeighborReportRequest frm; |
| 6162 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6163 | tpSirMacMgmtHdr pMacHdr; |
| 6164 | tANI_U32 nBytes, nPayload, nStatus; |
| 6165 | void *pPacket; |
| 6166 | eHalStatus halstatus; |
| 6167 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6168 | |
| 6169 | if ( psessionEntry == NULL ) |
| 6170 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6171 | 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] | 6172 | return eSIR_FAILURE; |
| 6173 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6174 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6175 | |
| 6176 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6177 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 6178 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 6179 | |
| 6180 | |
| 6181 | if( pNeighborReq->ssid_present ) |
| 6182 | { |
| 6183 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 6184 | } |
| 6185 | |
| 6186 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 6187 | if ( DOT11F_FAILED( nStatus ) ) |
| 6188 | { |
| 6189 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6190 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6191 | nStatus ); |
| 6192 | // We'll fall back on the worst case scenario: |
| 6193 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 6194 | } |
| 6195 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6196 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6197 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6198 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6199 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6200 | } |
| 6201 | |
| 6202 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6203 | |
| 6204 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6205 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6206 | { |
| 6207 | 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] | 6208 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6209 | return eSIR_FAILURE; |
| 6210 | } |
| 6211 | |
| 6212 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6213 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6214 | |
| 6215 | // Copy necessary info to BD |
| 6216 | if( eSIR_SUCCESS != |
| 6217 | (statusCode = limPopulateMacHeader( pMac, |
| 6218 | pFrame, |
| 6219 | SIR_MAC_MGMT_FRAME, |
| 6220 | SIR_MAC_MGMT_ACTION, |
| 6221 | peer, psessionEntry->selfMacAddr))) |
| 6222 | goto returnAfterError; |
| 6223 | |
| 6224 | // Update A3 with the BSSID |
| 6225 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6226 | |
| 6227 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6228 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6229 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6230 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6231 | #endif |
| 6232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6233 | // Now, we're ready to "pack" the frames |
| 6234 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 6235 | &frm, |
| 6236 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6237 | nPayload, |
| 6238 | &nPayload ); |
| 6239 | |
| 6240 | if( DOT11F_FAILED( nStatus )) |
| 6241 | { |
| 6242 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6243 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6244 | nStatus ); |
| 6245 | |
| 6246 | // FIXME - Need to convert to tSirRetStatus |
| 6247 | statusCode = eSIR_FAILURE; |
| 6248 | goto returnAfterError; |
| 6249 | } |
| 6250 | else if( DOT11F_WARNED( nStatus )) |
| 6251 | { |
| 6252 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6253 | FL( "There were warnings while packing Neighbor Report " |
| 6254 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6255 | } |
| 6256 | |
| 6257 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6258 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6259 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6260 | |
| 6261 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6263 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6264 | ) |
| 6265 | { |
| 6266 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6267 | } |
| 6268 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6269 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6270 | psessionEntry->peSessionId, |
| 6271 | pMacHdr->fc.subType)); |
| 6272 | halstatus = halTxFrame( pMac, |
| 6273 | pPacket, |
| 6274 | (tANI_U16) nBytes, |
| 6275 | HAL_TXRX_FRM_802_11_MGMT, |
| 6276 | ANI_TXDIR_TODS, |
| 6277 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6278 | limTxComplete, |
| 6279 | pFrame, txFlag ); |
| 6280 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6281 | psessionEntry->peSessionId, |
| 6282 | halstatus)); |
| 6283 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6285 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6286 | statusCode = eSIR_FAILURE; |
| 6287 | //Pkt will be freed up by the callback |
| 6288 | return statusCode; |
| 6289 | } |
| 6290 | else |
| 6291 | return eSIR_SUCCESS; |
| 6292 | |
| 6293 | returnAfterError: |
| 6294 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6295 | |
| 6296 | return statusCode; |
| 6297 | } // End limSendNeighborReportRequestFrame. |
| 6298 | |
| 6299 | /** |
| 6300 | * \brief Send a Link Report Action frame |
| 6301 | * |
| 6302 | * |
| 6303 | * \param pMac Pointer to the global MAC structure |
| 6304 | * |
| 6305 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6306 | * |
| 6307 | * \param peer mac address of peer station. |
| 6308 | * |
| 6309 | * \param psessionEntry address of session entry. |
| 6310 | * |
| 6311 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6312 | * |
| 6313 | * |
| 6314 | */ |
| 6315 | |
| 6316 | tSirRetStatus |
| 6317 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6318 | tpSirMacLinkReport pLinkReport, |
| 6319 | tSirMacAddr peer, |
| 6320 | tpPESession psessionEntry |
| 6321 | ) |
| 6322 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6323 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6324 | tDot11fLinkMeasurementReport frm; |
| 6325 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6326 | tpSirMacMgmtHdr pMacHdr; |
| 6327 | tANI_U32 nBytes, nPayload, nStatus; |
| 6328 | void *pPacket; |
| 6329 | eHalStatus halstatus; |
| 6330 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6331 | |
| 6332 | |
| 6333 | if ( psessionEntry == NULL ) |
| 6334 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6335 | 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] | 6336 | return eSIR_FAILURE; |
| 6337 | } |
| 6338 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6339 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6340 | |
| 6341 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6342 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6343 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6344 | |
| 6345 | |
| 6346 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6347 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6348 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6349 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6350 | //such case this way than changing the frame parser. |
| 6351 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6352 | frm.TPCEleLen.TPCLen = 2; |
| 6353 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6354 | frm.LinkMargin.linkMargin = 0; |
| 6355 | |
| 6356 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6357 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6358 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6359 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6360 | |
| 6361 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6362 | if ( DOT11F_FAILED( nStatus ) ) |
| 6363 | { |
| 6364 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6365 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6366 | nStatus ); |
| 6367 | // We'll fall back on the worst case scenario: |
| 6368 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6369 | } |
| 6370 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6371 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6372 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6373 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6374 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6375 | } |
| 6376 | |
| 6377 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6378 | |
| 6379 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6380 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6381 | { |
| 6382 | 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] | 6383 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6384 | return eSIR_FAILURE; |
| 6385 | } |
| 6386 | |
| 6387 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6388 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6389 | |
| 6390 | // Copy necessary info to BD |
| 6391 | if( eSIR_SUCCESS != |
| 6392 | (statusCode = limPopulateMacHeader( pMac, |
| 6393 | pFrame, |
| 6394 | SIR_MAC_MGMT_FRAME, |
| 6395 | SIR_MAC_MGMT_ACTION, |
| 6396 | peer, psessionEntry->selfMacAddr))) |
| 6397 | goto returnAfterError; |
| 6398 | |
| 6399 | // Update A3 with the BSSID |
| 6400 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6401 | |
| 6402 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6403 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6404 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6405 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6406 | #endif |
| 6407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | // Now, we're ready to "pack" the frames |
| 6409 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6410 | &frm, |
| 6411 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6412 | nPayload, |
| 6413 | &nPayload ); |
| 6414 | |
| 6415 | if( DOT11F_FAILED( nStatus )) |
| 6416 | { |
| 6417 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6418 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | nStatus ); |
| 6420 | |
| 6421 | // FIXME - Need to convert to tSirRetStatus |
| 6422 | statusCode = eSIR_FAILURE; |
| 6423 | goto returnAfterError; |
| 6424 | } |
| 6425 | else if( DOT11F_WARNED( nStatus )) |
| 6426 | { |
| 6427 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6428 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6429 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6430 | } |
| 6431 | |
| 6432 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6433 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6434 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6435 | |
| 6436 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6437 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6438 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6439 | ) |
| 6440 | { |
| 6441 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6442 | } |
| 6443 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6444 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6445 | psessionEntry->peSessionId, |
| 6446 | pMacHdr->fc.subType)); |
| 6447 | halstatus = halTxFrame( pMac, |
| 6448 | pPacket, |
| 6449 | (tANI_U16) nBytes, |
| 6450 | HAL_TXRX_FRM_802_11_MGMT, |
| 6451 | ANI_TXDIR_TODS, |
| 6452 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6453 | limTxComplete, |
| 6454 | pFrame, txFlag ); |
| 6455 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6456 | psessionEntry->peSessionId, |
| 6457 | halstatus)); |
| 6458 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6459 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6460 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6461 | statusCode = eSIR_FAILURE; |
| 6462 | //Pkt will be freed up by the callback |
| 6463 | return statusCode; |
| 6464 | } |
| 6465 | else |
| 6466 | return eSIR_SUCCESS; |
| 6467 | |
| 6468 | returnAfterError: |
| 6469 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6470 | |
| 6471 | return statusCode; |
| 6472 | } // End limSendLinkReportActionFrame. |
| 6473 | |
| 6474 | /** |
| 6475 | * \brief Send a Beacon Report Action frame |
| 6476 | * |
| 6477 | * |
| 6478 | * \param pMac Pointer to the global MAC structure |
| 6479 | * |
| 6480 | * \param dialog_token dialog token to be used in the action frame. |
| 6481 | * |
| 6482 | * \param num_report number of reports in pRRMReport. |
| 6483 | * |
| 6484 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6485 | * |
| 6486 | * \param peer mac address of peer station. |
| 6487 | * |
| 6488 | * \param psessionEntry address of session entry. |
| 6489 | * |
| 6490 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6491 | * |
| 6492 | * |
| 6493 | */ |
| 6494 | |
| 6495 | tSirRetStatus |
| 6496 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6497 | tANI_U8 dialog_token, |
| 6498 | tANI_U8 num_report, |
| 6499 | tpSirMacRadioMeasureReport pRRMReport, |
| 6500 | tSirMacAddr peer, |
| 6501 | tpPESession psessionEntry |
| 6502 | ) |
| 6503 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6504 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6505 | tANI_U8 *pFrame; |
| 6506 | tpSirMacMgmtHdr pMacHdr; |
| 6507 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6508 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6509 | eHalStatus halstatus; |
| 6510 | tANI_U8 i; |
| 6511 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6512 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6513 | tDot11fRadioMeasurementReport *frm = |
| 6514 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6515 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6516 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6517 | return eSIR_FAILURE; |
| 6518 | } |
| 6519 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6520 | if ( psessionEntry == NULL ) |
| 6521 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6522 | 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] | 6523 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6524 | return eSIR_FAILURE; |
| 6525 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6526 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6527 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6528 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6529 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6530 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6531 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6532 | 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] | 6533 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6534 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6535 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6536 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6537 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6538 | 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] | 6539 | switch( pRRMReport[i].type ) |
| 6540 | { |
| 6541 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6542 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6543 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6544 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6545 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6546 | break; |
| 6547 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6548 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6549 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6550 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6551 | break; |
| 6552 | } |
| 6553 | } |
| 6554 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6555 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6556 | if ( DOT11F_FAILED( nStatus ) ) |
| 6557 | { |
| 6558 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6559 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6560 | nStatus ); |
| 6561 | // We'll fall back on the worst case scenario: |
| 6562 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6563 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6564 | return eSIR_FAILURE; |
| 6565 | } |
| 6566 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6567 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6568 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6569 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6570 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6571 | } |
| 6572 | |
| 6573 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6574 | |
| 6575 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6576 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6577 | { |
| 6578 | 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] | 6579 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6580 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6581 | return eSIR_FAILURE; |
| 6582 | } |
| 6583 | |
| 6584 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6585 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6586 | |
| 6587 | // Copy necessary info to BD |
| 6588 | if( eSIR_SUCCESS != |
| 6589 | (statusCode = limPopulateMacHeader( pMac, |
| 6590 | pFrame, |
| 6591 | SIR_MAC_MGMT_FRAME, |
| 6592 | SIR_MAC_MGMT_ACTION, |
| 6593 | peer, psessionEntry->selfMacAddr))) |
| 6594 | goto returnAfterError; |
| 6595 | |
| 6596 | // Update A3 with the BSSID |
| 6597 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6598 | |
| 6599 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6600 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6601 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6602 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6603 | #endif |
| 6604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | // Now, we're ready to "pack" the frames |
| 6606 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6607 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6608 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6609 | nPayload, |
| 6610 | &nPayload ); |
| 6611 | |
| 6612 | if( DOT11F_FAILED( nStatus )) |
| 6613 | { |
| 6614 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6615 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | nStatus ); |
| 6617 | |
| 6618 | // FIXME - Need to convert to tSirRetStatus |
| 6619 | statusCode = eSIR_FAILURE; |
| 6620 | goto returnAfterError; |
| 6621 | } |
| 6622 | else if( DOT11F_WARNED( nStatus )) |
| 6623 | { |
| 6624 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6625 | FL( "There were warnings while packing Radio " |
| 6626 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6627 | } |
| 6628 | |
| 6629 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6630 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6632 | |
| 6633 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6634 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6635 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | ) |
| 6637 | { |
| 6638 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6639 | } |
| 6640 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6641 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6642 | psessionEntry->peSessionId, |
| 6643 | pMacHdr->fc.subType)); |
| 6644 | halstatus = halTxFrame( pMac, |
| 6645 | pPacket, |
| 6646 | (tANI_U16) nBytes, |
| 6647 | HAL_TXRX_FRM_802_11_MGMT, |
| 6648 | ANI_TXDIR_TODS, |
| 6649 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6650 | limTxComplete, |
| 6651 | pFrame, txFlag ); |
| 6652 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6653 | psessionEntry->peSessionId, |
| 6654 | halstatus)); |
| 6655 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6656 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6657 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6658 | statusCode = eSIR_FAILURE; |
| 6659 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6660 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6661 | return statusCode; |
| 6662 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6663 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6664 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6666 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | |
| 6668 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6669 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6670 | 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] | 6671 | return statusCode; |
| 6672 | } // End limSendBeaconReportActionFrame. |
| 6673 | |
| 6674 | #endif |
| 6675 | |
| 6676 | #ifdef WLAN_FEATURE_11W |
| 6677 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6678 | * \brief Send SA query request action frame to peer |
| 6679 | * |
| 6680 | * \sa limSendSaQueryRequestFrame |
| 6681 | * |
| 6682 | * |
| 6683 | * \param pMac The global tpAniSirGlobal object |
| 6684 | * |
| 6685 | * \param transId Transaction identifier |
| 6686 | * |
| 6687 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6688 | * |
| 6689 | * \param psessionEntry The PE session entry |
| 6690 | * |
| 6691 | * \return eSIR_SUCCESS if setup completes successfully |
| 6692 | * eSIR_FAILURE is some problem is encountered |
| 6693 | */ |
| 6694 | |
| 6695 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6696 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6697 | { |
| 6698 | |
| 6699 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6700 | tANI_U8 *pFrame; |
| 6701 | tSirRetStatus nSirStatus; |
| 6702 | tpSirMacMgmtHdr pMacHdr; |
| 6703 | tANI_U32 nBytes, nPayload, nStatus; |
| 6704 | void *pPacket; |
| 6705 | eHalStatus halstatus; |
| 6706 | tANI_U8 txFlag = 0; |
| 6707 | |
| 6708 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6709 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6710 | /* 11w action field is : |
| 6711 | action: 0 --> SA Query Request action frame |
| 6712 | action: 1 --> SA Query Response action frame */ |
| 6713 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6714 | /* 11w SA Query Request transId */ |
| 6715 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6716 | |
| 6717 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6718 | if ( DOT11F_FAILED( nStatus ) ) |
| 6719 | { |
| 6720 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6721 | "for an SA Query Request (0x%08x)."), |
| 6722 | nStatus ); |
| 6723 | // We'll fall back on the worst case scenario: |
| 6724 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6725 | } |
| 6726 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6727 | { |
| 6728 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6729 | "the packed size for an SA Query Request" |
| 6730 | " (0x%08x)."), nStatus ); |
| 6731 | } |
| 6732 | |
| 6733 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6734 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6735 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6736 | { |
| 6737 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6738 | "action frame"), nBytes ); |
| 6739 | return eSIR_FAILURE; |
| 6740 | } |
| 6741 | |
| 6742 | // Paranoia: |
| 6743 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6744 | |
| 6745 | // Copy necessary info to BD |
| 6746 | nSirStatus = limPopulateMacHeader( pMac, |
| 6747 | pFrame, |
| 6748 | SIR_MAC_MGMT_FRAME, |
| 6749 | SIR_MAC_MGMT_ACTION, |
| 6750 | peer, psessionEntry->selfMacAddr ); |
| 6751 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6752 | goto returnAfterError; |
| 6753 | |
| 6754 | // Update A3 with the BSSID |
| 6755 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6756 | |
| 6757 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6758 | |
| 6759 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6760 | // in the FC |
| 6761 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6762 | |
| 6763 | // Pack 11w SA Query Request frame |
| 6764 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6765 | &frm, |
| 6766 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6767 | nPayload, |
| 6768 | &nPayload ); |
| 6769 | |
| 6770 | if ( DOT11F_FAILED( nStatus )) |
| 6771 | { |
| 6772 | limLog( pMac, LOGE, |
| 6773 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6774 | nStatus ); |
| 6775 | // FIXME - Need to convert to tSirRetStatus |
| 6776 | nSirStatus = eSIR_FAILURE; |
| 6777 | goto returnAfterError; |
| 6778 | } |
| 6779 | else if ( DOT11F_WARNED( nStatus )) |
| 6780 | { |
| 6781 | limLog( pMac, LOGW, |
| 6782 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6783 | nStatus); |
| 6784 | } |
| 6785 | |
| 6786 | limLog( pMac, LOG1, |
| 6787 | FL( "Sending an SA Query Request to " )); |
| 6788 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6789 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6790 | limLog( pMac, LOGE, |
| 6791 | FL( "Sending an SA Query Request from " )); |
| 6792 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6793 | |
| 6794 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6795 | #ifdef WLAN_FEATURE_P2P |
| 6796 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6797 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6798 | #endif |
| 6799 | ) |
| 6800 | { |
| 6801 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6802 | } |
| 6803 | |
| 6804 | halstatus = halTxFrame( pMac, |
| 6805 | pPacket, |
| 6806 | (tANI_U16) nBytes, |
| 6807 | HAL_TXRX_FRM_802_11_MGMT, |
| 6808 | ANI_TXDIR_TODS, |
| 6809 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6810 | limTxComplete, |
| 6811 | pFrame, txFlag ); |
| 6812 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6813 | { |
| 6814 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6815 | nSirStatus = eSIR_FAILURE; |
| 6816 | //Pkt will be freed up by the callback |
| 6817 | return nSirStatus; |
| 6818 | } |
| 6819 | else { |
| 6820 | return eSIR_SUCCESS; |
| 6821 | } |
| 6822 | |
| 6823 | returnAfterError: |
| 6824 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6825 | return nSirStatus; |
| 6826 | } // End limSendSaQueryRequestFrame |
| 6827 | |
| 6828 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6829 | * \brief Send SA query response action frame to peer |
| 6830 | * |
| 6831 | * \sa limSendSaQueryResponseFrame |
| 6832 | * |
| 6833 | * |
| 6834 | * \param pMac The global tpAniSirGlobal object |
| 6835 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6836 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6837 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6838 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6839 | * |
| 6840 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6841 | * |
| 6842 | * \return eSIR_SUCCESS if setup completes successfully |
| 6843 | * eSIR_FAILURE is some problem is encountered |
| 6844 | */ |
| 6845 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6846 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6847 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6848 | { |
| 6849 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6850 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6851 | tANI_U8 *pFrame; |
| 6852 | tSirRetStatus nSirStatus; |
| 6853 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6854 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6855 | void *pPacket; |
| 6856 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6857 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6858 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6859 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6860 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6861 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6862 | action: 0 --> SA query request action frame |
| 6863 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6864 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6865 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6866 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6867 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6868 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6869 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6870 | if ( DOT11F_FAILED( nStatus ) ) |
| 6871 | { |
| 6872 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6873 | "or a SA Query Response (0x%08x)."), |
| 6874 | nStatus ); |
| 6875 | // We'll fall back on the worst case scenario: |
| 6876 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6877 | } |
| 6878 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6879 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6880 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6881 | "the packed size for an SA Query Response" |
| 6882 | " (0x%08x)."), nStatus ); |
| 6883 | } |
| 6884 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6885 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6886 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6887 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6888 | { |
| 6889 | 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] | 6890 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6891 | return eSIR_FAILURE; |
| 6892 | } |
| 6893 | |
| 6894 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6895 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6896 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6897 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6898 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6899 | pFrame, |
| 6900 | SIR_MAC_MGMT_FRAME, |
| 6901 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6902 | peer, psessionEntry->selfMacAddr ); |
| 6903 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6904 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6905 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6906 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6907 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6908 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6909 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6910 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6911 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6912 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6913 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6914 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6915 | // Pack 11w SA query response frame |
| 6916 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6917 | &frm, |
| 6918 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6919 | nPayload, |
| 6920 | &nPayload ); |
| 6921 | |
| 6922 | if ( DOT11F_FAILED( nStatus )) |
| 6923 | { |
| 6924 | limLog( pMac, LOGE, |
| 6925 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6926 | nStatus ); |
| 6927 | // FIXME - Need to convert to tSirRetStatus |
| 6928 | nSirStatus = eSIR_FAILURE; |
| 6929 | goto returnAfterError; |
| 6930 | } |
| 6931 | else if ( DOT11F_WARNED( nStatus )) |
| 6932 | { |
| 6933 | limLog( pMac, LOGW, |
| 6934 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6935 | nStatus); |
| 6936 | } |
| 6937 | |
| 6938 | limLog( pMac, LOG1, |
| 6939 | FL( "Sending a SA Query Response to " )); |
| 6940 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6941 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6942 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6943 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6944 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6945 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6946 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6947 | ) |
| 6948 | { |
| 6949 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6950 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6951 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6952 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6953 | psessionEntry->peSessionId, |
| 6954 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6955 | halstatus = halTxFrame( pMac, |
| 6956 | pPacket, |
| 6957 | (tANI_U16) nBytes, |
| 6958 | HAL_TXRX_FRM_802_11_MGMT, |
| 6959 | ANI_TXDIR_TODS, |
| 6960 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6961 | limTxComplete, |
| 6962 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6963 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6964 | psessionEntry->peSessionId, |
| 6965 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6966 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6967 | { |
| 6968 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6969 | nSirStatus = eSIR_FAILURE; |
| 6970 | //Pkt will be freed up by the callback |
| 6971 | return nSirStatus; |
| 6972 | } |
| 6973 | else { |
| 6974 | return eSIR_SUCCESS; |
| 6975 | } |
| 6976 | |
| 6977 | returnAfterError: |
| 6978 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6979 | return nSirStatus; |
| 6980 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | #endif |