Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Abhishek Singh | afb4605 | 2018-02-09 14:10:04 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 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 |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 112 | { |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 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]; |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 138 | tANI_U8 tag, len, *val; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 139 | |
| 140 | if ( NULL == pBuf ) |
| 141 | { |
| 142 | limLog( pMac, LOGE, |
| 143 | FL("Invalid Buffer Address")); |
| 144 | return; |
| 145 | } |
| 146 | if(NULL == pDst) |
| 147 | { |
| 148 | PELOGE(limLog(pMac, LOGE, |
| 149 | FL("NULL pDst pointer"));) |
| 150 | return ; |
| 151 | } |
| 152 | |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 153 | /* Get tlv */ |
| 154 | tag = pBuf[0]; |
| 155 | len = pBuf[1]; |
| 156 | val = &pBuf[2]; |
| 157 | |
| 158 | if ( DOT11F_EID_EXTCAP != tag || |
| 159 | len > DOT11F_IE_EXTCAP_MAX_LEN ) |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 160 | { |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 161 | limLog( pMac, LOG1, |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 162 | FL("Invalid IEs eid = %d elem_len=%d "), tag, len); |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 163 | return; |
| 164 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 165 | |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 166 | vos_mem_zero(pOut, DOT11F_IE_EXTCAP_MAX_LEN); |
| 167 | vos_mem_copy(pOut, val, len); |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 168 | if ( DOT11F_PARSE_SUCCESS != dot11fUnpackIeExtCap( pMac, |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 169 | pOut, len, pDst) ) |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 170 | { |
| 171 | limLog( pMac, LOGE, |
| 172 | FL("dot11fUnpackIeExtCap Parse Error ")); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | tSirRetStatus limStripOffExtCapIEAndUpdateStruct(tpAniSirGlobal pMac, |
| 177 | tANI_U8* addIE, |
| 178 | tANI_U16 *addnIELen, |
| 179 | tDot11fIEExtCap * pDst ) |
| 180 | { |
| 181 | tANI_U8 pExtractedExtCapIEBuf[DOT11F_IE_EXTCAP_MAX_LEN + 2]; |
| 182 | tSirRetStatus nSirStatus; |
| 183 | |
| 184 | vos_mem_set(( tANI_U8* )&pExtractedExtCapIEBuf[0], |
| 185 | DOT11F_IE_EXTCAP_MAX_LEN + 2, 0); |
| 186 | nSirStatus = limStripOffExtCapIE(pMac, addIE, addnIELen, |
| 187 | pExtractedExtCapIEBuf); |
| 188 | if ( eSIR_SUCCESS != nSirStatus ) |
| 189 | { |
| 190 | limLog( pMac, LOG1, FL("Failed to strip off in" |
| 191 | "limStripOffExtCapIE status = (%d)."), |
| 192 | nSirStatus ); |
| 193 | return nSirStatus; |
| 194 | } |
| 195 | /* update the extracted ExtCap to struct*/ |
| 196 | limUpdateExtCapIEtoStruct(pMac, pExtractedExtCapIEBuf, pDst); |
| 197 | return nSirStatus; |
| 198 | } |
| 199 | |
| 200 | void limMergeExtCapIEStruct(tDot11fIEExtCap *pDst, |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 201 | tDot11fIEExtCap *pSrc, |
| 202 | bool add) |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 203 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 204 | tANI_U8 *tempDst = (tANI_U8 *)pDst->bytes; |
| 205 | tANI_U8 *tempSrc = (tANI_U8 *)pSrc->bytes; |
| 206 | tANI_U8 structlen = DOT11F_IE_EXTCAP_MAX_LEN; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 207 | |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 208 | // if src is not present, nothing to do |
| 209 | if(!pSrc->present) { |
| 210 | return; |
| 211 | } |
| 212 | |
| 213 | // if dst is not present, and add=false, nothing to do |
| 214 | if (!pDst->present && !add) { |
| 215 | return; |
| 216 | } |
| 217 | |
| 218 | // in other cases, need to merge the bits |
| 219 | pDst->present = 1; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 220 | while(tempDst && tempSrc && structlen--) |
| 221 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 222 | if (add) { |
| 223 | *tempDst |= *tempSrc; |
| 224 | } else { |
| 225 | *tempDst &= *tempSrc; |
| 226 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 227 | tempDst++; |
| 228 | tempSrc++; |
| 229 | } |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 230 | pDst->num_bytes = lim_compute_ext_cap_ie_length(pDst); |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 231 | |
| 232 | // if all bits are zero, it means it is not prsent. |
| 233 | if (pDst->num_bytes == 0) { |
| 234 | pDst->present = 0; |
| 235 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 236 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 237 | |
| 238 | /** |
| 239 | * |
| 240 | * \brief This function is called by various LIM modules to prepare the |
| 241 | * 802.11 frame MAC header |
| 242 | * |
| 243 | * |
| 244 | * \param pMac Pointer to Global MAC structure |
| 245 | * |
| 246 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 247 | * |
| 248 | * \param type Type of the frame |
| 249 | * |
| 250 | * \param subType Subtype of the frame |
| 251 | * |
| 252 | * \return eHalStatus |
| 253 | * |
| 254 | * |
| 255 | * The pFrameBuf argument points to the beginning of the frame buffer to |
| 256 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 257 | * will be the MGMT frame payload The payload itself is populated by the |
| 258 | * caller API |
| 259 | * |
| 260 | * |
| 261 | */ |
| 262 | |
| 263 | tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac, |
| 264 | tANI_U8* pBD, |
| 265 | tANI_U8 type, |
| 266 | tANI_U8 subType, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 267 | tSirMacAddr peerAddr, tSirMacAddr selfMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 268 | { |
| 269 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 270 | tpSirMacMgmtHdr pMacHdr; |
| 271 | |
| 272 | /// Prepare MAC management header |
| 273 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 274 | |
| 275 | // Prepare FC |
| 276 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 277 | pMacHdr->fc.type = type; |
| 278 | pMacHdr->fc.subType = subType; |
| 279 | |
| 280 | // Prepare Address 1 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 281 | vos_mem_copy( (tANI_U8 *) pMacHdr->da, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | (tANI_U8 *) peerAddr, |
| 283 | sizeof( tSirMacAddr )); |
| 284 | |
| 285 | // Prepare Address 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 287 | |
| 288 | // Prepare Address 3 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 289 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 290 | (tANI_U8 *) peerAddr, |
| 291 | sizeof( tSirMacAddr )); |
| 292 | return statusCode; |
| 293 | } /*** end limPopulateMacHeader() ***/ |
| 294 | |
| 295 | /** |
| 296 | * \brief limSendProbeReqMgmtFrame |
| 297 | * |
| 298 | * |
| 299 | * \param pMac Pointer to Global MAC structure |
| 300 | * |
| 301 | * \param pSsid SSID to be sent in Probe Request frame |
| 302 | * |
| 303 | * \param bssid BSSID to be sent in Probe Request frame |
| 304 | * |
| 305 | * \param nProbeDelay probe delay to be used before sending Probe Request |
| 306 | * frame |
| 307 | * |
| 308 | * \param nChannelNum Channel # on which the Probe Request is going out |
| 309 | * |
| 310 | * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame |
| 311 | * |
| 312 | * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame |
| 313 | * |
| 314 | * This function is called by various LIM modules to send Probe Request frame |
| 315 | * during active scan/learn phase. |
| 316 | * Probe request is sent out in the following scenarios: |
| 317 | * --heartbeat failure: session needed |
| 318 | * --join req: session needed |
| 319 | * --foreground scan: no session |
| 320 | * --background scan: no session |
| 321 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 322 | * |
| 323 | * |
| 324 | */ |
| 325 | tSirRetStatus |
| 326 | limSendProbeReqMgmtFrame(tpAniSirGlobal pMac, |
| 327 | tSirMacSSid *pSsid, |
| 328 | tSirMacAddr bssid, |
| 329 | tANI_U8 nChannelNum, |
| 330 | tSirMacAddr SelfMacAddr, |
| 331 | tANI_U32 dot11mode, |
| 332 | tANI_U32 nAdditionalIELen, |
| 333 | tANI_U8 *pAdditionalIE) |
| 334 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 335 | tDot11fProbeRequest pr; |
| 336 | tANI_U32 nStatus, nBytes, nPayload; |
| 337 | tSirRetStatus nSirStatus; |
| 338 | tANI_U8 *pFrame; |
| 339 | void *pPacket; |
| 340 | eHalStatus halstatus; |
| 341 | tpPESession psessionEntry; |
| 342 | tANI_U8 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | tANI_U8 *p2pIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 344 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 345 | |
| 346 | #ifndef GEN4_SCAN |
| 347 | return eSIR_FAILURE; |
| 348 | #endif |
| 349 | |
| 350 | #if defined ( ANI_DVT_DEBUG ) |
| 351 | return eSIR_FAILURE; |
| 352 | #endif |
| 353 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame] | 354 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 355 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 356 | * is false and dot11mode is 11ac set it to 11n. |
| 357 | */ |
| 358 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 359 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 360 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 361 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 362 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 363 | /* |
| 364 | * session context may or may not be present, when probe request needs to be sent out. |
| 365 | * following cases exist: |
| 366 | * --heartbeat failure: session needed |
| 367 | * --join req: session needed |
| 368 | * --foreground scan: no session |
| 369 | * --background scan: no session |
| 370 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 371 | * If session context does not exist, some IEs will be populated from CFGs, |
| 372 | * e.g. Supported and Extended rate set IEs |
| 373 | */ |
| 374 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 375 | |
| 376 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 377 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 378 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 379 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | |
| 381 | // & delegating to assorted helpers: |
| 382 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 383 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 384 | if( nAdditionalIELen && pAdditionalIE ) |
| 385 | { |
| 386 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 387 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 388 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 389 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 390 | ( p2pIe != NULL ) && |
| 391 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 392 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 393 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 394 | ( ( psessionEntry != NULL ) && |
| 395 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 396 | ) |
| 397 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 398 | { |
| 399 | /* In the below API pass channel number > 14, do that it fills only |
| 400 | * 11a rates in supported rates */ |
| 401 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 402 | } |
| 403 | else |
| 404 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 406 | &pr.SuppRates,psessionEntry); |
| 407 | |
| 408 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 409 | { |
| 410 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 412 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | |
| 414 | #if defined WLAN_FEATURE_VOWIFI |
| 415 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 416 | //DS params "can" be present in RRM is disabled and "is" present if |
| 417 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 418 | //RRM is not enabled. |
| 419 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 420 | //Call RRM module to get the tx power for management used. |
| 421 | { |
| 422 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 423 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 424 | } |
| 425 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | |
| 427 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 428 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 430 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 431 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 432 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 433 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 434 | } else { //psessionEntry == NULL |
| 435 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 437 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 438 | } |
| 439 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 440 | |
Hardik Kantilal Patel | bca5b00 | 2015-01-19 15:30:18 +0530 | [diff] [blame] | 441 | if((nChannelNum <= SIR_11B_CHANNEL_END) |
| 442 | && (!IS_HT40_OBSS_SCAN_FEATURE_ENABLE) |
| 443 | && (!pMac->roam.configParam.channelBondingMode24GHz)) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 444 | { |
| 445 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 446 | pr.HTCaps.shortGI40MHz = 0; |
| 447 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 448 | #ifdef WLAN_FEATURE_11AC |
| 449 | if (psessionEntry != NULL ) { |
| 450 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 451 | //Include HT Capability IE |
| 452 | if (psessionEntry->vhtCapability) |
| 453 | { |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 454 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, |
| 455 | psessionEntry->currentOperChannel , eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 456 | } |
| 457 | } else { |
| 458 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 459 | { |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 460 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, nChannelNum, eSIR_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 461 | } |
| 462 | } |
| 463 | #endif |
| 464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 465 | |
| 466 | // That's it-- now we pack it. First, how much space are we going to |
| 467 | // need? |
| 468 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 469 | if ( DOT11F_FAILED( nStatus ) ) |
| 470 | { |
| 471 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 472 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 473 | // We'll fall back on the worst case scenario: |
| 474 | nPayload = sizeof( tDot11fProbeRequest ); |
| 475 | } |
| 476 | else if ( DOT11F_WARNED( nStatus ) ) |
| 477 | { |
| 478 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 479 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 480 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 484 | |
| 485 | // Ok-- try to allocate some memory: |
| 486 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 487 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 488 | ( void** ) &pPacket ); |
| 489 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 490 | { |
| 491 | 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] | 492 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | return eSIR_MEM_ALLOC_FAILED; |
| 494 | } |
| 495 | |
| 496 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 497 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | |
| 499 | // Next, we fill out the buffer descriptor: |
| 500 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 501 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | if ( eSIR_SUCCESS != nSirStatus ) |
| 503 | { |
| 504 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 505 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | nSirStatus ); |
| 507 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 508 | ( void* ) pFrame, ( void* ) pPacket ); |
| 509 | return nSirStatus; // allocated! |
| 510 | } |
| 511 | |
| 512 | // That done, pack the Probe Request: |
| 513 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 514 | sizeof( tSirMacMgmtHdr ), |
| 515 | nPayload, &nPayload ); |
| 516 | if ( DOT11F_FAILED( nStatus ) ) |
| 517 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 518 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | nStatus ); |
| 520 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 521 | return eSIR_FAILURE; // allocated! |
| 522 | } |
| 523 | else if ( DOT11F_WARNED( nStatus ) ) |
| 524 | { |
| 525 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 526 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 527 | } |
| 528 | |
| 529 | // Append any AddIE if present. |
| 530 | if( nAdditionalIELen ) |
| 531 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 532 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | pAdditionalIE, nAdditionalIELen ); |
| 534 | nPayload += nAdditionalIELen; |
| 535 | } |
| 536 | |
| 537 | /* If this probe request is sent during P2P Search State, then we need |
| 538 | * to send it at OFDM rate. |
| 539 | */ |
| 540 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 541 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 542 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 543 | /* For unicast probe req mgmt from Join function |
| 544 | we don't set above variables. So we need to add |
| 545 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 546 | || ( ( psessionEntry != NULL ) && |
| 547 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | ) |
| 549 | { |
| 550 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 551 | } |
| 552 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 553 | if( ( psessionEntry != NULL ) && ( psessionEntry->is11Gonly == true ) && |
| 554 | ( !IS_BROADCAST_MAC(bssid) ) ){ |
| 555 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 556 | } |
| 557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 559 | HAL_TXRX_FRM_802_11_MGMT, |
| 560 | ANI_TXDIR_TODS, |
| 561 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 562 | limTxComplete, pFrame, txFlag ); |
| 563 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 564 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 565 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | //Pkt will be freed up by the callback |
| 567 | return eSIR_FAILURE; |
| 568 | } |
| 569 | |
| 570 | return eSIR_SUCCESS; |
| 571 | } // End limSendProbeReqMgmtFrame. |
| 572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 574 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 575 | tANI_U8 probeReqP2pIe) |
| 576 | { |
| 577 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 578 | from additional IE */ |
| 579 | if(!probeReqP2pIe) |
| 580 | { |
| 581 | tANI_U8* tempbuf = NULL; |
| 582 | tANI_U16 tempLen = 0; |
| 583 | int left = *addnIELen; |
| 584 | v_U8_t *ptr = addIE; |
| 585 | v_U8_t elem_id, elem_len; |
| 586 | |
| 587 | if(NULL == addIE) |
| 588 | { |
| 589 | PELOGE(limLog(pMac, LOGE, |
| 590 | FL(" NULL addIE pointer"));) |
| 591 | return eSIR_FAILURE; |
| 592 | } |
| 593 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 594 | tempbuf = vos_mem_malloc(left); |
| 595 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 596 | { |
| 597 | PELOGE(limLog(pMac, LOGE, |
| 598 | FL("Unable to allocate memory to store addn IE"));) |
| 599 | return eSIR_MEM_ALLOC_FAILED; |
| 600 | } |
| 601 | |
| 602 | while(left >= 2) |
| 603 | { |
| 604 | elem_id = ptr[0]; |
| 605 | elem_len = ptr[1]; |
| 606 | left -= 2; |
| 607 | if(elem_len > left) |
| 608 | { |
| 609 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 610 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 612 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 613 | return eSIR_FAILURE; |
| 614 | } |
| 615 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 616 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 617 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 618 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 619 | tempLen += (elem_len + 2); |
| 620 | } |
| 621 | left -= elem_len; |
| 622 | ptr += (elem_len + 2); |
| 623 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 624 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 625 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 626 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | } |
| 628 | return eSIR_SUCCESS; |
| 629 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 630 | |
| 631 | void |
| 632 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 633 | tSirMacAddr peerMacAddr, |
| 634 | tpAniSSID pSsid, |
| 635 | short nStaId, |
| 636 | tANI_U8 nKeepAlive, |
| 637 | tpPESession psessionEntry, |
| 638 | tANI_U8 probeReqP2pIe) |
| 639 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 640 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 641 | tSirRetStatus nSirStatus; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 642 | tANI_U32 cfg, nPayload, nStatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 643 | tpSirMacMgmtHdr pMacHdr; |
| 644 | tANI_U8 *pFrame; |
| 645 | void *pPacket; |
| 646 | eHalStatus halstatus; |
| 647 | tANI_U32 addnIEPresent; |
| 648 | tANI_U32 addnIE1Len=0; |
| 649 | tANI_U32 addnIE2Len=0; |
| 650 | tANI_U32 addnIE3Len=0; |
| 651 | tANI_U16 totalAddnIeLen = 0; |
| 652 | tANI_U32 wpsApEnable=0, tmp; |
| 653 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 655 | tANI_U8 *pP2pIe = NULL; |
| 656 | tANI_U8 noaLen = 0; |
| 657 | tANI_U8 total_noaLen = 0; |
| 658 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 660 | 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] | 661 | tDot11fIEExtCap extractedExtCap; |
| 662 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 663 | tANI_U32 nBytes = 0; |
| 664 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 665 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 666 | { |
| 667 | return; // in this case. |
| 668 | } |
| 669 | |
| 670 | if(NULL == psessionEntry) |
| 671 | { |
| 672 | return; |
| 673 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 674 | |
| 675 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 676 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 677 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 678 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 679 | return; |
| 680 | } |
| 681 | |
Girish Gowli | 0e82679 | 2014-05-17 17:56:44 +0530 | [diff] [blame] | 682 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
| 683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 684 | // Fill out 'frm', after which we'll just hand the struct off to |
| 685 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 686 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | |
| 688 | // Timestamp to be updated by TFP, below. |
| 689 | |
| 690 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 692 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 693 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 694 | } |
| 695 | else |
| 696 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 697 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 698 | if (eSIR_SUCCESS != nSirStatus) |
| 699 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 700 | 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] | 701 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 702 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 703 | return; |
| 704 | } |
| 705 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 706 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 708 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 709 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 711 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 712 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 713 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 714 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 718 | { |
| 719 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 720 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 721 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | } |
| 723 | } |
| 724 | else |
| 725 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 726 | 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] | 727 | 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] | 728 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 729 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 730 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 731 | if (wpsApEnable) |
| 732 | { |
| 733 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 734 | } |
| 735 | |
| 736 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 737 | { |
| 738 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 739 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 740 | } |
| 741 | |
| 742 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 743 | { |
| 744 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 745 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 746 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 748 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 749 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 750 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 751 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 752 | |
| 753 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 754 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 755 | |
| 756 | |
| 757 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 758 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 759 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 760 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 761 | |
| 762 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 763 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 765 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 766 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 767 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 768 | |
| 769 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 770 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 771 | * when operating in HT40 in 2.4GHz. |
| 772 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 773 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 774 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 775 | { |
| 776 | PopulateDot11fOBSSScanParameters( pMac, &pFrm->OBSSScanParameters, |
| 777 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 778 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 779 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 780 | * Mode in 40 MHz bit in HT capablity. |
| 781 | */ |
| 782 | pFrm->HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 783 | } |
| 784 | #endif |
| 785 | |
| 786 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
| 787 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 788 | #ifdef WLAN_FEATURE_11AC |
| 789 | if(psessionEntry->vhtCapability) |
| 790 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 791 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 792 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, |
| 793 | psessionEntry->currentOperChannel, eSIR_TRUE ); |
| 794 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation , |
| 795 | psessionEntry->currentOperChannel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 796 | // we do not support multi users yet |
| 797 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
| 798 | } |
| 799 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 800 | |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 801 | if (LIM_IS_AP_ROLE(psessionEntry) && psessionEntry->include_ecsa_ie) { |
| 802 | populate_dot11f_ext_chann_switch_ann(pMac, &pFrm->ext_chan_switch_ann, |
| 803 | psessionEntry); |
| 804 | if (psessionEntry->lim11hEnable) { |
| 805 | PopulateDot11fChanSwitchAnn(pMac, |
| 806 | &pFrm->ChanSwitchAnn, psessionEntry); |
| 807 | if (psessionEntry->include_wide_ch_bw_ie) |
| 808 | PopulateDot11fWiderBWChanSwitchAnn(pMac, |
| 809 | &pFrm->WiderBWChanSwitchAnn, psessionEntry); |
| 810 | } |
| 811 | } |
| 812 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 813 | |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 814 | if ( psessionEntry->pLimStartBssReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 815 | { |
| 816 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 817 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 818 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 819 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | } |
| 821 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 822 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 823 | |
| 824 | #if defined(FEATURE_WLAN_WAPI) |
| 825 | if( psessionEntry->pLimStartBssReq ) |
| 826 | { |
| 827 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 828 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 829 | } |
| 830 | |
| 831 | #endif // defined(FEATURE_WLAN_WAPI) |
| 832 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 833 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 835 | { |
| 836 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 837 | } |
| 838 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 839 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 840 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | { |
| 842 | |
| 843 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 844 | &addnIEPresent) != eSIR_SUCCESS) |
| 845 | { |
| 846 | 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] | 847 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | return; |
| 849 | } |
| 850 | } |
| 851 | |
| 852 | if (addnIEPresent) |
| 853 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 854 | |
| 855 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 856 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 857 | { |
| 858 | PELOGE(limLog(pMac, LOGE, |
| 859 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 860 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | return; |
| 862 | } |
| 863 | |
| 864 | //Probe rsp IE available |
| 865 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 866 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 867 | { |
| 868 | 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] | 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 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
Abhishek Singh | afb4605 | 2018-02-09 14:10:04 +0530 | [diff] [blame] | 874 | (nBytes + addnIE1Len) <= SCH_MAX_PROBE_RESP_SIZE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 875 | { |
| 876 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 877 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 878 | &addnIE1Len) ) |
| 879 | { |
| 880 | limLog(pMac, LOGP, |
| 881 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 882 | vos_mem_free(addIE); |
| 883 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 884 | return; |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | //Probe rsp IE available |
| 889 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 890 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 891 | { |
| 892 | 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] | 893 | vos_mem_free(addIE); |
| 894 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 895 | return; |
| 896 | } |
| 897 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
Abhishek Singh | afb4605 | 2018-02-09 14:10:04 +0530 | [diff] [blame] | 898 | (nBytes + addnIE2Len) <= SCH_MAX_PROBE_RESP_SIZE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 899 | { |
| 900 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 901 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 902 | &addnIE2Len) ) |
| 903 | { |
| 904 | limLog(pMac, LOGP, |
| 905 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 906 | vos_mem_free(addIE); |
| 907 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | return; |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | //Probe rsp IE available |
| 913 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 914 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 915 | { |
| 916 | 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] | 917 | vos_mem_free(addIE); |
| 918 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 919 | return; |
| 920 | } |
| 921 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
Abhishek Singh | afb4605 | 2018-02-09 14:10:04 +0530 | [diff] [blame] | 922 | (nBytes + addnIE3Len) <= SCH_MAX_PROBE_RESP_SIZE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | { |
| 924 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 925 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 926 | &addIE[addnIE1Len + addnIE2Len], |
| 927 | &addnIE3Len) ) |
| 928 | { |
| 929 | limLog(pMac, LOGP, |
| 930 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 931 | vos_mem_free(addIE); |
| 932 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | return; |
| 934 | } |
| 935 | } |
| 936 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 937 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 939 | { |
| 940 | limLog(pMac, LOGP, |
| 941 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 942 | vos_mem_free(addIE); |
| 943 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 944 | return; |
| 945 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 946 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 947 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 948 | addIE, |
| 949 | &totalAddnIeLen, |
| 950 | &extractedExtCap ); |
| 951 | if(eSIR_SUCCESS != nSirStatus ) |
| 952 | { |
| 953 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 954 | limLog(pMac, LOG1, |
| 955 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 956 | } |
| 957 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | nBytes = nBytes + totalAddnIeLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 959 | limLog(pMac, LOG1, |
| 960 | FL("probe rsp packet size is %d "), nBytes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 961 | if (probeReqP2pIe) |
| 962 | { |
| 963 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 964 | if (pP2pIe != NULL) |
| 965 | { |
| 966 | //get NoA attribute stream P2P IE |
| 967 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 968 | if (noaLen != 0) |
| 969 | { |
| 970 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 971 | &noaStream[0], noaLen); |
| 972 | nBytes = nBytes + total_noaLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 973 | limLog(pMac, LOG1, |
| 974 | FL("p2p probe rsp packet size is %d, noalength is %d"), |
| 975 | nBytes, total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 976 | } |
| 977 | } |
| 978 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | } |
| 980 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 981 | /*merge ExtCap IE*/ |
| 982 | if (extractedExtCapFlag && extractedExtCap.present) |
| 983 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 984 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap, true); |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 985 | } |
| 986 | |
| 987 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 988 | if ( DOT11F_FAILED( nStatus ) ) |
| 989 | { |
| 990 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 991 | "or a Probe Response (0x%08x)."), |
| 992 | nStatus ); |
| 993 | // We'll fall back on the worst case scenario: |
| 994 | nPayload = sizeof( tDot11fProbeResponse ); |
| 995 | } |
| 996 | else if ( DOT11F_WARNED( nStatus ) ) |
| 997 | { |
| 998 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 999 | "the packed size for a Probe Response " |
| 1000 | "(0x%08x)."), nStatus ); |
| 1001 | } |
| 1002 | |
| 1003 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 1004 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1005 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1006 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1007 | ( void** ) &pPacket ); |
| 1008 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1009 | { |
| 1010 | 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] | 1011 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1012 | if ( addIE != NULL ) |
| 1013 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1014 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1015 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1016 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | return; |
| 1018 | } |
| 1019 | |
| 1020 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1021 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1022 | |
| 1023 | // Next, we fill out the buffer descriptor: |
| 1024 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1025 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 1026 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1027 | { |
| 1028 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1029 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | nSirStatus ); |
| 1031 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1032 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1033 | if ( addIE != NULL ) |
| 1034 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1035 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1037 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1038 | return; |
| 1039 | } |
| 1040 | |
| 1041 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1042 | |
| 1043 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1044 | |
| 1045 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1046 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1047 | nPayload, &nPayload ); |
| 1048 | if ( DOT11F_FAILED( nStatus ) ) |
| 1049 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1050 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | nStatus ); |
| 1052 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1053 | if ( addIE != NULL ) |
| 1054 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1055 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1057 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1058 | return; // allocated! |
| 1059 | } |
| 1060 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1061 | { |
| 1062 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1063 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1067 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1068 | |
| 1069 | pMac->sys.probeRespond++; |
| 1070 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1072 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1073 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1074 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1075 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | |
| 1077 | if ( addnIEPresent ) |
| 1078 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1079 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | if (noaLen != 0) |
| 1082 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1083 | 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] | 1084 | { |
| 1085 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1086 | FL("Not able to insert NoA because of length constraint." |
| 1087 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1088 | vos_mem_free(addIE); |
| 1089 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1090 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1091 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1092 | return; |
| 1093 | } |
| 1094 | else |
| 1095 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1096 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1097 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1098 | } |
| 1099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1100 | |
| 1101 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1102 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1103 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | ) |
| 1105 | { |
| 1106 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1107 | } |
| 1108 | |
| 1109 | // Queue Probe Response frame in high priority WQ |
| 1110 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1111 | ( tANI_U16 ) nBytes, |
| 1112 | HAL_TXRX_FRM_802_11_MGMT, |
| 1113 | ANI_TXDIR_TODS, |
| 1114 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1115 | limTxComplete, pFrame, txFlag ); |
| 1116 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1117 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1118 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | //Pkt will be freed up by the callback |
| 1120 | } |
| 1121 | |
| 1122 | if ( addIE != NULL ) |
| 1123 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1124 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1125 | } |
| 1126 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1127 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1128 | return; |
| 1129 | |
| 1130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1131 | } // End limSendProbeRspMgmtFrame. |
| 1132 | |
| 1133 | void |
| 1134 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1135 | tSirMacAddr peerMacAddr, |
| 1136 | tSirAddtsReqInfo *pAddTS, |
| 1137 | tpPESession psessionEntry) |
| 1138 | { |
| 1139 | tANI_U16 i; |
| 1140 | tANI_U8 *pFrame; |
| 1141 | tSirRetStatus nSirStatus; |
| 1142 | tDot11fAddTSRequest AddTSReq; |
| 1143 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1144 | tANI_U32 nPayload, nBytes, nStatus; |
| 1145 | tpSirMacMgmtHdr pMacHdr; |
| 1146 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1147 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | tANI_U32 phyMode; |
| 1149 | #endif |
| 1150 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1151 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1152 | |
| 1153 | if(NULL == psessionEntry) |
| 1154 | { |
| 1155 | return; |
| 1156 | } |
| 1157 | |
| 1158 | if ( ! pAddTS->wmeTspecPresent ) |
| 1159 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1160 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1161 | |
| 1162 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1163 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1164 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1165 | if ( pAddTS->lleTspecPresent ) |
| 1166 | { |
| 1167 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1168 | } |
| 1169 | else |
| 1170 | { |
| 1171 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1172 | } |
| 1173 | |
| 1174 | if ( pAddTS->lleTspecPresent ) |
| 1175 | { |
| 1176 | AddTSReq.num_WMMTCLAS = 0; |
| 1177 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1178 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1179 | { |
| 1180 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1181 | &AddTSReq.TCLAS[i] ); |
| 1182 | } |
| 1183 | } |
| 1184 | else |
| 1185 | { |
| 1186 | AddTSReq.num_TCLAS = 0; |
| 1187 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1188 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1189 | { |
| 1190 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1191 | &AddTSReq.WMMTCLAS[i] ); |
| 1192 | } |
| 1193 | } |
| 1194 | |
| 1195 | if ( pAddTS->tclasProcPresent ) |
| 1196 | { |
| 1197 | if ( pAddTS->lleTspecPresent ) |
| 1198 | { |
| 1199 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1200 | AddTSReq.TCLASSPROC.present = 1; |
| 1201 | } |
| 1202 | else |
| 1203 | { |
| 1204 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1205 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1206 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1207 | } |
| 1208 | } |
| 1209 | |
| 1210 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1211 | if ( DOT11F_FAILED( nStatus ) ) |
| 1212 | { |
| 1213 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1214 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1215 | nStatus ); |
| 1216 | // We'll fall back on the worst case scenario: |
| 1217 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1218 | } |
| 1219 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1220 | { |
| 1221 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1222 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1223 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1224 | } |
| 1225 | } |
| 1226 | else |
| 1227 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1228 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | |
| 1230 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1231 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1232 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1233 | |
| 1234 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1235 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1236 | |
| 1237 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1238 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1240 | |
| 1241 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1242 | { |
| 1243 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1244 | } |
| 1245 | else |
| 1246 | { |
| 1247 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1248 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1249 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1250 | #endif |
| 1251 | // fillWmeTspecIE |
| 1252 | |
| 1253 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1254 | if ( DOT11F_FAILED( nStatus ) ) |
| 1255 | { |
| 1256 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1257 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1258 | nStatus ); |
| 1259 | // We'll fall back on the worst case scenario: |
| 1260 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1261 | } |
| 1262 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1263 | { |
| 1264 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1265 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1266 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1271 | |
| 1272 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1273 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1274 | ( void** ) &pPacket ); |
| 1275 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1276 | { |
| 1277 | 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] | 1278 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | return; |
| 1280 | } |
| 1281 | |
| 1282 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1283 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1284 | |
| 1285 | // Next, we fill out the buffer descriptor: |
| 1286 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1287 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1288 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1289 | { |
| 1290 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1291 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1292 | nSirStatus ); |
| 1293 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1294 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1295 | return; |
| 1296 | } |
| 1297 | |
| 1298 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1299 | |
| 1300 | #if 0 |
| 1301 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1302 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1303 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1304 | { |
| 1305 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1306 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1307 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1308 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1309 | return; |
| 1310 | } |
| 1311 | #endif //TO SUPPORT BT-AMP |
| 1312 | |
| 1313 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1314 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1315 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1316 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1317 | #endif |
| 1318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | // That done, pack the struct: |
| 1320 | if ( ! pAddTS->wmeTspecPresent ) |
| 1321 | { |
| 1322 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1323 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1324 | nPayload, &nPayload ); |
| 1325 | if ( DOT11F_FAILED( nStatus ) ) |
| 1326 | { |
| 1327 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1328 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1329 | nStatus ); |
| 1330 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1331 | return; // allocated! |
| 1332 | } |
| 1333 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1334 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1335 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1336 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1337 | } |
| 1338 | } |
| 1339 | else |
| 1340 | { |
| 1341 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1342 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1343 | nPayload, &nPayload ); |
| 1344 | if ( DOT11F_FAILED( nStatus ) ) |
| 1345 | { |
| 1346 | 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] | 1347 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1348 | nStatus ); |
| 1349 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1350 | return; // allocated! |
| 1351 | } |
| 1352 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1353 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1354 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1355 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1356 | } |
| 1357 | } |
| 1358 | |
Abhishek Singh | 127a844 | 2014-12-15 17:31:27 +0530 | [diff] [blame] | 1359 | limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") ); |
| 1360 | limPrintMacAddr( pMac, peerMacAddr, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1361 | |
| 1362 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1363 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1364 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1365 | ) |
| 1366 | { |
| 1367 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1368 | } |
| 1369 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1370 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1371 | psessionEntry->peSessionId, |
| 1372 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1373 | // Queue Addts Response frame in high priority WQ |
| 1374 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1375 | HAL_TXRX_FRM_802_11_MGMT, |
| 1376 | ANI_TXDIR_TODS, |
| 1377 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1378 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1379 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1380 | psessionEntry->peSessionId, |
| 1381 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1382 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1383 | { |
| 1384 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1385 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1386 | //Pkt will be freed up by the callback |
| 1387 | } |
| 1388 | |
| 1389 | } // End limSendAddtsReqActionFrame. |
| 1390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1391 | |
| 1392 | |
| 1393 | void |
| 1394 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1395 | tANI_U16 statusCode, |
| 1396 | tANI_U16 aid, |
| 1397 | tSirMacAddr peerMacAddr, |
| 1398 | tANI_U8 subType, |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1399 | tpDphHashNode pSta,tpPESession psessionEntry, |
| 1400 | assoc_rsp_tx_context *tx_complete_context) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1401 | { |
| 1402 | static tDot11fAssocResponse frm; |
| 1403 | tANI_U8 *pFrame, *macAddr; |
| 1404 | tpSirMacMgmtHdr pMacHdr; |
| 1405 | tSirRetStatus nSirStatus; |
| 1406 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1407 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1408 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1409 | void *pPacket; |
| 1410 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1411 | tUpdateBeaconParams beaconParams; |
| 1412 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1413 | tANI_U32 addnIEPresent = false; |
| 1414 | tANI_U32 addnIELen=0; |
| 1415 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1416 | tpSirAssocReq pAssocReq = NULL; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1417 | tANI_U16 addStripoffIELen = 0; |
| 1418 | tDot11fIEExtCap extractedExtCap; |
| 1419 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1420 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1421 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1422 | #ifdef WLAN_FEATURE_11W |
| 1423 | tANI_U32 retryInterval; |
| 1424 | tANI_U32 maxRetries; |
| 1425 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1426 | |
| 1427 | if(NULL == psessionEntry) |
| 1428 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1429 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1430 | return; |
| 1431 | } |
| 1432 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1433 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1434 | |
| 1435 | limGetQosMode(psessionEntry, &qosMode); |
| 1436 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1437 | |
| 1438 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1439 | // STA sent a traffic spec. |
| 1440 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1441 | |
| 1442 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1443 | |
| 1444 | frm.Status.status = statusCode; |
| 1445 | |
| 1446 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1447 | |
| 1448 | if ( NULL == pSta ) |
| 1449 | { |
| 1450 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1451 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1452 | } |
| 1453 | else |
| 1454 | { |
| 1455 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1456 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1457 | } |
| 1458 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1459 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1460 | { |
| 1461 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1462 | { |
| 1463 | pAssocReq = |
| 1464 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1465 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1466 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1467 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1468 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1469 | } |
| 1470 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1471 | |
| 1472 | if ( NULL != pSta ) |
| 1473 | { |
| 1474 | if ( eHAL_SET == qosMode ) |
| 1475 | { |
| 1476 | if ( pSta->lleEnabled ) |
| 1477 | { |
| 1478 | lleMode = 1; |
| 1479 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1480 | { |
| 1481 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1482 | |
| 1483 | // FramesToDo:... |
| 1484 | // if ( fAddTS ) |
| 1485 | // { |
| 1486 | // tANI_U8 *pAf = pBody; |
| 1487 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1488 | // tANI_U32 tlen; |
| 1489 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1490 | // &tlen, bufLen - frameLen); |
| 1491 | // } // End if on Add TS. |
| 1492 | } |
| 1493 | } // End if on .11e enabled in 'pSta'. |
| 1494 | } // End if on QOS Mode on. |
| 1495 | |
| 1496 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1497 | { |
| 1498 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1499 | { |
| 1500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1501 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1502 | |
| 1503 | if ( pSta->wsmEnabled ) |
| 1504 | { |
| 1505 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1506 | } |
| 1507 | } |
| 1508 | } |
| 1509 | |
| 1510 | if ( pSta->aniPeer ) |
| 1511 | { |
| 1512 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1513 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1514 | { |
| 1515 | edcaInclude = 1; |
| 1516 | } |
| 1517 | |
| 1518 | } // End if on Airgo peer. |
| 1519 | |
| 1520 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1521 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1522 | { |
Krishna Kumaar Natarajan | 025a860 | 2015-08-04 16:31:36 +0530 | [diff] [blame] | 1523 | limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1524 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Sachin Ahuja | c3a2623 | 2014-09-23 22:27:30 +0530 | [diff] [blame] | 1525 | /* |
| 1526 | *Check the STA capability and update the HTCaps accordingly |
| 1527 | */ |
| 1528 | frm.HTCaps.supportedChannelWidthSet = |
| 1529 | (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ? |
| 1530 | pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ; |
| 1531 | |
| 1532 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1533 | frm.HTCaps.shortGI40MHz = 0; |
| 1534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1535 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1536 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 1537 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 1538 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 1539 | frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave, |
| 1540 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz, |
| 1541 | frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor); |
| 1542 | |
| 1543 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1544 | |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1545 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1546 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 1547 | * when operating in HT40 in 2.4GHz. |
| 1548 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 1549 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 1550 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1551 | { |
| 1552 | PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters, |
| 1553 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 1554 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 1555 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 1556 | * Mode in 40 MHz bit in HT capablity. |
| 1557 | */ |
| 1558 | frm.HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1559 | } |
| 1560 | #endif |
| 1561 | |
| 1562 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1563 | #ifdef WLAN_FEATURE_11AC |
| 1564 | if( pSta->mlmStaContext.vhtCapability && |
| 1565 | psessionEntry->vhtCapability ) |
| 1566 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1567 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 1568 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 1569 | psessionEntry->currentOperChannel, eSIR_TRUE ); |
| 1570 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation, |
| 1571 | psessionEntry->currentOperChannel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1572 | } |
| 1573 | #endif |
| 1574 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1575 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1576 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1577 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1578 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1579 | &maxRetries ) != eSIR_SUCCESS ) |
| 1580 | limLog( pMac, LOGE, |
| 1581 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1582 | else |
| 1583 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1584 | &retryInterval ) != eSIR_SUCCESS) |
| 1585 | limLog( pMac, LOGE, |
| 1586 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1587 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1588 | PopulateDot11fTimeoutInterval( |
| 1589 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1590 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1591 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1592 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1593 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1594 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1595 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1596 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1597 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1598 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1599 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1600 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1601 | |
| 1602 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1603 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1604 | |
| 1605 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1606 | |
| 1607 | //Send message to HAL about beacon parameter change. |
| 1608 | if(beaconParams.paramChangeBitmap) |
| 1609 | { |
| 1610 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1611 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1612 | } |
| 1613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1614 | if ( pAssocReq != NULL ) |
| 1615 | { |
| 1616 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1617 | &addnIEPresent) != eSIR_SUCCESS) |
| 1618 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1619 | limLog(pMac, LOGP, FL("Unable to get " |
| 1620 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1621 | return; |
| 1622 | } |
| 1623 | |
| 1624 | if (addnIEPresent) |
| 1625 | { |
| 1626 | //Assoc rsp IE available |
| 1627 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1628 | &addnIELen) != eSIR_SUCCESS) |
| 1629 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1630 | limLog(pMac, LOGP, FL("Unable to get " |
| 1631 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1632 | return; |
| 1633 | } |
| 1634 | |
| 1635 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1636 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1637 | { |
| 1638 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1639 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1640 | { |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1641 | |
| 1642 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1643 | sizeof( tDot11fIEExtCap ), 0); |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 1644 | addStripoffIELen = addnIELen; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1645 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1646 | &addIE[0], |
| 1647 | &addStripoffIELen, |
| 1648 | &extractedExtCap ); |
| 1649 | if(eSIR_SUCCESS != nSirStatus) |
| 1650 | { |
| 1651 | limLog(pMac, LOG1, |
| 1652 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1653 | } |
| 1654 | else |
| 1655 | { |
| 1656 | addnIELen = addStripoffIELen; |
| 1657 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1658 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1659 | nBytes = nBytes + addnIELen; |
| 1660 | } |
| 1661 | } |
| 1662 | } |
| 1663 | } |
| 1664 | |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1665 | /* merge the ExtCap struct*/ |
| 1666 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1667 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 1668 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap, true); |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1669 | } |
| 1670 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1671 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1672 | if ( DOT11F_FAILED( nStatus ) ) |
| 1673 | { |
| 1674 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1675 | "or an Association Response (0x%08x)."), |
| 1676 | nStatus ); |
| 1677 | return; |
| 1678 | } |
| 1679 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1680 | { |
| 1681 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1682 | "the packed size for an Association Re" |
| 1683 | "sponse (0x%08x)."), nStatus ); |
| 1684 | } |
| 1685 | |
| 1686 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1687 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1688 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1689 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1690 | ( void** ) &pPacket ); |
| 1691 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1692 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1693 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1694 | return; |
| 1695 | } |
| 1696 | |
| 1697 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1698 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1699 | |
| 1700 | // Next, we fill out the buffer descriptor: |
| 1701 | nSirStatus = limPopulateMacHeader( pMac, |
| 1702 | pFrame, |
| 1703 | SIR_MAC_MGMT_FRAME, |
| 1704 | ( LIM_ASSOC == subType ) ? |
| 1705 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1706 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1707 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1708 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1709 | { |
| 1710 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1711 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | nSirStatus ); |
| 1713 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1714 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1715 | return; |
| 1716 | } |
| 1717 | |
| 1718 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1720 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1721 | |
| 1722 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1723 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1724 | nPayload, &nPayload ); |
| 1725 | if ( DOT11F_FAILED( nStatus ) ) |
| 1726 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1727 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1728 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1729 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1730 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1731 | return; // allocated! |
| 1732 | } |
| 1733 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1734 | { |
| 1735 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1736 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | } |
| 1738 | |
| 1739 | macAddr = pMacHdr->da; |
| 1740 | |
| 1741 | if (subType == LIM_ASSOC) |
| 1742 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1743 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1744 | FL("*** Sending Assoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1745 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1746 | } |
| 1747 | else{ |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1748 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1749 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1750 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1751 | } |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1752 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1753 | |
| 1754 | if ( addnIEPresent ) |
| 1755 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1756 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1757 | } |
| 1758 | |
| 1759 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1760 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1761 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1762 | ) |
| 1763 | { |
| 1764 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1765 | } |
| 1766 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1767 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1768 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1769 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1770 | |
| 1771 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1772 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1773 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1774 | psessionEntry->peSessionId, |
| 1775 | pMacHdr->fc.subType)); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1776 | |
| 1777 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 1778 | { |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1779 | limLog(pMac, LOG1, FL("Re/AssocRsp - txBdToken %u"), |
| 1780 | pMac->lim.txBdToken); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1781 | /// Queue Association Response frame in high priority WQ |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1782 | if (tx_complete_context) |
| 1783 | { |
| 1784 | tx_complete_context->txBdToken = pMac->lim.txBdToken; |
| 1785 | halstatus = halTxFrameWithTxComplete(pMac, pPacket, |
| 1786 | (tANI_U16) nBytes, |
| 1787 | HAL_TXRX_FRM_802_11_MGMT, |
| 1788 | ANI_TXDIR_TODS, |
| 1789 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1790 | limTxComplete, pFrame, limAssocRspTxCompleteCnf, |
| 1791 | txFlag, pMac->lim.txBdToken); |
| 1792 | } |
| 1793 | else |
| 1794 | halstatus = halTxFrameWithTxComplete(pMac, pPacket, |
| 1795 | (tANI_U16) nBytes, |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1796 | HAL_TXRX_FRM_802_11_MGMT, |
| 1797 | ANI_TXDIR_TODS, |
| 1798 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1799 | limTxComplete, pFrame, limTxBdComplete, |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1800 | txFlag, pMac->lim.txBdToken); |
| 1801 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1802 | pMac->lim.txBdToken++; |
| 1803 | } |
| 1804 | else |
| 1805 | { |
| 1806 | /// Queue Association Response frame in high priority WQ |
| 1807 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1808 | HAL_TXRX_FRM_802_11_MGMT, |
| 1809 | ANI_TXDIR_TODS, |
| 1810 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1811 | limTxComplete, pFrame, txFlag ); |
| 1812 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1813 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1814 | psessionEntry->peSessionId, |
| 1815 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1816 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1817 | { |
| 1818 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1819 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | nSirStatus); |
| 1821 | |
| 1822 | //Pkt will be freed up by the callback |
| 1823 | } |
| 1824 | |
| 1825 | // update the ANI peer station count |
| 1826 | //FIXME_PROTECTION : take care of different type of station |
| 1827 | // counter inside this function. |
| 1828 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1829 | |
| 1830 | } // End limSendAssocRspMgmtFrame. |
| 1831 | |
| 1832 | |
| 1833 | |
| 1834 | void |
| 1835 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1836 | tSirMacAddr peer, |
| 1837 | tANI_U16 nStatusCode, |
| 1838 | tSirAddtsReqInfo *pAddTS, |
| 1839 | tSirMacScheduleIE *pSchedule, |
| 1840 | tpPESession psessionEntry) |
| 1841 | { |
| 1842 | tANI_U8 *pFrame; |
| 1843 | tpSirMacMgmtHdr pMacHdr; |
| 1844 | tDot11fAddTSResponse AddTSRsp; |
| 1845 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1846 | tSirRetStatus nSirStatus; |
| 1847 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1848 | void *pPacket; |
| 1849 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1850 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1851 | |
| 1852 | if(NULL == psessionEntry) |
| 1853 | { |
| 1854 | return; |
| 1855 | } |
| 1856 | |
| 1857 | if ( ! pAddTS->wmeTspecPresent ) |
| 1858 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1859 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1860 | |
| 1861 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1862 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1863 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1864 | AddTSRsp.Status.status = nStatusCode; |
| 1865 | |
| 1866 | // The TsDelay information element is only filled in for a specific |
| 1867 | // status code: |
| 1868 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1869 | { |
| 1870 | if ( pAddTS->wsmTspecPresent ) |
| 1871 | { |
| 1872 | AddTSRsp.WMMTSDelay.version = 1; |
| 1873 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1874 | AddTSRsp.WMMTSDelay.present = 1; |
| 1875 | } |
| 1876 | else |
| 1877 | { |
| 1878 | AddTSRsp.TSDelay.delay = 10; |
| 1879 | AddTSRsp.TSDelay.present = 1; |
| 1880 | } |
| 1881 | } |
| 1882 | |
| 1883 | if ( pAddTS->wsmTspecPresent ) |
| 1884 | { |
| 1885 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1886 | } |
| 1887 | else |
| 1888 | { |
| 1889 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1890 | } |
| 1891 | |
| 1892 | if ( pAddTS->wsmTspecPresent ) |
| 1893 | { |
| 1894 | AddTSRsp.num_WMMTCLAS = 0; |
| 1895 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1896 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1897 | { |
| 1898 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1899 | &AddTSRsp.TCLAS[i] ); |
| 1900 | } |
| 1901 | } |
| 1902 | else |
| 1903 | { |
| 1904 | AddTSRsp.num_TCLAS = 0; |
| 1905 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1906 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1907 | { |
| 1908 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1909 | &AddTSRsp.WMMTCLAS[i] ); |
| 1910 | } |
| 1911 | } |
| 1912 | |
| 1913 | if ( pAddTS->tclasProcPresent ) |
| 1914 | { |
| 1915 | if ( pAddTS->wsmTspecPresent ) |
| 1916 | { |
| 1917 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1918 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1919 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1920 | } |
| 1921 | else |
| 1922 | { |
| 1923 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1924 | AddTSRsp.TCLASSPROC.present = 1; |
| 1925 | } |
| 1926 | } |
| 1927 | |
| 1928 | // schedule element is included only if requested in the tspec and we are |
| 1929 | // using hcca (or both edca and hcca) |
| 1930 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1931 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1932 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1933 | // sta figure it out |
| 1934 | if ((pSchedule != NULL) && |
| 1935 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1936 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1937 | { |
| 1938 | if ( pAddTS->wsmTspecPresent ) |
| 1939 | { |
| 1940 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1941 | } |
| 1942 | else |
| 1943 | { |
| 1944 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1945 | } |
| 1946 | } |
| 1947 | |
| 1948 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1949 | if ( DOT11F_FAILED( nStatus ) ) |
| 1950 | { |
| 1951 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1952 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1953 | nStatus ); |
| 1954 | // We'll fall back on the worst case scenario: |
| 1955 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1956 | } |
| 1957 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1958 | { |
| 1959 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1960 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1961 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1962 | } |
| 1963 | } |
| 1964 | else |
| 1965 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1966 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1967 | |
| 1968 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1969 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1970 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1971 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1972 | |
| 1973 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1974 | |
| 1975 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1976 | if ( DOT11F_FAILED( nStatus ) ) |
| 1977 | { |
| 1978 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1979 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1980 | nStatus ); |
| 1981 | // We'll fall back on the worst case scenario: |
| 1982 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1983 | } |
| 1984 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1985 | { |
| 1986 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1987 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1988 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1989 | } |
| 1990 | } |
| 1991 | |
| 1992 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1993 | |
| 1994 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1995 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1996 | { |
| 1997 | 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] | 1998 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1999 | return; |
| 2000 | } |
| 2001 | |
| 2002 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2003 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | |
| 2005 | // Next, we fill out the buffer descriptor: |
| 2006 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2007 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 2008 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2009 | { |
| 2010 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2011 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | nSirStatus ); |
| 2013 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2014 | return; // allocated! |
| 2015 | } |
| 2016 | |
| 2017 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2018 | |
| 2019 | |
| 2020 | #if 0 |
| 2021 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2022 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2023 | { |
| 2024 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2025 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2026 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2027 | return; // allocated! |
| 2028 | } |
| 2029 | #endif //TO SUPPORT BT-AMP |
| 2030 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 2031 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2032 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2033 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2034 | #endif |
| 2035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | // That done, pack the struct: |
| 2037 | if ( ! pAddTS->wmeTspecPresent ) |
| 2038 | { |
| 2039 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 2040 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2041 | nPayload, &nPayload ); |
| 2042 | if ( DOT11F_FAILED( nStatus ) ) |
| 2043 | { |
| 2044 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2045 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2046 | nStatus ); |
| 2047 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2048 | return; |
| 2049 | } |
| 2050 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2051 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2052 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2053 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2054 | } |
| 2055 | } |
| 2056 | else |
| 2057 | { |
| 2058 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 2059 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2060 | nPayload, &nPayload ); |
| 2061 | if ( DOT11F_FAILED( nStatus ) ) |
| 2062 | { |
| 2063 | 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] | 2064 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2065 | nStatus ); |
| 2066 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2067 | return; |
| 2068 | } |
| 2069 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2070 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2071 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2072 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2073 | } |
| 2074 | } |
| 2075 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2076 | limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2077 | nStatusCode ); |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2078 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2079 | |
| 2080 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2082 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2083 | ) |
| 2084 | { |
| 2085 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2086 | } |
| 2087 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2088 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2089 | psessionEntry->peSessionId, |
| 2090 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2091 | // Queue the frame in high priority WQ: |
| 2092 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2093 | HAL_TXRX_FRM_802_11_MGMT, |
| 2094 | ANI_TXDIR_TODS, |
| 2095 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2096 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2097 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2098 | psessionEntry->peSessionId, |
| 2099 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2100 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2101 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2102 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2103 | nSirStatus ); |
| 2104 | //Pkt will be freed up by the callback |
| 2105 | } |
| 2106 | |
| 2107 | } // End limSendAddtsRspActionFrame. |
| 2108 | |
| 2109 | void |
| 2110 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 2111 | tSirMacAddr peer, |
| 2112 | tANI_U8 wmmTspecPresent, |
| 2113 | tSirMacTSInfo *pTsinfo, |
| 2114 | tSirMacTspecIE *pTspecIe, |
| 2115 | tpPESession psessionEntry) |
| 2116 | { |
| 2117 | tANI_U8 *pFrame; |
| 2118 | tpSirMacMgmtHdr pMacHdr; |
| 2119 | tDot11fDelTS DelTS; |
| 2120 | tDot11fWMMDelTS WMMDelTS; |
| 2121 | tSirRetStatus nSirStatus; |
| 2122 | tANI_U32 nBytes, nPayload, nStatus; |
| 2123 | void *pPacket; |
| 2124 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2125 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2126 | |
| 2127 | if(NULL == psessionEntry) |
| 2128 | { |
| 2129 | return; |
| 2130 | } |
| 2131 | |
| 2132 | if ( ! wmmTspecPresent ) |
| 2133 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2134 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2135 | |
| 2136 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2137 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2138 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2139 | |
| 2140 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2141 | if ( DOT11F_FAILED( nStatus ) ) |
| 2142 | { |
| 2143 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2144 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2145 | nStatus ); |
| 2146 | // We'll fall back on the worst case scenario: |
| 2147 | nPayload = sizeof( tDot11fDelTS ); |
| 2148 | } |
| 2149 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2150 | { |
| 2151 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2152 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2153 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2154 | } |
| 2155 | } |
| 2156 | else |
| 2157 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2158 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2159 | |
| 2160 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2161 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2162 | WMMDelTS.DialogToken.token = 0; |
| 2163 | WMMDelTS.StatusCode.statusCode = 0; |
| 2164 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2165 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2166 | if ( DOT11F_FAILED( nStatus ) ) |
| 2167 | { |
| 2168 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2169 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2170 | nStatus ); |
| 2171 | // We'll fall back on the worst case scenario: |
| 2172 | nPayload = sizeof( tDot11fDelTS ); |
| 2173 | } |
| 2174 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2175 | { |
| 2176 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2177 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2178 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | } |
| 2180 | } |
| 2181 | |
| 2182 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2183 | |
| 2184 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2185 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2186 | { |
| 2187 | 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] | 2188 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2189 | return; |
| 2190 | } |
| 2191 | |
| 2192 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2193 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | |
| 2195 | // Next, we fill out the buffer descriptor: |
| 2196 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2197 | SIR_MAC_MGMT_ACTION, peer, |
| 2198 | psessionEntry->selfMacAddr); |
| 2199 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2200 | { |
| 2201 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2202 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2203 | nSirStatus ); |
| 2204 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2205 | return; // allocated! |
| 2206 | } |
| 2207 | |
| 2208 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2209 | |
| 2210 | #if 0 |
| 2211 | |
| 2212 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2213 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2214 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2215 | { |
| 2216 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2217 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2219 | return; // allocated! |
| 2220 | } |
| 2221 | #endif //TO SUPPORT BT-AMP |
| 2222 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2223 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2224 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2225 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2226 | #endif |
| 2227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2228 | // That done, pack the struct: |
| 2229 | if ( !wmmTspecPresent ) |
| 2230 | { |
| 2231 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2232 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2233 | nPayload, &nPayload ); |
| 2234 | if ( DOT11F_FAILED( nStatus ) ) |
| 2235 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2236 | 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] | 2237 | nStatus ); |
| 2238 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2239 | return; // allocated! |
| 2240 | } |
| 2241 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2242 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2243 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2244 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2245 | } |
| 2246 | } |
| 2247 | else |
| 2248 | { |
| 2249 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2250 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2251 | nPayload, &nPayload ); |
| 2252 | if ( DOT11F_FAILED( nStatus ) ) |
| 2253 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2254 | 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] | 2255 | nStatus ); |
| 2256 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2257 | return; // allocated! |
| 2258 | } |
| 2259 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2260 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2261 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2262 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2263 | } |
| 2264 | } |
| 2265 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2266 | limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2267 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | |
| 2269 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2270 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2271 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | ) |
| 2273 | { |
| 2274 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2275 | } |
| 2276 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2277 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2278 | psessionEntry->peSessionId, |
| 2279 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2280 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2281 | HAL_TXRX_FRM_802_11_MGMT, |
| 2282 | ANI_TXDIR_TODS, |
| 2283 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2284 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2285 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2286 | psessionEntry->peSessionId, |
| 2287 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2288 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2289 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2290 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | nSirStatus ); |
| 2292 | //Pkt will be freed up by the callback |
| 2293 | } |
| 2294 | |
| 2295 | } // End limSendDeltsReqActionFrame. |
| 2296 | |
| 2297 | void |
| 2298 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2299 | tLimMlmAssocReq *pMlmAssocReq, |
| 2300 | tpPESession psessionEntry) |
| 2301 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2302 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2303 | tANI_U16 caps; |
| 2304 | tANI_U8 *pFrame; |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2305 | tSirRetStatus nSirStatus = eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2306 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2307 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2308 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2309 | void *pPacket; |
| 2310 | eHalStatus halstatus; |
| 2311 | tANI_U16 nAddIELen; |
| 2312 | tANI_U8 *pAddIE; |
| 2313 | tANI_U8 *wpsIe = NULL; |
| 2314 | #if defined WLAN_FEATURE_VOWIFI |
| 2315 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2316 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2317 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2318 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2319 | tDot11fIEExtCap extractedExtCap; |
| 2320 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2321 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2322 | |
| 2323 | if(NULL == psessionEntry) |
| 2324 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2325 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2326 | return; |
| 2327 | } |
| 2328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2329 | /* check this early to avoid unncessary operation */ |
| 2330 | if(NULL == psessionEntry->pLimJoinReq) |
| 2331 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2332 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2333 | return; |
| 2334 | } |
| 2335 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2336 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2337 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2338 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2339 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2340 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2341 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2342 | return; |
| 2343 | } |
| 2344 | |
| 2345 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2346 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2347 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2348 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 2349 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2350 | { |
| 2351 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2352 | &nAddIELen, |
| 2353 | &extractedExtCap ); |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2354 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2355 | if(eSIR_SUCCESS != nSirStatus ) |
| 2356 | { |
| 2357 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2358 | limLog(pMac, LOG1, |
| 2359 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2360 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2361 | /* TODO:remove this code once driver provides the call back function |
| 2362 | * to supplicant for set_qos_map |
| 2363 | */ |
| 2364 | else |
| 2365 | { |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 2366 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *)extractedExtCap.bytes; |
| 2367 | if (p_ext_cap->interworkingService) { |
| 2368 | p_ext_cap->qosMap = 1; |
| 2369 | } |
| 2370 | extractedExtCap.num_bytes = lim_compute_ext_cap_ie_length(&extractedExtCap); |
| 2371 | extractedExtCapFlag = (extractedExtCap.num_bytes > 0); |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2372 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2374 | caps = pMlmAssocReq->capabilityInfo; |
| 2375 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2376 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2377 | #if defined(FEATURE_WLAN_WAPI) |
| 2378 | /* CR: 262463 : |
| 2379 | According to WAPI standard: |
| 2380 | 7.3.1.4 Capability Information field |
| 2381 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2382 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2383 | Reassociation management frames. */ |
| 2384 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2385 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2386 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2387 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2388 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2389 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2390 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2391 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2392 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2393 | |
| 2394 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2395 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2396 | |
| 2397 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2398 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2399 | |
| 2400 | // We prefer .11e asociations: |
| 2401 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2402 | |
| 2403 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2404 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2405 | |
| 2406 | if ( psessionEntry->lim11hEnable && |
| 2407 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2408 | { |
| 2409 | #if defined WLAN_FEATURE_VOWIFI |
| 2410 | PowerCapsPopulated = TRUE; |
| 2411 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2412 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2414 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | |
| 2416 | } |
| 2417 | |
| 2418 | #if defined WLAN_FEATURE_VOWIFI |
| 2419 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2420 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2421 | { |
| 2422 | if (PowerCapsPopulated == FALSE) |
| 2423 | { |
| 2424 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2425 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2426 | } |
| 2427 | } |
| 2428 | #endif |
| 2429 | |
| 2430 | if ( fQosEnabled && |
| 2431 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2432 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2433 | |
| 2434 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2435 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2436 | |
| 2437 | #if defined WLAN_FEATURE_VOWIFI |
| 2438 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2439 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2440 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2441 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2442 | } |
| 2443 | #endif |
| 2444 | // The join request *should* contain zero or one of the WPA and RSN |
| 2445 | // IEs. The payload send along with the request is a |
| 2446 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2447 | |
| 2448 | // typedef struct sSirRSNie |
| 2449 | // { |
| 2450 | // tANI_U16 length; |
| 2451 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2452 | // } tSirRSNie, *tpSirRSNie; |
| 2453 | |
| 2454 | // So, we should be able to make the following two calls harmlessly, |
| 2455 | // since they do nothing if they don't find the given IE in the |
| 2456 | // bytestream with which they're provided. |
| 2457 | |
| 2458 | // The net effect of this will be to faithfully transmit whatever |
| 2459 | // security IE is in the join request. |
| 2460 | |
| 2461 | // *However*, if we're associating for the purpose of WPS |
| 2462 | // enrollment, and we've been configured to indicate that by |
| 2463 | // eliding the WPA or RSN IE, we just skip this: |
| 2464 | if( nAddIELen && pAddIE ) |
| 2465 | { |
| 2466 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2467 | } |
| 2468 | if ( NULL == wpsIe ) |
| 2469 | { |
| 2470 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2471 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2472 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2473 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2474 | #if defined(FEATURE_WLAN_WAPI) |
| 2475 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2476 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2477 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2478 | } |
| 2479 | |
| 2480 | // include WME EDCA IE as well |
| 2481 | if ( fWmeEnabled ) |
| 2482 | { |
| 2483 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2484 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2485 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | } |
| 2487 | |
| 2488 | if ( fWsmEnabled && |
| 2489 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2490 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2491 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2492 | } |
| 2493 | } |
| 2494 | |
| 2495 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2496 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2497 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2498 | pMac->lim.htCapabilityPresentInBeacon) |
| 2499 | { |
Krishna Kumaar Natarajan | 025a860 | 2015-08-04 16:31:36 +0530 | [diff] [blame] | 2500 | limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2501 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2502 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2503 | |
| 2504 | /* |
| 2505 | * To resolve the interop problem with Broadcom AP, |
| 2506 | * where TQ STA could not pass traffic with GF enabled, |
| 2507 | * TQ STA will do Greenfield only with TQ AP, for |
| 2508 | * everybody else it will be turned off. |
| 2509 | */ |
| 2510 | |
| 2511 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2512 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2513 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2514 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2515 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2516 | } |
| 2517 | #endif |
| 2518 | |
| 2519 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 2520 | |
| 2521 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 2522 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 2523 | pFrm->HTCaps.supportedChannelWidthSet, pFrm->HTCaps.mimoPowerSave, |
| 2524 | pFrm->HTCaps.greenField, pFrm->HTCaps.shortGI20MHz, pFrm->HTCaps.shortGI40MHz, |
| 2525 | pFrm->HTCaps.dsssCckMode40MHz, pFrm->HTCaps.maxRxAMPDUFactor); |
| 2526 | |
| 2527 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2528 | #ifdef WLAN_FEATURE_11AC |
| 2529 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2530 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2531 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2532 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 2533 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, |
| 2534 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 2535 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2536 | } |
| 2537 | #endif |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 2538 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2539 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2540 | |
| 2541 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2542 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2543 | { |
| 2544 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2545 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2546 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2547 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2548 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2549 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2550 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2551 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2553 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2554 | { |
| 2555 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2556 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2557 | } |
| 2558 | #endif |
| 2559 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2560 | #ifdef FEATURE_WLAN_ESE |
| 2561 | /* For ESE Associations fill the ESE IEs */ |
| 2562 | if (psessionEntry->isESEconnection && |
| 2563 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2564 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2565 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2566 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2567 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2568 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2569 | } |
| 2570 | #endif |
| 2571 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2572 | /* merge the ExtCap struct*/ |
| 2573 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2574 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 2575 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap, true); |
| 2576 | } |
| 2577 | |
| 2578 | if (pFrm->ExtCap.present && psessionEntry->ExtCap.present) { |
| 2579 | limMergeExtCapIEStruct(&pFrm->ExtCap, &psessionEntry->ExtCap, false); |
| 2580 | limLog(pMac, LOG1, |
| 2581 | FL("Clear the bits in EXTCAP IE that AP don't support to avoid IoT issues.")); |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2582 | } |
| 2583 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2584 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2585 | if ( DOT11F_FAILED( nStatus ) ) |
| 2586 | { |
| 2587 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2588 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2589 | nStatus ); |
| 2590 | // We'll fall back on the worst case scenario: |
| 2591 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2592 | } |
| 2593 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2594 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2595 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2596 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2597 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2598 | } |
| 2599 | |
| 2600 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2601 | |
| 2602 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2603 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2604 | ( void** ) &pPacket ); |
| 2605 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2606 | { |
| 2607 | 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] | 2608 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2609 | |
| 2610 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2611 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2612 | |
| 2613 | |
| 2614 | /* Update PE session id*/ |
| 2615 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2616 | |
| 2617 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2619 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2620 | ( tANI_U32* ) &mlmAssocCnf); |
| 2621 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2622 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2623 | return; |
| 2624 | } |
| 2625 | |
| 2626 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2627 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2628 | |
| 2629 | // Next, we fill out the buffer descriptor: |
| 2630 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2631 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2632 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2633 | { |
| 2634 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2635 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2636 | nSirStatus ); |
| 2637 | 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] | 2638 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2639 | return; |
| 2640 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2641 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2642 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2643 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2644 | sizeof(tSirMacMgmtHdr), |
| 2645 | nPayload, &nPayload ); |
| 2646 | if ( DOT11F_FAILED( nStatus ) ) |
| 2647 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2648 | 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] | 2649 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2650 | nStatus ); |
| 2651 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2652 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2653 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2654 | return; |
| 2655 | } |
| 2656 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2657 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2658 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2659 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2660 | } |
| 2661 | |
| 2662 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2663 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2664 | nBytes );) |
| 2665 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2666 | |
| 2667 | if( psessionEntry->assocReq != NULL ) |
| 2668 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2669 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2670 | psessionEntry->assocReq = NULL; |
| 2671 | } |
| 2672 | |
| 2673 | if( nAddIELen ) |
| 2674 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2675 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2676 | pAddIE, |
| 2677 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2678 | nPayload += nAddIELen; |
| 2679 | } |
| 2680 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2681 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2682 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2684 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2685 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2686 | } |
| 2687 | else |
| 2688 | { |
| 2689 | //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] | 2690 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2691 | psessionEntry->assocReqLen = nPayload; |
| 2692 | } |
| 2693 | |
| 2694 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2695 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2696 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2697 | ) |
| 2698 | { |
| 2699 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2700 | } |
| 2701 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 2702 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 2703 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2704 | { |
| 2705 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2706 | } |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 2707 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 2708 | limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_START_EVENT, psessionEntry, |
| 2709 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 2710 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2711 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2712 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2713 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2714 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2715 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2716 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2717 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2718 | psessionEntry->peSessionId, |
| 2719 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 2720 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 2721 | if( ( psessionEntry->is11Gonly == true ) && |
| 2722 | ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){ |
| 2723 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2724 | } |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 2725 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 2726 | { |
| 2727 | limLog(pMac, LOG1, FL("Assoc Req - txBdToken %u"), pMac->lim.txBdToken); |
| 2728 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 2729 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2730 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2731 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2732 | limTxComplete, pFrame, limTxBdComplete, txFlag, |
| 2733 | pMac->lim.txBdToken); |
| 2734 | pMac->lim.txBdToken++; |
| 2735 | } |
| 2736 | else |
| 2737 | { |
| 2738 | halstatus = halTxFrame( pMac, pPacket, |
| 2739 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2740 | HAL_TXRX_FRM_802_11_MGMT, |
| 2741 | ANI_TXDIR_TODS, |
| 2742 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2743 | limTxComplete, pFrame, txFlag ); |
| 2744 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2745 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2746 | psessionEntry->peSessionId, |
| 2747 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2748 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2749 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2750 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2751 | halstatus ); |
| 2752 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2753 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2754 | return; |
| 2755 | } |
| 2756 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 2757 | //Enable caching only if Assoc Request is successfully submitted to the h/w |
| 2758 | WLANTL_EnableCaching(psessionEntry->staId); |
| 2759 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2760 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2761 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2762 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2763 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2764 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2765 | } // End limSendAssocReqMgmtFrame |
| 2766 | |
| 2767 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2768 | #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] | 2769 | /*------------------------------------------------------------------------------------ |
| 2770 | * |
| 2771 | * Send Reassoc Req with FTIEs. |
| 2772 | * |
| 2773 | *----------------------------------------------------------------------------------- |
| 2774 | */ |
| 2775 | void |
| 2776 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2777 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2778 | { |
| 2779 | static tDot11fReAssocRequest frm; |
| 2780 | tANI_U16 caps; |
| 2781 | tANI_U8 *pFrame; |
| 2782 | tSirRetStatus nSirStatus; |
| 2783 | tANI_U32 nBytes, nPayload, nStatus; |
| 2784 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2785 | void *pPacket; |
| 2786 | eHalStatus halstatus; |
| 2787 | #if defined WLAN_FEATURE_VOWIFI |
| 2788 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2789 | #endif |
| 2790 | tANI_U16 ft_ies_length = 0; |
| 2791 | tANI_U8 *pBody; |
| 2792 | tANI_U16 nAddIELen; |
| 2793 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2794 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2795 | tANI_U8 *wpsIe = NULL; |
| 2796 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2797 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2798 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2799 | |
| 2800 | if (NULL == psessionEntry) |
| 2801 | { |
| 2802 | return; |
| 2803 | } |
| 2804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2805 | /* check this early to avoid unncessary operation */ |
| 2806 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2807 | { |
| 2808 | return; |
| 2809 | } |
| 2810 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2811 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2812 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2813 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2814 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2815 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2816 | |
| 2817 | caps = pMlmReassocReq->capabilityInfo; |
| 2818 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2819 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2820 | #if defined(FEATURE_WLAN_WAPI) |
| 2821 | /* CR: 262463 : |
| 2822 | According to WAPI standard: |
| 2823 | 7.3.1.4 Capability Information field |
| 2824 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2825 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2826 | Reassociation management frames. */ |
| 2827 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2828 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2829 | #endif |
| 2830 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2831 | |
| 2832 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2833 | |
| 2834 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2835 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2837 | |
| 2838 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2839 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2840 | &frm.SuppRates,psessionEntry); |
| 2841 | |
| 2842 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2843 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2844 | |
| 2845 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2846 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2847 | |
| 2848 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2849 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2850 | |
| 2851 | if ( psessionEntry->lim11hEnable && |
| 2852 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2853 | { |
| 2854 | #if defined WLAN_FEATURE_VOWIFI |
| 2855 | PowerCapsPopulated = TRUE; |
| 2856 | |
| 2857 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2858 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2859 | #endif |
| 2860 | } |
| 2861 | |
| 2862 | #if defined WLAN_FEATURE_VOWIFI |
| 2863 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2864 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2865 | { |
| 2866 | if (PowerCapsPopulated == FALSE) |
| 2867 | { |
| 2868 | PowerCapsPopulated = TRUE; |
| 2869 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2870 | } |
| 2871 | } |
| 2872 | #endif |
| 2873 | |
| 2874 | if ( fQosEnabled && |
| 2875 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2876 | { |
| 2877 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2878 | } |
| 2879 | |
| 2880 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2881 | &frm.ExtSuppRates, psessionEntry ); |
| 2882 | |
| 2883 | #if defined WLAN_FEATURE_VOWIFI |
| 2884 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2885 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2886 | { |
| 2887 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2888 | } |
| 2889 | #endif |
| 2890 | |
| 2891 | // Ideally this should be enabled for 11r also. But 11r does |
| 2892 | // not follow the usual norm of using the Opaque object |
| 2893 | // for rsnie and fties. Instead we just add |
| 2894 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2895 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2896 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2897 | // |
| 2898 | // The join request *should* contain zero or one of the WPA and RSN |
| 2899 | // IEs. The payload send along with the request is a |
| 2900 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2901 | |
| 2902 | // typedef struct sSirRSNie |
| 2903 | // { |
| 2904 | // tANI_U16 length; |
| 2905 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2906 | // } tSirRSNie, *tpSirRSNie; |
| 2907 | |
| 2908 | // So, we should be able to make the following two calls harmlessly, |
| 2909 | // since they do nothing if they don't find the given IE in the |
| 2910 | // bytestream with which they're provided. |
| 2911 | |
| 2912 | // The net effect of this will be to faithfully transmit whatever |
| 2913 | // security IE is in the join request. |
| 2914 | |
| 2915 | // *However*, if we're associating for the purpose of WPS |
| 2916 | // enrollment, and we've been configured to indicate that by |
| 2917 | // eliding the WPA or RSN IE, we just skip this: |
| 2918 | if (!psessionEntry->is11Rconnection) |
| 2919 | { |
| 2920 | if( nAddIELen && pAddIE ) |
| 2921 | { |
| 2922 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2923 | } |
| 2924 | if ( NULL == wpsIe ) |
| 2925 | { |
| 2926 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2927 | &frm.RSNOpaque ); |
| 2928 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2929 | &frm.WPAOpaque ); |
| 2930 | } |
| 2931 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2932 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2933 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2934 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2935 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2936 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2937 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2938 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2939 | } |
| 2940 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2941 | #ifdef FEATURE_WLAN_ESE |
| 2942 | // For ESE Associations fill the ESE IEs |
| 2943 | if (psessionEntry->isESEconnection && |
| 2944 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2945 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2946 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2947 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2948 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2949 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2950 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2951 | #endif //FEATURE_WLAN_ESE |
| 2952 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2953 | |
| 2954 | // include WME EDCA IE as well |
| 2955 | if ( fWmeEnabled ) |
| 2956 | { |
| 2957 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2958 | { |
| 2959 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2960 | } |
| 2961 | |
| 2962 | if ( fWsmEnabled && |
| 2963 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2964 | { |
| 2965 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2966 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2967 | #ifdef FEATURE_WLAN_ESE |
| 2968 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2969 | { |
| 2970 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2971 | |
| 2972 | // 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] | 2973 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2974 | { |
| 2975 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2976 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2977 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2978 | |
| 2979 | tsrsIE.tsid = 0; |
| 2980 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2981 | { |
| 2982 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2983 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2984 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | { |
| 2986 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2987 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2988 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2989 | } |
| 2990 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2991 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2992 | } |
| 2993 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2994 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2995 | pMac->lim.htCapabilityPresentInBeacon) |
| 2996 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2997 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2998 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 2999 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 3000 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 3001 | frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave, |
| 3002 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz, |
| 3003 | frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor); |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3004 | #if defined WLAN_FEATURE_VOWIFI_11R |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 3005 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && |
| 3006 | (pMac->ft.ftSmeContext.addMDIE == TRUE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3007 | #if defined FEATURE_WLAN_ESE |
| 3008 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 3009 | #endif |
| 3010 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3011 | { |
| 3012 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 3013 | } |
| 3014 | #endif |
| 3015 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3016 | #ifdef WLAN_FEATURE_11AC |
| 3017 | if ( psessionEntry->vhtCapability && |
| 3018 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 3019 | { |
| 3020 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 3021 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 3022 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 3023 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3024 | } |
| 3025 | #endif |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 3026 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 3027 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3029 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3030 | if ( DOT11F_FAILED( nStatus ) ) |
| 3031 | { |
| 3032 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3033 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3034 | nStatus ); |
| 3035 | // We'll fall back on the worst case scenario: |
| 3036 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3037 | } |
| 3038 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3039 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3040 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3041 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3042 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3043 | } |
| 3044 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3045 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3046 | |
| 3047 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 3048 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3049 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 3050 | #endif |
| 3051 | |
| 3052 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3053 | if (psessionEntry->is11Rconnection) |
| 3054 | { |
| 3055 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 3056 | } |
| 3057 | #endif |
| 3058 | |
| 3059 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3060 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 3061 | ( void** ) &pPacket ); |
| 3062 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3063 | { |
| 3064 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3065 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3066 | 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] | 3067 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3068 | goto end; |
| 3069 | } |
| 3070 | |
| 3071 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3072 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3073 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3074 | #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] | 3075 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3076 | #endif |
| 3077 | // Next, we fill out the buffer descriptor: |
| 3078 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3079 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3080 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3081 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3082 | { |
| 3083 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3084 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3085 | nSirStatus ); |
| 3086 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3087 | goto end; |
| 3088 | } |
| 3089 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3090 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3091 | // That done, pack the ReAssoc Request: |
| 3092 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3093 | sizeof(tSirMacMgmtHdr), |
| 3094 | nPayload, &nPayload ); |
| 3095 | if ( DOT11F_FAILED( nStatus ) ) |
| 3096 | { |
| 3097 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3098 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3099 | nStatus ); |
| 3100 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3101 | goto end; |
| 3102 | } |
| 3103 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3104 | { |
| 3105 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3106 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3107 | } |
| 3108 | |
| 3109 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3110 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | nBytes, nPayload );) |
| 3112 | if( psessionEntry->assocReq != NULL ) |
| 3113 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3114 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3115 | psessionEntry->assocReq = NULL; |
| 3116 | } |
| 3117 | |
| 3118 | if( nAddIELen ) |
| 3119 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3120 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3121 | pAddIE, |
| 3122 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3123 | nPayload += nAddIELen; |
| 3124 | } |
| 3125 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3126 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3127 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3128 | { |
| 3129 | 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] | 3130 | } |
| 3131 | else |
| 3132 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3133 | //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] | 3134 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3135 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3136 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3137 | |
| 3138 | if (psessionEntry->is11Rconnection) |
| 3139 | { |
| 3140 | { |
| 3141 | int i = 0; |
| 3142 | |
| 3143 | pBody = pFrame + nBytes; |
| 3144 | for (i=0; i<ft_ies_length; i++) |
| 3145 | { |
| 3146 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 3147 | pBody++; |
| 3148 | } |
| 3149 | } |
| 3150 | } |
| 3151 | |
| 3152 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3153 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 3154 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3155 | (tANI_U8 *)pFrame, |
| 3156 | (nBytes + ft_ies_length));) |
| 3157 | #endif |
| 3158 | |
| 3159 | |
| 3160 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3161 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3162 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3163 | ) |
| 3164 | { |
| 3165 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3166 | } |
| 3167 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3168 | if( NULL != psessionEntry->assocReq ) |
| 3169 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3170 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3171 | psessionEntry->assocReq = NULL; |
| 3172 | } |
Agrawal Ashish | ad64dc2 | 2016-02-04 11:32:15 +0530 | [diff] [blame] | 3173 | if (ft_ies_length) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3174 | { |
Agrawal Ashish | ad64dc2 | 2016-02-04 11:32:15 +0530 | [diff] [blame] | 3175 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3176 | if (NULL == psessionEntry->assocReq) |
| 3177 | { |
| 3178 | limLog(pMac, LOGE, |
| 3179 | FL("Unable to allocate memory for FT IEs")); |
| 3180 | psessionEntry->assocReqLen = 0; |
| 3181 | } |
| 3182 | else |
| 3183 | { |
| 3184 | /* Store the FT IEs. This is sent to csr/hdd in join cnf response.*/ |
| 3185 | vos_mem_copy(psessionEntry->assocReq, |
| 3186 | pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3187 | (ft_ies_length)); |
| 3188 | psessionEntry->assocReqLen = ft_ies_length; |
| 3189 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3190 | } |
| 3191 | else |
| 3192 | { |
Agrawal Ashish | ad64dc2 | 2016-02-04 11:32:15 +0530 | [diff] [blame] | 3193 | limLog(pMac, LOG1, FL("FT IEs not present")); |
| 3194 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3195 | } |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 3196 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 3197 | limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry, |
| 3198 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 3199 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3200 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3201 | psessionEntry->peSessionId, |
| 3202 | pMacHdr->fc.subType)); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3203 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3204 | { |
| 3205 | limLog( pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken); |
| 3206 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3207 | ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3208 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3209 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3210 | limTxComplete, pFrame, limTxBdComplete, txFlag, |
| 3211 | pMac->lim.txBdToken); |
| 3212 | pMac->lim.txBdToken++; |
| 3213 | } |
| 3214 | else |
| 3215 | { |
| 3216 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3217 | HAL_TXRX_FRM_802_11_MGMT, |
| 3218 | ANI_TXDIR_TODS, |
| 3219 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3220 | limTxComplete, pFrame, txFlag ); |
| 3221 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3222 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3223 | psessionEntry->peSessionId, |
| 3224 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3225 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3226 | { |
| 3227 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3228 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3229 | nSirStatus ); |
| 3230 | //Pkt will be freed up by the callback |
| 3231 | goto end; |
| 3232 | } |
| 3233 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 3234 | // Enable TL cahching in case of roaming |
| 3235 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3237 | end: |
| 3238 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3239 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3240 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3241 | |
| 3242 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3243 | |
| 3244 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3245 | tLimMlmReassocReq *pMlmReassocReq, |
| 3246 | tpPESession psessionEntry) |
| 3247 | { |
| 3248 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3249 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
Sachin Ahuja | 07a4301 | 2015-01-30 17:04:38 +0530 | [diff] [blame] | 3250 | #ifdef FEATURE_WLAN_ESE |
| 3251 | tANI_U32 val=0; |
| 3252 | #endif |
| 3253 | if (pMlmReassocReq == NULL) |
| 3254 | { |
| 3255 | limLog(pMac, LOGE, |
| 3256 | FL("Invalid pMlmReassocReq")); |
| 3257 | goto end; |
| 3258 | } |
Hema Aparna Medicharla | 43d0f7b | 2015-02-12 17:07:59 +0530 | [diff] [blame] | 3259 | |
| 3260 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3261 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3262 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3263 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3264 | |
| 3265 | // Prepare and send Reassociation request frame |
| 3266 | // start reassoc timer. |
Sachin Ahuja | 07a4301 | 2015-01-30 17:04:38 +0530 | [diff] [blame] | 3267 | #ifdef FEATURE_WLAN_ESE |
| 3268 | /* |
| 3269 | * In case of Ese Reassociation, change the reassoc timer |
| 3270 | * value. |
| 3271 | */ |
| 3272 | val = pMlmReassocReq->reassocFailureTimeout; |
| 3273 | if (psessionEntry->isESEconnection) |
| 3274 | { |
| 3275 | val = val/LIM_MAX_REASSOC_RETRY_LIMIT; |
| 3276 | } |
| 3277 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) != |
| 3278 | TX_SUCCESS) |
| 3279 | { |
| 3280 | limLog(pMac, LOGP, |
| 3281 | FL("unable to deactivate Reassoc failure timer")); |
| 3282 | } |
| 3283 | val = SYS_MS_TO_TICKS(val); |
| 3284 | if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer, |
| 3285 | val, 0) != TX_SUCCESS) |
| 3286 | { |
| 3287 | limLog(pMac, LOGP, |
| 3288 | FL("unable to change Reassociation failure timer")); |
| 3289 | } |
| 3290 | #endif |
| 3291 | |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3292 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3293 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3294 | 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] | 3295 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3296 | != TX_SUCCESS) |
| 3297 | { |
| 3298 | // Could not start reassoc failure timer. |
| 3299 | // Log error |
| 3300 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3301 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3302 | // Return Reassoc confirm with |
| 3303 | // Resources Unavailable |
| 3304 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3305 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3306 | goto end; |
| 3307 | } |
| 3308 | |
| 3309 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3310 | return; |
| 3311 | |
| 3312 | end: |
| 3313 | // Free up buffer allocated for reassocReq |
| 3314 | if (pMlmReassocReq != NULL) |
| 3315 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3316 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3317 | pMlmReassocReq = NULL; |
| 3318 | } |
| 3319 | if (pTmpMlmReassocReq != NULL) |
| 3320 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3321 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3322 | pTmpMlmReassocReq = NULL; |
| 3323 | } |
| 3324 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3325 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3326 | /* Update PE sessio Id*/ |
| 3327 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3328 | |
| 3329 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3330 | } |
| 3331 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3332 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3333 | |
| 3334 | |
| 3335 | void |
| 3336 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3337 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3338 | { |
| 3339 | static tDot11fReAssocRequest frm; |
| 3340 | tANI_U16 caps; |
| 3341 | tANI_U8 *pFrame; |
| 3342 | tSirRetStatus nSirStatus; |
| 3343 | tANI_U32 nBytes, nPayload, nStatus; |
| 3344 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3345 | void *pPacket; |
| 3346 | eHalStatus halstatus; |
| 3347 | tANI_U16 nAddIELen; |
| 3348 | tANI_U8 *pAddIE; |
| 3349 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3350 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3351 | #if defined WLAN_FEATURE_VOWIFI |
| 3352 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3353 | #endif |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3354 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3355 | |
| 3356 | if(NULL == psessionEntry) |
| 3357 | { |
| 3358 | return; |
| 3359 | } |
| 3360 | |
| 3361 | /* check this early to avoid unncessary operation */ |
| 3362 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3363 | { |
| 3364 | return; |
| 3365 | } |
| 3366 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3367 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3368 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3369 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3370 | |
| 3371 | caps = pMlmReassocReq->capabilityInfo; |
| 3372 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3373 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3374 | #if defined(FEATURE_WLAN_WAPI) |
| 3375 | /* CR: 262463 : |
| 3376 | According to WAPI standard: |
| 3377 | 7.3.1.4 Capability Information field |
| 3378 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3379 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3380 | Reassociation management frames. */ |
| 3381 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3382 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3383 | #endif |
| 3384 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3385 | |
| 3386 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3387 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3388 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3389 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3390 | |
| 3391 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3392 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3393 | &frm.SuppRates,psessionEntry); |
| 3394 | |
| 3395 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3396 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3397 | |
| 3398 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3399 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3400 | |
| 3401 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3402 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3403 | |
| 3404 | |
| 3405 | if ( psessionEntry->lim11hEnable && |
| 3406 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3407 | { |
| 3408 | #if defined WLAN_FEATURE_VOWIFI |
| 3409 | PowerCapsPopulated = TRUE; |
| 3410 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3411 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3412 | #endif |
| 3413 | } |
| 3414 | |
| 3415 | #if defined WLAN_FEATURE_VOWIFI |
| 3416 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3417 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3418 | { |
| 3419 | if (PowerCapsPopulated == FALSE) |
| 3420 | { |
| 3421 | PowerCapsPopulated = TRUE; |
| 3422 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3423 | } |
| 3424 | } |
| 3425 | #endif |
| 3426 | |
| 3427 | if ( fQosEnabled && |
| 3428 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3429 | { |
| 3430 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3431 | } |
| 3432 | |
| 3433 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3434 | &frm.ExtSuppRates, psessionEntry ); |
| 3435 | |
| 3436 | #if defined WLAN_FEATURE_VOWIFI |
| 3437 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3438 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3439 | { |
| 3440 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3441 | } |
| 3442 | #endif |
| 3443 | // The join request *should* contain zero or one of the WPA and RSN |
| 3444 | // IEs. The payload send along with the request is a |
| 3445 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3446 | |
| 3447 | // typedef struct sSirRSNie |
| 3448 | // { |
| 3449 | // tANI_U16 length; |
| 3450 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3451 | // } tSirRSNie, *tpSirRSNie; |
| 3452 | |
| 3453 | // So, we should be able to make the following two calls harmlessly, |
| 3454 | // since they do nothing if they don't find the given IE in the |
| 3455 | // bytestream with which they're provided. |
| 3456 | |
| 3457 | // The net effect of this will be to faithfully transmit whatever |
| 3458 | // security IE is in the join request. |
| 3459 | |
| 3460 | // *However*, if we're associating for the purpose of WPS |
| 3461 | // enrollment, and we've been configured to indicate that by |
| 3462 | // eliding the WPA or RSN IE, we just skip this: |
| 3463 | if( nAddIELen && pAddIE ) |
| 3464 | { |
| 3465 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3466 | } |
| 3467 | if ( NULL == wpsIe ) |
| 3468 | { |
| 3469 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3470 | &frm.RSNOpaque ); |
| 3471 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3472 | &frm.WPAOpaque ); |
| 3473 | #if defined(FEATURE_WLAN_WAPI) |
| 3474 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3475 | &frm.WAPIOpaque ); |
| 3476 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3477 | } |
| 3478 | |
| 3479 | // include WME EDCA IE as well |
| 3480 | if ( fWmeEnabled ) |
| 3481 | { |
| 3482 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3483 | { |
| 3484 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3485 | } |
| 3486 | |
| 3487 | if ( fWsmEnabled && |
| 3488 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3489 | { |
| 3490 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3491 | } |
| 3492 | } |
| 3493 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3494 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3495 | pMac->lim.htCapabilityPresentInBeacon) |
| 3496 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3497 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3498 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 3499 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 3500 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 3501 | frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave, |
| 3502 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz, |
| 3503 | frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3504 | #ifdef WLAN_FEATURE_11AC |
| 3505 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3506 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3507 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3508 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 3509 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 3510 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 3511 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 3512 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3513 | } |
| 3514 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3515 | |
| 3516 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3517 | if ( DOT11F_FAILED( nStatus ) ) |
| 3518 | { |
| 3519 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3520 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3521 | nStatus ); |
| 3522 | // We'll fall back on the worst case scenario: |
| 3523 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3524 | } |
| 3525 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3526 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3527 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3528 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3529 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | } |
| 3531 | |
| 3532 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3533 | |
| 3534 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3535 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3536 | ( void** ) &pPacket ); |
| 3537 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3538 | { |
| 3539 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3540 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3541 | 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] | 3542 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3543 | goto end; |
| 3544 | } |
| 3545 | |
| 3546 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3547 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3548 | |
| 3549 | // Next, we fill out the buffer descriptor: |
| 3550 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3551 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3552 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3553 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3554 | { |
| 3555 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3556 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3557 | nSirStatus ); |
| 3558 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3559 | goto end; |
| 3560 | } |
| 3561 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3562 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3563 | // That done, pack the Probe Request: |
| 3564 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3565 | sizeof(tSirMacMgmtHdr), |
| 3566 | nPayload, &nPayload ); |
| 3567 | if ( DOT11F_FAILED( nStatus ) ) |
| 3568 | { |
| 3569 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3570 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3571 | nStatus ); |
| 3572 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3573 | goto end; |
| 3574 | } |
| 3575 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3576 | { |
| 3577 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3578 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3579 | } |
| 3580 | |
| 3581 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3582 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3583 | nBytes );) |
| 3584 | |
| 3585 | if( psessionEntry->assocReq != NULL ) |
| 3586 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3587 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3588 | psessionEntry->assocReq = NULL; |
| 3589 | } |
| 3590 | |
| 3591 | if( nAddIELen ) |
| 3592 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3593 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3594 | pAddIE, |
| 3595 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3596 | nPayload += nAddIELen; |
| 3597 | } |
| 3598 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3599 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3600 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3601 | { |
| 3602 | 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] | 3603 | } |
| 3604 | else |
| 3605 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3606 | //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] | 3607 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3608 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3610 | |
| 3611 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3612 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3613 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3614 | ) |
| 3615 | { |
| 3616 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3617 | } |
| 3618 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 3619 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 3620 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3621 | { |
| 3622 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3623 | } |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 3624 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 3625 | limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry, |
| 3626 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 3627 | #endif |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3628 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3629 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3630 | psessionEntry->peSessionId, |
| 3631 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 3632 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3633 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3634 | { |
| 3635 | limLog(pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken); |
| 3636 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3637 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3638 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3639 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3640 | limTxComplete, pFrame, limTxBdComplete, |
| 3641 | txFlag, pMac->lim.txBdToken ); |
| 3642 | pMac->lim.txBdToken++; |
| 3643 | } |
| 3644 | else |
| 3645 | { |
| 3646 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3647 | HAL_TXRX_FRM_802_11_MGMT, |
| 3648 | ANI_TXDIR_TODS, |
| 3649 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3650 | limTxComplete, pFrame, txFlag ); |
| 3651 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3652 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3653 | psessionEntry->peSessionId, |
| 3654 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3656 | { |
| 3657 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3658 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3659 | nSirStatus ); |
| 3660 | //Pkt will be freed up by the callback |
| 3661 | goto end; |
| 3662 | } |
| 3663 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 3664 | // enable caching |
| 3665 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3666 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3667 | end: |
| 3668 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3669 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3670 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3671 | |
| 3672 | } // limSendReassocReqMgmtFrame |
| 3673 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3674 | eHalStatus limAuthTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3675 | { |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3676 | tANI_U32 txCompleteSuccess; |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3677 | tpSirTxBdStatus pTxBdStatus; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3678 | |
| 3679 | if (!pData) |
| 3680 | { |
| 3681 | limLog(pMac, LOG1, |
| 3682 | FL(" pData is NULL")); |
| 3683 | return eHAL_STATUS_FAILURE; |
| 3684 | } |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3685 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3686 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3687 | { |
| 3688 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 3689 | txCompleteSuccess = pTxBdStatus->txCompleteStatus; |
| 3690 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 3691 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 3692 | } |
| 3693 | else |
| 3694 | { |
| 3695 | txCompleteSuccess = *((tANI_U32*) pData); |
| 3696 | limLog(pMac, LOG1, |
| 3697 | FL("txCompleteSuccess= %d"), txCompleteSuccess); |
| 3698 | } |
| 3699 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3700 | if(txCompleteSuccess) |
| 3701 | { |
| 3702 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS; |
| 3703 | // 'Change' timer for future activations |
| 3704 | limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER); |
| 3705 | } |
| 3706 | else |
| 3707 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE; |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 3708 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 3709 | limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_START_EVENT, NULL, |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 3710 | pMac->authAckStatus, eSIR_SUCCESS); |
| 3711 | #endif |
| 3712 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3713 | return eHAL_STATUS_SUCCESS; |
| 3714 | } |
| 3715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3716 | /** |
| 3717 | * \brief Send an Authentication frame |
| 3718 | * |
| 3719 | * |
| 3720 | * \param pMac Pointer to Global MAC structure |
| 3721 | * |
| 3722 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3723 | * to be sent |
| 3724 | * |
| 3725 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3726 | * frame is destined |
| 3727 | * |
| 3728 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3729 | * Authentication frame3 |
| 3730 | * |
| 3731 | * |
| 3732 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3733 | * is formatted and sent when this function is called. |
| 3734 | * |
| 3735 | * |
| 3736 | */ |
| 3737 | |
| 3738 | void |
| 3739 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3740 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3741 | tSirMacAddr peerMacAddr, |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 3742 | tANI_U8 wep_challenge_len, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3743 | tpPESession psessionEntry, |
| 3744 | tAniBool waitForAck |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3745 | ) |
| 3746 | { |
| 3747 | tANI_U8 *pFrame, *pBody; |
| 3748 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3749 | tpSirMacMgmtHdr pMacHdr; |
| 3750 | tANI_U16 i; |
| 3751 | void *pPacket; |
| 3752 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3753 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3754 | |
| 3755 | if(NULL == psessionEntry) |
| 3756 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3757 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3758 | return; |
| 3759 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3760 | |
| 3761 | limLog(pMac, LOG1, |
| 3762 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3763 | pAuthFrameBody->authTransactionSeqNumber, |
| 3764 | pAuthFrameBody->authStatusCode, |
| 3765 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3766 | MAC_ADDR_ARRAY(peerMacAddr)); |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 3767 | if (wep_challenge_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3768 | { |
| 3769 | /// Auth frame3 to be sent with encrypted framebody |
| 3770 | /** |
| 3771 | * Allocate buffer for Authenticaton frame of size equal |
| 3772 | * to management frame header length plus 2 bytes each for |
| 3773 | * auth algorithm number, transaction number, status code, |
| 3774 | * 128 bytes for challenge text and 4 bytes each for |
| 3775 | * IV & ICV. |
| 3776 | */ |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 3777 | bodyLen = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
| 3778 | frameLen = sizeof(tSirMacMgmtHdr) + bodyLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3779 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3780 | else |
| 3781 | { |
| 3782 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3783 | { |
| 3784 | case SIR_MAC_AUTH_FRAME_1: |
| 3785 | /** |
| 3786 | * Allocate buffer for Authenticaton frame of size |
| 3787 | * equal to management frame header length plus 2 bytes |
| 3788 | * each for auth algorithm number, transaction number |
| 3789 | * and status code. |
| 3790 | */ |
| 3791 | |
| 3792 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3793 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3794 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3795 | |
| 3796 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3797 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3798 | { |
| 3799 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3800 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3801 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3802 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3803 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3804 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3805 | else |
| 3806 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3807 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3808 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3809 | frameLen += (2+SIR_MDIE_SIZE); |
| 3810 | } |
| 3811 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3812 | #endif |
| 3813 | break; |
| 3814 | |
| 3815 | case SIR_MAC_AUTH_FRAME_2: |
| 3816 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3817 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3818 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3819 | { |
| 3820 | /** |
| 3821 | * Allocate buffer for Authenticaton frame of size |
| 3822 | * equal to management frame header length plus |
| 3823 | * 2 bytes each for auth algorithm number, |
| 3824 | * transaction number and status code. |
| 3825 | */ |
| 3826 | |
| 3827 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3828 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3829 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3830 | } |
| 3831 | else |
| 3832 | { |
| 3833 | // Shared Key algorithm with challenge text |
| 3834 | // to be sent |
| 3835 | /** |
| 3836 | * Allocate buffer for Authenticaton frame of size |
| 3837 | * equal to management frame header length plus |
| 3838 | * 2 bytes each for auth algorithm number, |
| 3839 | * transaction number, status code and 128 bytes |
| 3840 | * for challenge text. |
| 3841 | */ |
| 3842 | |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 3843 | bodyLen = SIR_MAC_AUTH_FRAME_INFO_LEN + |
| 3844 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 3845 | SIR_MAC_CHALLENGE_ID_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3846 | frameLen = sizeof(tSirMacMgmtHdr) + |
yeshwanth sriram guntuka | 9771105 | 2017-09-08 12:16:08 +0530 | [diff] [blame] | 3847 | bodyLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3848 | } |
| 3849 | |
| 3850 | break; |
| 3851 | |
| 3852 | case SIR_MAC_AUTH_FRAME_3: |
| 3853 | /// Auth frame3 to be sent without encrypted framebody |
| 3854 | /** |
| 3855 | * Allocate buffer for Authenticaton frame of size equal |
| 3856 | * to management frame header length plus 2 bytes each |
| 3857 | * for auth algorithm number, transaction number and |
| 3858 | * status code. |
| 3859 | */ |
| 3860 | |
| 3861 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3862 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3863 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3864 | |
| 3865 | break; |
| 3866 | |
| 3867 | case SIR_MAC_AUTH_FRAME_4: |
| 3868 | /** |
| 3869 | * Allocate buffer for Authenticaton frame of size equal |
| 3870 | * to management frame header length plus 2 bytes each |
| 3871 | * for auth algorithm number, transaction number and |
| 3872 | * status code. |
| 3873 | */ |
| 3874 | |
| 3875 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3876 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3877 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3878 | |
| 3879 | break; |
| 3880 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3881 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3882 | |
| 3883 | |
| 3884 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3885 | |
| 3886 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3887 | { |
| 3888 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3889 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3890 | |
| 3891 | return; |
| 3892 | } |
| 3893 | |
| 3894 | for (i = 0; i < frameLen; i++) |
| 3895 | pFrame[i] = 0; |
| 3896 | |
| 3897 | // Prepare BD |
| 3898 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3899 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3900 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3901 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3902 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3903 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3904 | return; |
| 3905 | } |
| 3906 | |
| 3907 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 3908 | if (wep_challenge_len) |
| 3909 | pMacHdr->fc.wep = LIM_WEP_IN_FC; |
| 3910 | else |
| 3911 | pMacHdr->fc.wep = LIM_NO_WEP_IN_FC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3912 | |
| 3913 | // Prepare BSSId |
| 3914 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3915 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3916 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3917 | (tANI_U8 *) psessionEntry->bssId, |
| 3918 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3919 | } |
| 3920 | |
| 3921 | /// Prepare Authentication frame body |
| 3922 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3923 | |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame] | 3924 | if (wep_challenge_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3925 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3926 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3927 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3928 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3929 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3930 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3931 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3932 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3933 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3934 | } |
| 3935 | else |
| 3936 | { |
| 3937 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3938 | pBody += sizeof(tANI_U16); |
| 3939 | bodyLen -= sizeof(tANI_U16); |
| 3940 | |
| 3941 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3942 | pBody += sizeof(tANI_U16); |
| 3943 | bodyLen -= sizeof(tANI_U16); |
| 3944 | |
| 3945 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3946 | pBody += sizeof(tANI_U16); |
| 3947 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3948 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3949 | sizeof (pAuthFrameBody->length) + |
| 3950 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3951 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3952 | |
| 3953 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3954 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3955 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3956 | { |
| 3957 | |
| 3958 | { |
| 3959 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3960 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3961 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3962 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3963 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3964 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3965 | (tANI_U8 *)pBody, |
| 3966 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3967 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3968 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3969 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3970 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3971 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3972 | } |
| 3973 | } |
| 3974 | else |
| 3975 | { |
| 3976 | /* MDID attr is 54*/ |
| 3977 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3978 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3979 | *pBody = SIR_MDIE_SIZE; |
| 3980 | pBody++; |
| 3981 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3982 | { |
| 3983 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3984 | pBody++; |
| 3985 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3986 | } |
| 3987 | } |
| 3988 | } |
| 3989 | #endif |
| 3990 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3991 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3992 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3993 | pAuthFrameBody->authTransactionSeqNumber, |
| 3994 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3995 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3996 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3997 | } |
| 3998 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3999 | |
| 4000 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4001 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4002 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4003 | #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] | 4004 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4005 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 4006 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4007 | ) |
| 4008 | { |
| 4009 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4010 | } |
| 4011 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4012 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 4013 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4014 | { |
| 4015 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4016 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4017 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4018 | limLog( pMac, LOG1, |
| 4019 | FL("Sending Auth Frame over WQ5 with waitForAck %d to "MAC_ADDRESS_STR |
| 4020 | " From " MAC_ADDRESS_STR), waitForAck, MAC_ADDR_ARRAY(pMacHdr->da), |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4021 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 4022 | |
| 4023 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4024 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4025 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4026 | psessionEntry->peSessionId, |
| 4027 | pMacHdr->fc.subType)); |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 4028 | |
| 4029 | if( ( psessionEntry->is11Gonly == true ) && |
| 4030 | ( !IS_BROADCAST_MAC(peerMacAddr) ) ){ |
| 4031 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4032 | } |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4033 | if(eSIR_TRUE == waitForAck) |
| 4034 | { |
| 4035 | pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD; |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 4036 | limLog(pMac, LOG1, FL("Auth frame - txBdToken %u"), |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 4037 | pMac->lim.txBdToken); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4038 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 4039 | ( tANI_U16 ) frameLen, |
| 4040 | HAL_TXRX_FRM_802_11_MGMT, |
| 4041 | ANI_TXDIR_TODS, |
| 4042 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 4043 | limTxComplete, pFrame, limAuthTxCompleteCnf, txFlag, |
| 4044 | pMac->lim.txBdToken); |
| 4045 | pMac->lim.txBdToken++; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4046 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4047 | psessionEntry->peSessionId, |
| 4048 | halstatus)); |
| 4049 | if (!HAL_STATUS_SUCCESS(halstatus)) |
| 4050 | { |
| 4051 | limLog( pMac, LOGE, |
| 4052 | FL("Could not send Auth frame, retCode=%X "), |
| 4053 | halstatus ); |
| 4054 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE; |
| 4055 | //Pkt will be freed up by the callback |
| 4056 | } |
| 4057 | } |
| 4058 | else |
| 4059 | { |
| 4060 | /// Queue Authentication frame in high priority WQ |
| 4061 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | HAL_TXRX_FRM_802_11_MGMT, |
| 4063 | ANI_TXDIR_TODS, |
| 4064 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4065 | limTxComplete, pFrame, txFlag ); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4066 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4067 | psessionEntry->peSessionId, |
| 4068 | halstatus)); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4069 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4070 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4071 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4072 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4073 | halstatus); |
| 4074 | |
| 4075 | //Pkt will be freed up by the callback |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4077 | } |
| 4078 | |
| 4079 | return; |
| 4080 | } /*** end limSendAuthMgmtFrame() ***/ |
| 4081 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4082 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 4083 | { |
| 4084 | tANI_U16 aid; |
| 4085 | tpDphHashNode pStaDs; |
| 4086 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 4087 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 4088 | tpPESession psessionEntry; |
| 4089 | |
| 4090 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 4091 | if (pMlmDeauthReq) |
| 4092 | { |
| 4093 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4094 | { |
| 4095 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4096 | } |
| 4097 | |
| 4098 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 4099 | { |
| 4100 | |
| 4101 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4102 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4103 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4104 | goto end; |
| 4105 | } |
| 4106 | |
| 4107 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4108 | if (pStaDs == NULL) |
| 4109 | { |
| 4110 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4111 | goto end; |
| 4112 | } |
| 4113 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4114 | /// Receive path cleanup with dummy packet |
| 4115 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4116 | |
| 4117 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4118 | if ( psessionEntry->limSystemRole == eLIM_STA_ROLE ) |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4119 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4120 | PELOGE(limLog(pMac, LOG1, |
| 4121 | FL("FT Preauth SessionId %d Cleanup" |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4122 | #ifdef FEATURE_WLAN_ESE |
| 4123 | " isESE %d" |
| 4124 | #endif |
| 4125 | #ifdef FEATURE_WLAN_LFR |
| 4126 | " isLFR %d" |
| 4127 | #endif |
| 4128 | " is11r %d, Deauth reason %d Trigger = %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4129 | psessionEntry->peSessionId, |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4130 | #ifdef FEATURE_WLAN_ESE |
| 4131 | psessionEntry->isESEconnection, |
| 4132 | #endif |
| 4133 | #ifdef FEATURE_WLAN_LFR |
| 4134 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 4135 | #endif |
| 4136 | psessionEntry->is11Rconnection, |
| 4137 | pMlmDeauthReq->reasonCode, |
| 4138 | pMlmDeauthReq->deauthTrigger);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4139 | |
| 4140 | limFTCleanup(pMac); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4141 | } |
| 4142 | #endif |
| 4143 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4144 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4145 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4146 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 4147 | } |
| 4148 | return eHAL_STATUS_SUCCESS; |
| 4149 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4150 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4151 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 4152 | sizeof(tSirMacAddr)); |
| 4153 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 4154 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 4155 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 4156 | |
| 4157 | // Free up buffer allocated |
| 4158 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4159 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4160 | |
| 4161 | limPostSmeMessage(pMac, |
| 4162 | LIM_MLM_DEAUTH_CNF, |
| 4163 | (tANI_U32 *) &mlmDeauthCnf); |
| 4164 | return eHAL_STATUS_SUCCESS; |
| 4165 | } |
| 4166 | |
| 4167 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 4168 | { |
| 4169 | tANI_U16 aid; |
| 4170 | tpDphHashNode pStaDs; |
| 4171 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 4172 | tpPESession psessionEntry; |
| 4173 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 4174 | |
| 4175 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 4176 | if (pMlmDisassocReq) |
| 4177 | { |
| 4178 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4179 | { |
| 4180 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4181 | } |
| 4182 | |
| 4183 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 4184 | { |
| 4185 | |
| 4186 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4187 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4188 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4189 | goto end; |
| 4190 | } |
| 4191 | |
| 4192 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4193 | if (pStaDs == NULL) |
| 4194 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 4195 | limLog(pMac, LOGE, |
| 4196 | FL("StaDs Null")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4197 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4198 | goto end; |
| 4199 | } |
| 4200 | |
| 4201 | /// Receive path cleanup with dummy packet |
| 4202 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 4203 | { |
| 4204 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 4205 | limLog(pMac, LOGE, |
| 4206 | FL("CleanupRxPath error")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4207 | goto end; |
| 4208 | } |
| 4209 | |
| 4210 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4211 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 4212 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4213 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4214 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4215 | PELOGE(limLog(pMac, LOG1, |
| 4216 | FL("FT Preauth SessionId %d Cleanup" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4217 | #ifdef FEATURE_WLAN_ESE |
| 4218 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4219 | #endif |
| 4220 | #ifdef FEATURE_WLAN_LFR |
| 4221 | " isLFR %d" |
| 4222 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4223 | " is11r %d reason %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4224 | psessionEntry->peSessionId, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4225 | #ifdef FEATURE_WLAN_ESE |
| 4226 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4227 | #endif |
| 4228 | #ifdef FEATURE_WLAN_LFR |
| 4229 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 4230 | #endif |
| 4231 | psessionEntry->is11Rconnection, |
| 4232 | pMlmDisassocReq->reasonCode);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4233 | limFTCleanup(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4234 | } |
| 4235 | #endif |
| 4236 | |
| 4237 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4238 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4239 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 4240 | return eHAL_STATUS_SUCCESS; |
| 4241 | } |
| 4242 | else |
| 4243 | { |
| 4244 | return eHAL_STATUS_SUCCESS; |
| 4245 | } |
| 4246 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4247 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4248 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 4249 | sizeof(tSirMacAddr)); |
| 4250 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 4251 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 4252 | |
| 4253 | /* Update PE session ID*/ |
| 4254 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 4255 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 4256 | if(pMlmDisassocReq != NULL) |
| 4257 | { |
| 4258 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4259 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 4260 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 4261 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4262 | |
| 4263 | limPostSmeMessage(pMac, |
| 4264 | LIM_MLM_DISASSOC_CNF, |
| 4265 | (tANI_U32 *) &mlmDisassocCnf); |
| 4266 | return eHAL_STATUS_SUCCESS; |
| 4267 | } |
| 4268 | |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 4269 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4270 | { |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 4271 | if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 4272 | { |
| 4273 | tpSirTxBdStatus pTxBdStatus; |
| 4274 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 4275 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 4276 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 4277 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4278 | return limSendDisassocCnf(pMac); |
| 4279 | } |
| 4280 | |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 4281 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4282 | { |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 4283 | if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 4284 | { |
| 4285 | tpSirTxBdStatus pTxBdStatus; |
| 4286 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 4287 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 4288 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 4289 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4290 | return limSendDeauthCnf(pMac); |
| 4291 | } |
| 4292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4293 | /** |
| 4294 | * \brief This function is called to send Disassociate frame. |
| 4295 | * |
| 4296 | * |
| 4297 | * \param pMac Pointer to Global MAC structure |
| 4298 | * |
| 4299 | * \param nReason Indicates the reason that need to be sent in |
| 4300 | * Disassociation frame |
| 4301 | * |
| 4302 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 4303 | * sent |
| 4304 | * |
| 4305 | * |
| 4306 | */ |
| 4307 | |
| 4308 | void |
| 4309 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 4310 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4311 | tSirMacAddr peer, |
| 4312 | tpPESession psessionEntry, |
| 4313 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4314 | { |
| 4315 | tDot11fDisassociation frm; |
| 4316 | tANI_U8 *pFrame; |
| 4317 | tSirRetStatus nSirStatus; |
| 4318 | tpSirMacMgmtHdr pMacHdr; |
| 4319 | tANI_U32 nBytes, nPayload, nStatus; |
| 4320 | void *pPacket; |
| 4321 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4322 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4323 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4324 | if(NULL == psessionEntry) |
| 4325 | { |
| 4326 | return; |
| 4327 | } |
| 4328 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4329 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4330 | |
| 4331 | frm.Reason.code = nReason; |
| 4332 | |
| 4333 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 4334 | if ( DOT11F_FAILED( nStatus ) ) |
| 4335 | { |
| 4336 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4337 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4338 | nStatus ); |
| 4339 | // We'll fall back on the worst case scenario: |
| 4340 | nPayload = sizeof( tDot11fDisassociation ); |
| 4341 | } |
| 4342 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4343 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4344 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4345 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4346 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4347 | } |
| 4348 | |
| 4349 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4350 | |
| 4351 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4352 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4353 | ( void** ) &pPacket ); |
| 4354 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4355 | { |
| 4356 | 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] | 4357 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4358 | return; |
| 4359 | } |
| 4360 | |
| 4361 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4362 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4363 | |
| 4364 | // Next, we fill out the buffer descriptor: |
| 4365 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4366 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4367 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4368 | { |
| 4369 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4370 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4371 | nSirStatus ); |
| 4372 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4373 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4374 | return; // just allocated... |
| 4375 | } |
| 4376 | |
| 4377 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4378 | |
| 4379 | // Prepare the BSSID |
| 4380 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4381 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4382 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4383 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4384 | #endif |
| 4385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4386 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4387 | sizeof(tSirMacMgmtHdr), |
| 4388 | nPayload, &nPayload ); |
| 4389 | if ( DOT11F_FAILED( nStatus ) ) |
| 4390 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4391 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4392 | nStatus ); |
| 4393 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4394 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4395 | return; // allocated! |
| 4396 | } |
| 4397 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4398 | { |
| 4399 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4400 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4401 | } |
| 4402 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4403 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4404 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4405 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4406 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4407 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4408 | |
| 4409 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4410 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4411 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4412 | ) |
| 4413 | { |
| 4414 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4415 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4416 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4417 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4418 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4419 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4420 | { |
| 4421 | /* This frame will be sent on air by firmware, |
| 4422 | which will ensure that this frame goes out |
| 4423 | even though DEL_STA is sent immediately */ |
| 4424 | /* Without this for DEL_STA command there is |
| 4425 | risk of flushing frame in BTQM queue without |
| 4426 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4427 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4428 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4429 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4430 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4431 | } |
| 4432 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4433 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4434 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4435 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4436 | psessionEntry->peSessionId, |
| 4437 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4438 | // Queue Disassociation frame in high priority WQ |
| 4439 | /* get the duration from the request */ |
| 4440 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4441 | HAL_TXRX_FRM_802_11_MGMT, |
| 4442 | ANI_TXDIR_TODS, |
| 4443 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4444 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 4445 | txFlag, |
| 4446 | pMac->lim.txBdToken++); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4447 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4448 | psessionEntry->peSessionId, |
| 4449 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4450 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4451 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4452 | if (tx_timer_change( |
| 4453 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4454 | != TX_SUCCESS) |
| 4455 | { |
| 4456 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4457 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4458 | return; |
| 4459 | } |
| 4460 | else if(TX_SUCCESS != tx_timer_activate( |
| 4461 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4462 | { |
| 4463 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4464 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4465 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4466 | return; |
| 4467 | } |
| 4468 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4469 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4470 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4471 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4472 | psessionEntry->peSessionId, |
| 4473 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4474 | // Queue Disassociation frame in high priority WQ |
| 4475 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4476 | HAL_TXRX_FRM_802_11_MGMT, |
| 4477 | ANI_TXDIR_TODS, |
| 4478 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4479 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4480 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4481 | psessionEntry->peSessionId, |
| 4482 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4483 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4484 | { |
| 4485 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4486 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4487 | nSirStatus ); |
| 4488 | //Pkt will be freed up by the callback |
| 4489 | return; |
| 4490 | } |
| 4491 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4492 | } // End limSendDisassocMgmtFrame. |
| 4493 | |
| 4494 | /** |
| 4495 | * \brief This function is called to send a Deauthenticate frame |
| 4496 | * |
| 4497 | * |
| 4498 | * \param pMac Pointer to global MAC structure |
| 4499 | * |
| 4500 | * \param nReason Indicates the reason that need to be sent in the |
| 4501 | * Deauthenticate frame |
| 4502 | * |
| 4503 | * \param peeer address of the STA to which the frame is to be sent |
| 4504 | * |
| 4505 | * |
| 4506 | */ |
| 4507 | |
| 4508 | void |
| 4509 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4510 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4511 | tSirMacAddr peer, |
| 4512 | tpPESession psessionEntry, |
| 4513 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4514 | { |
| 4515 | tDot11fDeAuth frm; |
| 4516 | tANI_U8 *pFrame; |
| 4517 | tSirRetStatus nSirStatus; |
| 4518 | tpSirMacMgmtHdr pMacHdr; |
| 4519 | tANI_U32 nBytes, nPayload, nStatus; |
| 4520 | void *pPacket; |
| 4521 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4522 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4523 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4524 | #ifdef FEATURE_WLAN_TDLS |
| 4525 | tANI_U16 aid; |
| 4526 | tpDphHashNode pStaDs; |
| 4527 | #endif |
| 4528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4529 | if(NULL == psessionEntry) |
| 4530 | { |
| 4531 | return; |
| 4532 | } |
| 4533 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4534 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | |
| 4536 | frm.Reason.code = nReason; |
| 4537 | |
| 4538 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4539 | if ( DOT11F_FAILED( nStatus ) ) |
| 4540 | { |
| 4541 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4542 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4543 | nStatus ); |
| 4544 | // We'll fall back on the worst case scenario: |
| 4545 | nPayload = sizeof( tDot11fDeAuth ); |
| 4546 | } |
| 4547 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4548 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4549 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4550 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4551 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | } |
| 4553 | |
| 4554 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4555 | |
| 4556 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4557 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4558 | ( void** ) &pPacket ); |
| 4559 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4560 | { |
| 4561 | 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] | 4562 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | return; |
| 4564 | } |
| 4565 | |
| 4566 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4567 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4568 | |
| 4569 | // Next, we fill out the buffer descriptor: |
| 4570 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4571 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4572 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4573 | { |
| 4574 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4575 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4576 | nSirStatus ); |
| 4577 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4578 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4579 | return; // just allocated... |
| 4580 | } |
| 4581 | |
| 4582 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4583 | |
| 4584 | // Prepare the BSSID |
| 4585 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4586 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4587 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4588 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4589 | #endif |
| 4590 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4591 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4592 | sizeof(tSirMacMgmtHdr), |
| 4593 | nPayload, &nPayload ); |
| 4594 | if ( DOT11F_FAILED( nStatus ) ) |
| 4595 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4596 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4597 | nStatus ); |
| 4598 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4599 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4600 | return; |
| 4601 | } |
| 4602 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4603 | { |
| 4604 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4605 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4607 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4608 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4609 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4610 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4611 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4612 | |
| 4613 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4615 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | ) |
| 4617 | { |
| 4618 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4619 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4620 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4621 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4622 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4623 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4624 | { |
| 4625 | /* This frame will be sent on air by firmware, |
| 4626 | which will ensure that this frame goes out |
| 4627 | even though DEL_STA is sent immediately */ |
| 4628 | /* Without this for DEL_STA command there is |
| 4629 | risk of flushing frame in BTQM queue without |
| 4630 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4631 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4632 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4633 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4634 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4635 | } |
| 4636 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4637 | #ifdef FEATURE_WLAN_TDLS |
| 4638 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4639 | #endif |
| 4640 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4641 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4642 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4643 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4644 | psessionEntry->peSessionId, |
| 4645 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4646 | // Queue Disassociation frame in high priority WQ |
| 4647 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4648 | HAL_TXRX_FRM_802_11_MGMT, |
| 4649 | ANI_TXDIR_TODS, |
| 4650 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 4651 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag, |
| 4652 | pMac->lim.txBdToken++); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4653 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4654 | psessionEntry->peSessionId, |
| 4655 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4656 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4657 | { |
| 4658 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4659 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4660 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4661 | //Pkt will be freed up by the callback limTxComplete |
| 4662 | |
| 4663 | /*Call limProcessDeauthAckTimeout which will send |
| 4664 | * DeauthCnf for this frame |
| 4665 | */ |
| 4666 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4667 | return; |
| 4668 | } |
| 4669 | |
| 4670 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4671 | |
| 4672 | if (tx_timer_change( |
| 4673 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4674 | != TX_SUCCESS) |
| 4675 | { |
| 4676 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4677 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4678 | return; |
| 4679 | } |
| 4680 | else if(TX_SUCCESS != tx_timer_activate( |
| 4681 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4682 | { |
| 4683 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4684 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4685 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4686 | return; |
| 4687 | } |
| 4688 | } |
| 4689 | else |
| 4690 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4691 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4692 | psessionEntry->peSessionId, |
| 4693 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4694 | #ifdef FEATURE_WLAN_TDLS |
| 4695 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4696 | { |
| 4697 | // Queue Disassociation frame in high priority WQ |
| 4698 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4699 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4700 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4701 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4702 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4703 | } |
| 4704 | else |
| 4705 | { |
| 4706 | #endif |
| 4707 | // Queue Disassociation frame in high priority WQ |
| 4708 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4709 | HAL_TXRX_FRM_802_11_MGMT, |
| 4710 | ANI_TXDIR_TODS, |
| 4711 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4712 | limTxComplete, pFrame, txFlag ); |
| 4713 | #ifdef FEATURE_WLAN_TDLS |
| 4714 | } |
| 4715 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4716 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4717 | psessionEntry->peSessionId, |
| 4718 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4719 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4720 | { |
| 4721 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4722 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4723 | nSirStatus ); |
| 4724 | //Pkt will be freed up by the callback |
| 4725 | return; |
| 4726 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4727 | } |
| 4728 | |
| 4729 | } // End limSendDeauthMgmtFrame. |
| 4730 | |
| 4731 | |
| 4732 | #ifdef ANI_SUPPORT_11H |
| 4733 | /** |
| 4734 | * \brief Send a Measurement Report Action frame |
| 4735 | * |
| 4736 | * |
| 4737 | * \param pMac Pointer to the global MAC structure |
| 4738 | * |
| 4739 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4740 | * |
| 4741 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4742 | * |
| 4743 | * |
| 4744 | */ |
| 4745 | |
| 4746 | tSirRetStatus |
| 4747 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4748 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4749 | tSirMacAddr peer) |
| 4750 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4751 | tDot11fMeasurementReport frm; |
| 4752 | tANI_U8 *pFrame; |
| 4753 | tSirRetStatus nSirStatus; |
| 4754 | tpSirMacMgmtHdr pMacHdr; |
| 4755 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4756 | void *pPacket; |
| 4757 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4758 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4759 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4760 | |
| 4761 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4762 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4763 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4764 | |
| 4765 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4766 | { |
| 4767 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4768 | nSirStatus = |
| 4769 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4770 | &frm.MeasurementReport ); |
| 4771 | break; |
| 4772 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4773 | nSirStatus = |
| 4774 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4775 | &frm.MeasurementReport ); |
| 4776 | break; |
| 4777 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4778 | nSirStatus = |
| 4779 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4780 | &frm.MeasurementReport ); |
| 4781 | break; |
| 4782 | default: |
| 4783 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4784 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4785 | pMeasReqFrame->measReqIE.measType ); |
| 4786 | return eSIR_FAILURE; |
| 4787 | } |
| 4788 | |
| 4789 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4790 | |
| 4791 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4792 | if ( DOT11F_FAILED( nStatus ) ) |
| 4793 | { |
| 4794 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4795 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4796 | nStatus ); |
| 4797 | // We'll fall back on the worst case scenario: |
| 4798 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4799 | } |
| 4800 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4801 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4802 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4804 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4805 | } |
| 4806 | |
| 4807 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4808 | |
| 4809 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4810 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4811 | { |
| 4812 | 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] | 4813 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4814 | return eSIR_FAILURE; |
| 4815 | } |
| 4816 | |
| 4817 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4818 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4819 | |
| 4820 | // Next, we fill out the buffer descriptor: |
| 4821 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4822 | SIR_MAC_MGMT_ACTION, peer); |
| 4823 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4824 | { |
| 4825 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4826 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4827 | nSirStatus ); |
| 4828 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4829 | return eSIR_FAILURE; // just allocated... |
| 4830 | } |
| 4831 | |
| 4832 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4833 | |
| 4834 | nCfg = 6; |
| 4835 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4836 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4837 | { |
| 4838 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4839 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4840 | nSirStatus ); |
| 4841 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4842 | return eSIR_FAILURE; // just allocated... |
| 4843 | } |
| 4844 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4845 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4846 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4847 | #endif |
| 4848 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4849 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4850 | sizeof(tSirMacMgmtHdr), |
| 4851 | nPayload, &nPayload ); |
| 4852 | if ( DOT11F_FAILED( nStatus ) ) |
| 4853 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4854 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4855 | nStatus ); |
| 4856 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4857 | return eSIR_FAILURE; // allocated! |
| 4858 | } |
| 4859 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4860 | { |
| 4861 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4862 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4863 | } |
| 4864 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4865 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4866 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4867 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4868 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4869 | HAL_TXRX_FRM_802_11_MGMT, |
| 4870 | ANI_TXDIR_TODS, |
| 4871 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4872 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4873 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4874 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4875 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4877 | { |
| 4878 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4879 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4880 | nSirStatus ); |
| 4881 | //Pkt will be freed up by the callback |
| 4882 | return eSIR_FAILURE; // just allocated... |
| 4883 | } |
| 4884 | |
| 4885 | return eSIR_SUCCESS; |
| 4886 | |
| 4887 | } // End limSendMeasReportFrame. |
| 4888 | |
| 4889 | |
| 4890 | /** |
| 4891 | * \brief Send a TPC Request Action frame |
| 4892 | * |
| 4893 | * |
| 4894 | * \param pMac Pointer to the global MAC datastructure |
| 4895 | * |
| 4896 | * \param peer MAC address to which the frame should be sent |
| 4897 | * |
| 4898 | * |
| 4899 | */ |
| 4900 | |
| 4901 | void |
| 4902 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4903 | tSirMacAddr peer) |
| 4904 | { |
| 4905 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4906 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4907 | tSirRetStatus nSirStatus; |
| 4908 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4909 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4910 | void *pPacket; |
| 4911 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4912 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4913 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4914 | |
| 4915 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4916 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4917 | frm.DialogToken.token = 1; |
| 4918 | frm.TPCRequest.present = 1; |
| 4919 | |
| 4920 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4921 | if ( DOT11F_FAILED( nStatus ) ) |
| 4922 | { |
| 4923 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4924 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4925 | nStatus ); |
| 4926 | // We'll fall back on the worst case scenario: |
| 4927 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4928 | } |
| 4929 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4930 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4931 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4932 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4933 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4934 | } |
| 4935 | |
| 4936 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4937 | |
| 4938 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4939 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4940 | { |
| 4941 | 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] | 4942 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4943 | return; |
| 4944 | } |
| 4945 | |
| 4946 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4947 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | |
| 4949 | // Next, we fill out the buffer descriptor: |
| 4950 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4951 | SIR_MAC_MGMT_ACTION, peer); |
| 4952 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4953 | { |
| 4954 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4955 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4956 | nSirStatus ); |
| 4957 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4958 | return; // just allocated... |
| 4959 | } |
| 4960 | |
| 4961 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4962 | |
| 4963 | nCfg = 6; |
| 4964 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4965 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4966 | { |
| 4967 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4968 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | nSirStatus ); |
| 4970 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4971 | return; // just allocated... |
| 4972 | } |
| 4973 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4974 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4975 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4976 | #endif |
| 4977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4978 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4979 | sizeof(tSirMacMgmtHdr), |
| 4980 | nPayload, &nPayload ); |
| 4981 | if ( DOT11F_FAILED( nStatus ) ) |
| 4982 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4983 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4984 | nStatus ); |
| 4985 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4986 | return; // allocated! |
| 4987 | } |
| 4988 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4989 | { |
| 4990 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4991 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4992 | } |
| 4993 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4994 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4995 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4996 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4998 | HAL_TXRX_FRM_802_11_MGMT, |
| 4999 | ANI_TXDIR_TODS, |
| 5000 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5001 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5002 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5003 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5004 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5005 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5006 | { |
| 5007 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5008 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5009 | nSirStatus ); |
| 5010 | //Pkt will be freed up by the callback |
| 5011 | return; |
| 5012 | } |
| 5013 | |
| 5014 | } // End limSendTpcRequestFrame. |
| 5015 | |
| 5016 | |
| 5017 | /** |
| 5018 | * \brief Send a TPC Report Action frame |
| 5019 | * |
| 5020 | * |
| 5021 | * \param pMac Pointer to the global MAC datastructure |
| 5022 | * |
| 5023 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 5024 | * |
| 5025 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5026 | * |
| 5027 | * |
| 5028 | */ |
| 5029 | |
| 5030 | tSirRetStatus |
| 5031 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 5032 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 5033 | tSirMacAddr peer) |
| 5034 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5035 | tDot11fTPCReport frm; |
| 5036 | tANI_U8 *pFrame; |
| 5037 | tSirRetStatus nSirStatus; |
| 5038 | tpSirMacMgmtHdr pMacHdr; |
| 5039 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 5040 | void *pPacket; |
| 5041 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5042 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5043 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | |
| 5045 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5046 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 5047 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 5048 | |
| 5049 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 5050 | // "misplaced this function, need to replace: |
| 5051 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 5052 | // pMac->lim.gLimCurrentChannelId, 0); |
| 5053 | frm.TPCReport.tx_power = 0; |
| 5054 | frm.TPCReport.link_margin = 0; |
| 5055 | frm.TPCReport.present = 1; |
| 5056 | |
| 5057 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 5058 | if ( DOT11F_FAILED( nStatus ) ) |
| 5059 | { |
| 5060 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5061 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5062 | nStatus ); |
| 5063 | // We'll fall back on the worst case scenario: |
| 5064 | nPayload = sizeof( tDot11fTPCReport ); |
| 5065 | } |
| 5066 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5067 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5068 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5069 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5070 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5071 | } |
| 5072 | |
| 5073 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5074 | |
| 5075 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5076 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5077 | { |
| 5078 | 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] | 5079 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5080 | return eSIR_FAILURE; |
| 5081 | } |
| 5082 | |
| 5083 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5084 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5085 | |
| 5086 | // Next, we fill out the buffer descriptor: |
| 5087 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5088 | SIR_MAC_MGMT_ACTION, peer); |
| 5089 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5090 | { |
| 5091 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5092 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5093 | nSirStatus ); |
| 5094 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5095 | return eSIR_FAILURE; // just allocated... |
| 5096 | } |
| 5097 | |
| 5098 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5099 | |
| 5100 | nCfg = 6; |
| 5101 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 5102 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5103 | { |
| 5104 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5105 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5106 | nSirStatus ); |
| 5107 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5108 | return eSIR_FAILURE; // just allocated... |
| 5109 | } |
| 5110 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5111 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5112 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5113 | #endif |
| 5114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5115 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 5116 | sizeof(tSirMacMgmtHdr), |
| 5117 | nPayload, &nPayload ); |
| 5118 | if ( DOT11F_FAILED( nStatus ) ) |
| 5119 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5120 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5121 | nStatus ); |
| 5122 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5123 | return eSIR_FAILURE; // allocated! |
| 5124 | } |
| 5125 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5126 | { |
| 5127 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5128 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5129 | } |
| 5130 | |
| 5131 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5132 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5133 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5134 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5135 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5136 | HAL_TXRX_FRM_802_11_MGMT, |
| 5137 | ANI_TXDIR_TODS, |
| 5138 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5139 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5140 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5141 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5142 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5143 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5144 | { |
| 5145 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5146 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | nSirStatus ); |
| 5148 | //Pkt will be freed up by the callback |
| 5149 | return eSIR_FAILURE; // just allocated... |
| 5150 | } |
| 5151 | |
| 5152 | return eSIR_SUCCESS; |
| 5153 | |
| 5154 | } // End limSendTpcReportFrame. |
| 5155 | #endif //ANI_SUPPORT_11H |
| 5156 | |
| 5157 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5158 | /** |
| 5159 | * \brief Send a Channel Switch Announcement |
| 5160 | * |
| 5161 | * |
| 5162 | * \param pMac Pointer to the global MAC datastructure |
| 5163 | * |
| 5164 | * \param peer MAC address to which this frame will be sent |
| 5165 | * |
| 5166 | * \param nMode |
| 5167 | * |
| 5168 | * \param nNewChannel |
| 5169 | * |
| 5170 | * \param nCount |
| 5171 | * |
| 5172 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5173 | * |
| 5174 | * |
| 5175 | */ |
| 5176 | |
| 5177 | tSirRetStatus |
| 5178 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5179 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5180 | tANI_U8 nMode, |
| 5181 | tANI_U8 nNewChannel, |
| 5182 | tANI_U8 nCount, |
| 5183 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5185 | tDot11fChannelSwitch frm; |
| 5186 | tANI_U8 *pFrame; |
| 5187 | tSirRetStatus nSirStatus; |
| 5188 | tpSirMacMgmtHdr pMacHdr; |
| 5189 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5190 | void *pPacket; |
| 5191 | eHalStatus halstatus; |
| 5192 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5193 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5194 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5195 | |
| 5196 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5197 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5198 | frm.ChanSwitchAnn.switchMode = nMode; |
| 5199 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5200 | frm.ChanSwitchAnn.switchCount = nCount; |
| 5201 | frm.ChanSwitchAnn.present = 1; |
| 5202 | |
| 5203 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5204 | if ( DOT11F_FAILED( nStatus ) ) |
| 5205 | { |
| 5206 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5207 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5208 | nStatus ); |
| 5209 | // We'll fall back on the worst case scenario: |
| 5210 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5211 | } |
| 5212 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5213 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5214 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5215 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5216 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5217 | } |
| 5218 | |
| 5219 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5220 | |
| 5221 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5222 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5223 | { |
| 5224 | 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] | 5225 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5226 | return eSIR_FAILURE; |
| 5227 | } |
| 5228 | |
| 5229 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5230 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5231 | |
| 5232 | // Next, we fill out the buffer descriptor: |
| 5233 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5234 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5235 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5236 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5237 | (tANI_U8 *) psessionEntry->bssId, |
| 5238 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5239 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5240 | { |
| 5241 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5242 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5243 | nSirStatus ); |
| 5244 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5245 | return eSIR_FAILURE; // just allocated... |
| 5246 | } |
| 5247 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5248 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5249 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5250 | |
| 5251 | nCfg = 6; |
| 5252 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 5253 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5254 | { |
| 5255 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5256 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5257 | nSirStatus ); |
| 5258 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5259 | return eSIR_FAILURE; // just allocated... |
| 5260 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5261 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5262 | |
| 5263 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5264 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5265 | #endif |
| 5266 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5267 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5268 | sizeof(tSirMacMgmtHdr), |
| 5269 | nPayload, &nPayload ); |
| 5270 | if ( DOT11F_FAILED( nStatus ) ) |
| 5271 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5272 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5273 | nStatus ); |
| 5274 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5275 | return eSIR_FAILURE; // allocated! |
| 5276 | } |
| 5277 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5278 | { |
| 5279 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5280 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5281 | } |
| 5282 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5283 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5284 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5285 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5286 | ) |
| 5287 | { |
| 5288 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5289 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5290 | |
| 5291 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5292 | psessionEntry->peSessionId, |
| 5293 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5294 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5295 | HAL_TXRX_FRM_802_11_MGMT, |
| 5296 | ANI_TXDIR_TODS, |
| 5297 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5298 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5299 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5300 | psessionEntry->peSessionId, |
| 5301 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5302 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5303 | { |
| 5304 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5305 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5306 | nSirStatus ); |
| 5307 | //Pkt will be freed up by the callback |
| 5308 | return eSIR_FAILURE; |
| 5309 | } |
| 5310 | |
| 5311 | return eSIR_SUCCESS; |
| 5312 | |
| 5313 | } // End limSendChannelSwitchMgmtFrame. |
| 5314 | |
Abhishek Singh | 2b0cf1c | 2017-10-30 17:36:38 +0530 | [diff] [blame] | 5315 | tSirRetStatus |
| 5316 | lim_send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, |
| 5317 | tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, |
| 5318 | uint8_t new_channel, uint8_t count, tpPESession session_entry) |
| 5319 | { |
| 5320 | tDot11fext_channel_switch_action_frame frm; |
| 5321 | uint8_t *frame; |
| 5322 | tpSirMacMgmtHdr mac_hdr; |
| 5323 | uint32_t num_bytes, n_payload, status; |
| 5324 | void *packet; |
| 5325 | eHalStatus halstatus; |
| 5326 | uint8_t txFlag = 0; |
| 5327 | |
| 5328 | if (!session_entry) { |
| 5329 | limLog(mac_ctx, LOGE, FL("Session entry is NULL!!!")); |
| 5330 | return eSIR_FAILURE; |
| 5331 | } |
| 5332 | |
| 5333 | vos_mem_set(&frm, sizeof(frm), 0); |
| 5334 | |
| 5335 | frm.Category.category = SIR_MAC_ACTION_PUBLIC_USAGE; |
| 5336 | frm.Action.action = SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID; |
| 5337 | |
| 5338 | frm.ext_chan_switch_ann_action.switch_mode = mode; |
| 5339 | frm.ext_chan_switch_ann_action.op_class = new_op_class; |
| 5340 | frm.ext_chan_switch_ann_action.new_channel = new_channel; |
| 5341 | frm.ext_chan_switch_ann_action.switch_count = count; |
| 5342 | |
| 5343 | |
| 5344 | status = dot11fGetPackedext_channel_switch_action_frameSize(mac_ctx, |
| 5345 | &frm, &n_payload); |
| 5346 | if (DOT11F_FAILED(status)) { |
| 5347 | limLog(mac_ctx, LOGE, FL("Failed to get packed size for Channel Switch 0x%08x"), |
| 5348 | status); |
| 5349 | /* We'll fall back on the worst case scenario*/ |
| 5350 | n_payload = sizeof(tDot11fext_channel_switch_action_frame); |
| 5351 | } else if (DOT11F_WARNED(status)) { |
| 5352 | limLog(mac_ctx, LOGW, FL("There were warnings while calculating the packed size for a Ext Channel Switch (0x%08x)"), |
| 5353 | status); |
| 5354 | } |
| 5355 | |
| 5356 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 5357 | |
| 5358 | halstatus = palPktAlloc(mac_ctx->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 5359 | (uint16_t )num_bytes, (void**) &frame, |
| 5360 | (void**) &packet); |
| 5361 | |
| 5362 | if (!HAL_STATUS_SUCCESS(halstatus)) { |
| 5363 | limLog(mac_ctx, LOGE, FL("Failed to allocate %d bytes for a Ext Channel Switch"), |
| 5364 | num_bytes); |
| 5365 | return eSIR_FAILURE; |
| 5366 | } |
| 5367 | |
| 5368 | /* Paranoia*/ |
| 5369 | vos_mem_set(frame, num_bytes, 0); |
| 5370 | |
| 5371 | /* Next, we fill out the buffer descriptor */ |
| 5372 | limPopulateMacHeader(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 5373 | SIR_MAC_MGMT_ACTION, peer, session_entry->selfMacAddr); |
| 5374 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 5375 | vos_mem_copy((uint8_t *) mac_hdr->bssId, |
| 5376 | (uint8_t *) session_entry->bssId, |
| 5377 | sizeof(tSirMacAddr)); |
| 5378 | |
| 5379 | #ifdef WLAN_FEATURE_11W |
| 5380 | limSetProtectedBit(mac_ctx, session_entry, peer, mac_hdr); |
| 5381 | #endif |
| 5382 | |
| 5383 | status = dot11fPackext_channel_switch_action_frame(mac_ctx, &frm, |
| 5384 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 5385 | if (DOT11F_FAILED(status)) { |
| 5386 | limLog(mac_ctx, LOGE, FL("Failed to pack a Channel Switch 0x%08x"), |
| 5387 | status); |
| 5388 | palPktFree(mac_ctx->hHdd, HAL_TXRX_FRM_802_11_MGMT, (void*) frame, |
| 5389 | (void*) packet ); |
| 5390 | return eSIR_FAILURE; |
| 5391 | } else if (DOT11F_WARNED(status)) { |
| 5392 | limLog(mac_ctx, LOGW, FL("There were warnings while packing a Channel Switch 0x%08x"), |
| 5393 | status); |
| 5394 | } |
| 5395 | |
| 5396 | if ((SIR_BAND_5_GHZ == |
| 5397 | limGetRFBand(session_entry->currentOperChannel)) || |
| 5398 | (session_entry->pePersona == VOS_P2P_CLIENT_MODE) || |
| 5399 | (session_entry->pePersona == VOS_P2P_GO_MODE)) { |
| 5400 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5401 | } |
Abhishek Singh | 5af90fe | 2017-12-27 16:17:51 +0530 | [diff] [blame] | 5402 | /* Use peer sta to transmit this frame */ |
| 5403 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Abhishek Singh | 2b0cf1c | 2017-10-30 17:36:38 +0530 | [diff] [blame] | 5404 | |
| 5405 | limLog(mac_ctx, LOG1, FL("Send Ext channel Switch to :"MAC_ADDRESS_STR" with swcount %d, swmode %d , newchannel %d newops %d"), |
| 5406 | MAC_ADDR_ARRAY(mac_hdr->da), |
| 5407 | frm.ext_chan_switch_ann_action.switch_count, |
| 5408 | frm.ext_chan_switch_ann_action.switch_mode, |
| 5409 | frm.ext_chan_switch_ann_action.new_channel, |
| 5410 | frm.ext_chan_switch_ann_action.op_class); |
| 5411 | |
| 5412 | MTRACE(vos_trace(VOS_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 5413 | session_entry->peSessionId, mac_hdr->fc.subType)); |
| 5414 | |
| 5415 | halstatus = halTxFrame(mac_ctx, packet, (uint16_t) num_bytes, |
| 5416 | HAL_TXRX_FRM_802_11_MGMT, |
| 5417 | ANI_TXDIR_TODS, |
| 5418 | 7, limTxComplete, frame, |
| 5419 | txFlag); |
| 5420 | MTRACE(vos_trace(VOS_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5421 | session_entry->peSessionId, halstatus)); |
| 5422 | if (!HAL_STATUS_SUCCESS(halstatus)) { |
| 5423 | limLog(mac_ctx, LOGE, FL("Failed to send a Ext Channel Switch %X!"), |
| 5424 | halstatus); |
| 5425 | /* Pkt will be freed up by the callback */ |
| 5426 | return eSIR_FAILURE; |
| 5427 | } |
| 5428 | return eSIR_SUCCESS; |
| 5429 | } /* End lim_send_extended_chan_switch_action_frame */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | |
| 5431 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5432 | #ifdef WLAN_FEATURE_11AC |
| 5433 | tSirRetStatus |
| 5434 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 5435 | tSirMacAddr peer, |
| 5436 | tANI_U8 nMode, |
| 5437 | tpPESession psessionEntry ) |
| 5438 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5439 | tDot11fOperatingMode frm; |
| 5440 | tANI_U8 *pFrame; |
| 5441 | tSirRetStatus nSirStatus; |
| 5442 | tpSirMacMgmtHdr pMacHdr; |
| 5443 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 5444 | void *pPacket; |
| 5445 | eHalStatus halstatus; |
| 5446 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5447 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5448 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5449 | |
| 5450 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5451 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5452 | frm.OperatingMode.chanWidth = nMode; |
| 5453 | frm.OperatingMode.rxNSS = 0; |
| 5454 | frm.OperatingMode.rxNSSType = 0; |
| 5455 | |
| 5456 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5457 | if ( DOT11F_FAILED( nStatus ) ) |
| 5458 | { |
| 5459 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5460 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5461 | nStatus ); |
| 5462 | // We'll fall back on the worst case scenario: |
| 5463 | nPayload = sizeof( tDot11fOperatingMode); |
| 5464 | } |
| 5465 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5466 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5467 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5468 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5469 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5470 | } |
| 5471 | |
| 5472 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5473 | |
| 5474 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5475 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5476 | { |
| 5477 | 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] | 5478 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5479 | return eSIR_FAILURE; |
| 5480 | } |
| 5481 | |
| 5482 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5483 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5484 | |
| 5485 | |
| 5486 | // Next, we fill out the buffer descriptor: |
| 5487 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5488 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5489 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5490 | } else |
| 5491 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5492 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5493 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5494 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5495 | (tANI_U8 *) psessionEntry->bssId, |
| 5496 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5497 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5498 | { |
| 5499 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5500 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5501 | nSirStatus ); |
| 5502 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5503 | return eSIR_FAILURE; // just allocated... |
| 5504 | } |
| 5505 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5506 | sizeof(tSirMacMgmtHdr), |
| 5507 | nPayload, &nPayload ); |
| 5508 | if ( DOT11F_FAILED( nStatus ) ) |
| 5509 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5510 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5511 | nStatus ); |
| 5512 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5513 | return eSIR_FAILURE; // allocated! |
| 5514 | } |
| 5515 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5516 | { |
| 5517 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5518 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5519 | } |
| 5520 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5521 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5522 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5523 | ) |
| 5524 | { |
| 5525 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5526 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5527 | |
| 5528 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5529 | psessionEntry->peSessionId, |
| 5530 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5531 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5532 | HAL_TXRX_FRM_802_11_MGMT, |
| 5533 | ANI_TXDIR_TODS, |
| 5534 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5535 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5536 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5537 | psessionEntry->peSessionId, |
| 5538 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5539 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5540 | { |
| 5541 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5542 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5543 | nSirStatus ); |
| 5544 | //Pkt will be freed up by the callback |
| 5545 | return eSIR_FAILURE; |
| 5546 | } |
| 5547 | |
| 5548 | return eSIR_SUCCESS; |
| 5549 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5550 | |
| 5551 | /** |
| 5552 | * \brief Send a VHT Channel Switch Announcement |
| 5553 | * |
| 5554 | * |
| 5555 | * \param pMac Pointer to the global MAC datastructure |
| 5556 | * |
| 5557 | * \param peer MAC address to which this frame will be sent |
| 5558 | * |
| 5559 | * \param nChanWidth |
| 5560 | * |
| 5561 | * \param nNewChannel |
| 5562 | * |
| 5563 | * |
| 5564 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5565 | * |
| 5566 | * |
| 5567 | */ |
| 5568 | |
| 5569 | tSirRetStatus |
| 5570 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5571 | tSirMacAddr peer, |
| 5572 | tANI_U8 nChanWidth, |
| 5573 | tANI_U8 nNewChannel, |
| 5574 | tANI_U8 ncbMode, |
| 5575 | tpPESession psessionEntry ) |
| 5576 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5577 | tDot11fChannelSwitch frm; |
| 5578 | tANI_U8 *pFrame; |
| 5579 | tSirRetStatus nSirStatus; |
| 5580 | tpSirMacMgmtHdr pMacHdr; |
| 5581 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5582 | void *pPacket; |
| 5583 | eHalStatus halstatus; |
| 5584 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5585 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5586 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5587 | |
| 5588 | |
| 5589 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5590 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5591 | frm.ChanSwitchAnn.switchMode = 1; |
| 5592 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5593 | frm.ChanSwitchAnn.switchCount = 1; |
Abhishek Singh | 15431c4 | 2017-10-25 15:43:02 +0530 | [diff] [blame] | 5594 | frm.sec_chan_offset.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5595 | frm.sec_chan_offset.present = 1; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5596 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5597 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5598 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5599 | frm.ChanSwitchAnn.present = 1; |
| 5600 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5601 | |
| 5602 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5603 | if ( DOT11F_FAILED( nStatus ) ) |
| 5604 | { |
| 5605 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5606 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5607 | nStatus ); |
| 5608 | // We'll fall back on the worst case scenario: |
| 5609 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5610 | } |
| 5611 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5612 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5613 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5614 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5615 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5616 | } |
| 5617 | |
| 5618 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5619 | |
| 5620 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5621 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5622 | { |
| 5623 | 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] | 5624 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5625 | return eSIR_FAILURE; |
| 5626 | } |
| 5627 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5628 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5629 | |
| 5630 | // Next, we fill out the buffer descriptor: |
| 5631 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5632 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5633 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5634 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5635 | (tANI_U8 *) psessionEntry->bssId, |
| 5636 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5637 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5638 | { |
| 5639 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5640 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5641 | nSirStatus ); |
| 5642 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5643 | return eSIR_FAILURE; // just allocated... |
| 5644 | } |
| 5645 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5646 | sizeof(tSirMacMgmtHdr), |
| 5647 | nPayload, &nPayload ); |
| 5648 | if ( DOT11F_FAILED( nStatus ) ) |
| 5649 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5650 | 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] | 5651 | nStatus ); |
| 5652 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5653 | return eSIR_FAILURE; // allocated! |
| 5654 | } |
| 5655 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5656 | { |
| 5657 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5658 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5659 | } |
| 5660 | |
| 5661 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5662 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5663 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5664 | ) |
| 5665 | { |
| 5666 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5667 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5668 | |
| 5669 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5670 | psessionEntry->peSessionId, |
| 5671 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5672 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5673 | HAL_TXRX_FRM_802_11_MGMT, |
| 5674 | ANI_TXDIR_TODS, |
| 5675 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5676 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5677 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5678 | psessionEntry->peSessionId, |
| 5679 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5680 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5681 | { |
| 5682 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5683 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5684 | nSirStatus ); |
| 5685 | //Pkt will be freed up by the callback |
| 5686 | return eSIR_FAILURE; |
| 5687 | } |
| 5688 | |
| 5689 | return eSIR_SUCCESS; |
| 5690 | |
| 5691 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5692 | |
| 5693 | |
| 5694 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5695 | #endif |
| 5696 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5697 | /** |
| 5698 | * \brief Send an ADDBA Req Action Frame to peer |
| 5699 | * |
| 5700 | * \sa limSendAddBAReq |
| 5701 | * |
| 5702 | * \param pMac The global tpAniSirGlobal object |
| 5703 | * |
| 5704 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5705 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5706 | * Frame to the peer |
| 5707 | * |
| 5708 | * \return eSIR_SUCCESS if setup completes successfully |
| 5709 | * eSIR_FAILURE is some problem is encountered |
| 5710 | */ |
| 5711 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5712 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5713 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5714 | tDot11fAddBAReq frmAddBAReq; |
| 5715 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5716 | tpSirMacMgmtHdr pMacHdr; |
| 5717 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5718 | tSirRetStatus statusCode; |
| 5719 | eHalStatus halStatus; |
| 5720 | void *pPacket; |
| 5721 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | |
| 5723 | if(NULL == psessionEntry) |
| 5724 | { |
| 5725 | return eSIR_FAILURE; |
| 5726 | } |
| 5727 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5728 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5729 | |
| 5730 | // Category - 3 (BA) |
| 5731 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5732 | |
| 5733 | // Action - 0 (ADDBA Req) |
| 5734 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5735 | |
| 5736 | // FIXME - Dialog Token, generalize this... |
| 5737 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5738 | |
| 5739 | // Fill the ADDBA Parameter Set |
| 5740 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5741 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5742 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5743 | |
| 5744 | // BA timeout |
| 5745 | // 0 - indicates no BA timeout |
| 5746 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5747 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5748 | /* Send SSN whatever we get from FW. |
| 5749 | */ |
| 5750 | frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5751 | |
| 5752 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5753 | |
| 5754 | if( DOT11F_FAILED( nStatus )) |
| 5755 | { |
| 5756 | limLog( pMac, LOGW, |
| 5757 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5758 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5759 | nStatus ); |
| 5760 | |
| 5761 | // We'll fall back on the worst case scenario: |
| 5762 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5763 | } |
| 5764 | else if( DOT11F_WARNED( nStatus )) |
| 5765 | { |
| 5766 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5767 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5768 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5769 | nStatus ); |
| 5770 | } |
| 5771 | |
| 5772 | // Add the MGMT header to frame length |
| 5773 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5774 | |
| 5775 | // Need to allocate a buffer for ADDBA AF |
| 5776 | if( eHAL_STATUS_SUCCESS != |
| 5777 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5778 | HAL_TXRX_FRM_802_11_MGMT, |
| 5779 | (tANI_U16) frameLen, |
| 5780 | (void **) &pAddBAReqBuffer, |
| 5781 | (void **) &pPacket ))) |
| 5782 | { |
| 5783 | // Log error |
| 5784 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5785 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5786 | frameLen, |
| 5787 | halStatus ); |
| 5788 | |
| 5789 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5790 | goto returnAfterError; |
| 5791 | } |
| 5792 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5793 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5794 | |
| 5795 | // Copy necessary info to BD |
| 5796 | if( eSIR_SUCCESS != |
| 5797 | (statusCode = limPopulateMacHeader( pMac, |
| 5798 | pAddBAReqBuffer, |
| 5799 | SIR_MAC_MGMT_FRAME, |
| 5800 | SIR_MAC_MGMT_ACTION, |
| 5801 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5802 | goto returnAfterError; |
| 5803 | |
| 5804 | // Update A3 with the BSSID |
| 5805 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5806 | |
| 5807 | #if 0 |
| 5808 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5809 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5810 | WNI_CFG_BSSID, |
| 5811 | (tANI_U8 *) pMacHdr->bssId, |
| 5812 | &cfgLen )) |
| 5813 | { |
| 5814 | limLog( pMac, LOGP, |
| 5815 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5816 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | |
| 5818 | // FIXME - Need to convert to tSirRetStatus |
| 5819 | statusCode = eSIR_FAILURE; |
| 5820 | goto returnAfterError; |
| 5821 | } |
| 5822 | #endif//TO SUPPORT BT-AMP |
| 5823 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5824 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5825 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5826 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5827 | #endif |
| 5828 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5829 | // Now, we're ready to "pack" the frames |
| 5830 | nStatus = dot11fPackAddBAReq( pMac, |
| 5831 | &frmAddBAReq, |
| 5832 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5833 | nPayload, |
| 5834 | &nPayload ); |
| 5835 | |
| 5836 | if( DOT11F_FAILED( nStatus )) |
| 5837 | { |
| 5838 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5839 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5840 | nStatus ); |
| 5841 | |
| 5842 | // FIXME - Need to convert to tSirRetStatus |
| 5843 | statusCode = eSIR_FAILURE; |
| 5844 | goto returnAfterError; |
| 5845 | } |
| 5846 | else if( DOT11F_WARNED( nStatus )) |
| 5847 | { |
| 5848 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5849 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5850 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5851 | } |
| 5852 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5853 | limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with" |
| 5854 | " tid = %d policy = %d buffsize = %d " |
| 5855 | " amsduSupported = %d"), |
| 5856 | MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr), |
| 5857 | frmAddBAReq.AddBAParameterSet.tid, |
| 5858 | frmAddBAReq.AddBAParameterSet.policy, |
| 5859 | frmAddBAReq.AddBAParameterSet.bufferSize, |
| 5860 | frmAddBAReq.AddBAParameterSet.amsduSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5862 | limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ), |
| 5863 | frmAddBAReq.BAStartingSequenceControl.ssn, |
| 5864 | frmAddBAReq.BAStartingSequenceControl.fragNumber); |
| 5865 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5866 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5867 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5868 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | ) |
| 5870 | { |
| 5871 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5872 | } |
| 5873 | |
Yeshwanth Sriram Guntuka | da8466f | 2018-06-26 17:22:05 +0530 | [diff] [blame] | 5874 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 5875 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5876 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5877 | psessionEntry->peSessionId, |
| 5878 | pMacHdr->fc.subType)); |
| 5879 | halStatus = halTxFrame( pMac, |
| 5880 | pPacket, |
| 5881 | (tANI_U16) frameLen, |
| 5882 | HAL_TXRX_FRM_802_11_MGMT, |
| 5883 | ANI_TXDIR_TODS, |
| 5884 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5885 | limTxComplete, |
| 5886 | pAddBAReqBuffer, txFlag ); |
| 5887 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5888 | psessionEntry->peSessionId, |
| 5889 | halStatus)); |
| 5890 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5891 | { |
| 5892 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5893 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5894 | halStatus ); |
| 5895 | |
| 5896 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5897 | statusCode = eSIR_FAILURE; |
| 5898 | //Pkt will be freed up by the callback |
| 5899 | return statusCode; |
| 5900 | } |
| 5901 | else |
| 5902 | return eSIR_SUCCESS; |
| 5903 | |
| 5904 | returnAfterError: |
| 5905 | |
| 5906 | // Release buffer, if allocated |
| 5907 | if( NULL != pAddBAReqBuffer ) |
| 5908 | palPktFree( pMac->hHdd, |
| 5909 | HAL_TXRX_FRM_802_11_MGMT, |
| 5910 | (void *) pAddBAReqBuffer, |
| 5911 | (void *) pPacket ); |
| 5912 | |
| 5913 | return statusCode; |
| 5914 | } |
| 5915 | |
| 5916 | /** |
| 5917 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5918 | * |
| 5919 | * \sa limSendAddBARsp |
| 5920 | * |
| 5921 | * \param pMac The global tpAniSirGlobal object |
| 5922 | * |
| 5923 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5924 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5925 | * Frame to the peer |
| 5926 | * |
| 5927 | * \return eSIR_SUCCESS if setup completes successfully |
| 5928 | * eSIR_FAILURE is some problem is encountered |
| 5929 | */ |
| 5930 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5931 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5932 | tpPESession psessionEntry) |
| 5933 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5934 | tDot11fAddBARsp frmAddBARsp; |
| 5935 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5936 | tpSirMacMgmtHdr pMacHdr; |
| 5937 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5938 | tSirRetStatus statusCode; |
| 5939 | eHalStatus halStatus; |
| 5940 | void *pPacket; |
| 5941 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5942 | |
| 5943 | if(NULL == psessionEntry) |
| 5944 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5945 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5946 | return eSIR_FAILURE; |
| 5947 | } |
| 5948 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5949 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | |
| 5951 | // Category - 3 (BA) |
| 5952 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5953 | // Action - 1 (ADDBA Rsp) |
| 5954 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5955 | |
| 5956 | // Should be same as the one we received in the ADDBA Req |
| 5957 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5958 | |
| 5959 | // ADDBA Req status |
| 5960 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5961 | |
| 5962 | // Fill the ADDBA Parameter Set as provided by caller |
| 5963 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5964 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5965 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5966 | |
| 5967 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5968 | { |
| 5969 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5970 | psessionEntry->amsduSupportedInBA; |
| 5971 | } |
| 5972 | else |
| 5973 | { |
| 5974 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5975 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | |
| 5977 | // BA timeout |
| 5978 | // 0 - indicates no BA timeout |
| 5979 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5980 | |
| 5981 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5982 | |
| 5983 | if( DOT11F_FAILED( nStatus )) |
| 5984 | { |
| 5985 | limLog( pMac, LOGW, |
| 5986 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5987 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | nStatus ); |
| 5989 | |
| 5990 | // We'll fall back on the worst case scenario: |
| 5991 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5992 | } |
| 5993 | else if( DOT11F_WARNED( nStatus )) |
| 5994 | { |
| 5995 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5996 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5997 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5998 | nStatus ); |
| 5999 | } |
| 6000 | |
| 6001 | // Need to allocate a buffer for ADDBA AF |
| 6002 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6003 | |
| 6004 | // Allocate shared memory |
| 6005 | if( eHAL_STATUS_SUCCESS != |
| 6006 | (halStatus = palPktAlloc( pMac->hHdd, |
| 6007 | HAL_TXRX_FRM_802_11_MGMT, |
| 6008 | (tANI_U16) frameLen, |
| 6009 | (void **) &pAddBARspBuffer, |
| 6010 | (void **) &pPacket ))) |
| 6011 | { |
| 6012 | // Log error |
| 6013 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6014 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6015 | frameLen, |
| 6016 | halStatus ); |
| 6017 | |
| 6018 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 6019 | goto returnAfterError; |
| 6020 | } |
| 6021 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6022 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6023 | |
| 6024 | // Copy necessary info to BD |
| 6025 | if( eSIR_SUCCESS != |
| 6026 | (statusCode = limPopulateMacHeader( pMac, |
| 6027 | pAddBARspBuffer, |
| 6028 | SIR_MAC_MGMT_FRAME, |
| 6029 | SIR_MAC_MGMT_ACTION, |
| 6030 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 6031 | goto returnAfterError; |
| 6032 | |
| 6033 | // Update A3 with the BSSID |
| 6034 | |
| 6035 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 6036 | |
| 6037 | #if 0 |
| 6038 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 6039 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 6040 | WNI_CFG_BSSID, |
| 6041 | (tANI_U8 *) pMacHdr->bssId, |
| 6042 | &cfgLen )) |
| 6043 | { |
| 6044 | limLog( pMac, LOGP, |
| 6045 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6046 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6047 | |
| 6048 | // FIXME - Need to convert to tSirRetStatus |
| 6049 | statusCode = eSIR_FAILURE; |
| 6050 | goto returnAfterError; |
| 6051 | } |
| 6052 | #endif // TO SUPPORT BT-AMP |
| 6053 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 6054 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6055 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6056 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6057 | #endif |
| 6058 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6059 | // Now, we're ready to "pack" the frames |
| 6060 | nStatus = dot11fPackAddBARsp( pMac, |
| 6061 | &frmAddBARsp, |
| 6062 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 6063 | nPayload, |
| 6064 | &nPayload ); |
| 6065 | |
| 6066 | if( DOT11F_FAILED( nStatus )) |
| 6067 | { |
| 6068 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6069 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6070 | nStatus ); |
| 6071 | |
| 6072 | // FIXME - Need to convert to tSirRetStatus |
| 6073 | statusCode = eSIR_FAILURE; |
| 6074 | goto returnAfterError; |
| 6075 | } |
| 6076 | else if( DOT11F_WARNED( nStatus )) |
| 6077 | { |
| 6078 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6079 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 6080 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6081 | } |
| 6082 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 6083 | limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with" |
| 6084 | " tid = %d policy = %d buffsize = %d" |
| 6085 | " amsduSupported = %d status %d"), |
| 6086 | MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr), |
| 6087 | frmAddBARsp.AddBAParameterSet.tid, |
| 6088 | frmAddBARsp.AddBAParameterSet.policy, |
| 6089 | frmAddBARsp.AddBAParameterSet.bufferSize, |
| 6090 | frmAddBARsp.AddBAParameterSet.amsduSupported, |
| 6091 | frmAddBARsp.Status.status); |
| 6092 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6093 | |
| 6094 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6095 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6096 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6097 | ) |
| 6098 | { |
| 6099 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6100 | } |
| 6101 | |
Yeshwanth Sriram Guntuka | da8466f | 2018-06-26 17:22:05 +0530 | [diff] [blame] | 6102 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 6103 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6104 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6105 | psessionEntry->peSessionId, |
| 6106 | pMacHdr->fc.subType)); |
| 6107 | halStatus = halTxFrame( pMac, |
| 6108 | pPacket, |
| 6109 | (tANI_U16) frameLen, |
| 6110 | HAL_TXRX_FRM_802_11_MGMT, |
| 6111 | ANI_TXDIR_TODS, |
| 6112 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6113 | limTxComplete, |
| 6114 | pAddBARspBuffer, txFlag ); |
| 6115 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6116 | psessionEntry->peSessionId, |
| 6117 | halStatus)); |
| 6118 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 6119 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6120 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6121 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6122 | halStatus ); |
| 6123 | |
| 6124 | // FIXME - HAL error codes are different from PE error |
| 6125 | // codes!! And, this routine is returning tSirRetStatus |
| 6126 | statusCode = eSIR_FAILURE; |
| 6127 | //Pkt will be freed up by the callback |
| 6128 | return statusCode; |
| 6129 | } |
| 6130 | else |
| 6131 | return eSIR_SUCCESS; |
| 6132 | |
| 6133 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6134 | // Release buffer, if allocated |
| 6135 | if( NULL != pAddBARspBuffer ) |
| 6136 | palPktFree( pMac->hHdd, |
| 6137 | HAL_TXRX_FRM_802_11_MGMT, |
| 6138 | (void *) pAddBARspBuffer, |
| 6139 | (void *) pPacket ); |
| 6140 | |
| 6141 | return statusCode; |
| 6142 | } |
| 6143 | |
| 6144 | /** |
| 6145 | * \brief Send a DELBA Indication Action Frame to peer |
| 6146 | * |
| 6147 | * \sa limSendDelBAInd |
| 6148 | * |
| 6149 | * \param pMac The global tpAniSirGlobal object |
| 6150 | * |
| 6151 | * \param peerMacAddr MAC Address of peer |
| 6152 | * |
| 6153 | * \param reasonCode Reason for the DELBA notification |
| 6154 | * |
| 6155 | * \param pBAParameterSet The DELBA Parameter Set. |
| 6156 | * This identifies the TID for which the BA session is |
| 6157 | * being deleted. |
| 6158 | * |
| 6159 | * \return eSIR_SUCCESS if setup completes successfully |
| 6160 | * eSIR_FAILURE is some problem is encountered |
| 6161 | */ |
| 6162 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 6163 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 6164 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6165 | tDot11fDelBAInd frmDelBAInd; |
| 6166 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6167 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6168 | tpSirMacMgmtHdr pMacHdr; |
| 6169 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 6170 | tSirRetStatus statusCode; |
| 6171 | eHalStatus halStatus; |
| 6172 | void *pPacket; |
| 6173 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6174 | |
| 6175 | if(NULL == psessionEntry) |
| 6176 | { |
| 6177 | return eSIR_FAILURE; |
| 6178 | } |
| 6179 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6180 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6181 | |
| 6182 | // Category - 3 (BA) |
| 6183 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 6184 | // Action - 2 (DELBA) |
| 6185 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 6186 | |
| 6187 | // Fill the DELBA Parameter Set as provided by caller |
| 6188 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 6189 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 6190 | |
| 6191 | // BA Starting Sequence Number |
| 6192 | // Fragment number will always be zero |
| 6193 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 6194 | |
| 6195 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 6196 | |
| 6197 | if( DOT11F_FAILED( nStatus )) |
| 6198 | { |
| 6199 | limLog( pMac, LOGW, |
| 6200 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6201 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6202 | nStatus ); |
| 6203 | |
| 6204 | // We'll fall back on the worst case scenario: |
| 6205 | nPayload = sizeof( tDot11fDelBAInd ); |
| 6206 | } |
| 6207 | else if( DOT11F_WARNED( nStatus )) |
| 6208 | { |
| 6209 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6210 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6211 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6212 | nStatus ); |
| 6213 | } |
| 6214 | |
| 6215 | // Add the MGMT header to frame length |
| 6216 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6217 | |
| 6218 | // Allocate shared memory |
| 6219 | if( eHAL_STATUS_SUCCESS != |
| 6220 | (halStatus = palPktAlloc( pMac->hHdd, |
| 6221 | HAL_TXRX_FRM_802_11_MGMT, |
| 6222 | (tANI_U16) frameLen, |
| 6223 | (void **) &pDelBAIndBuffer, |
| 6224 | (void **) &pPacket ))) |
| 6225 | { |
| 6226 | // Log error |
| 6227 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6228 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6229 | frameLen, |
| 6230 | halStatus ); |
| 6231 | |
| 6232 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 6233 | goto returnAfterError; |
| 6234 | } |
| 6235 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6236 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6237 | |
| 6238 | // Copy necessary info to BD |
| 6239 | if( eSIR_SUCCESS != |
| 6240 | (statusCode = limPopulateMacHeader( pMac, |
| 6241 | pDelBAIndBuffer, |
| 6242 | SIR_MAC_MGMT_FRAME, |
| 6243 | SIR_MAC_MGMT_ACTION, |
| 6244 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 6245 | goto returnAfterError; |
| 6246 | |
| 6247 | // Update A3 with the BSSID |
| 6248 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 6249 | |
| 6250 | #if 0 |
| 6251 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 6252 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 6253 | WNI_CFG_BSSID, |
| 6254 | (tANI_U8 *) pMacHdr->bssId, |
| 6255 | &cfgLen )) |
| 6256 | { |
| 6257 | limLog( pMac, LOGP, |
| 6258 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6259 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6260 | |
| 6261 | // FIXME - Need to convert to tSirRetStatus |
| 6262 | statusCode = eSIR_FAILURE; |
| 6263 | goto returnAfterError; |
| 6264 | } |
| 6265 | #endif //TO SUPPORT BT-AMP |
| 6266 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 6267 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6268 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6269 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6270 | #endif |
| 6271 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6272 | // Now, we're ready to "pack" the frames |
| 6273 | nStatus = dot11fPackDelBAInd( pMac, |
| 6274 | &frmDelBAInd, |
| 6275 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 6276 | nPayload, |
| 6277 | &nPayload ); |
| 6278 | |
| 6279 | if( DOT11F_FAILED( nStatus )) |
| 6280 | { |
| 6281 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6282 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6283 | nStatus ); |
| 6284 | |
| 6285 | // FIXME - Need to convert to tSirRetStatus |
| 6286 | statusCode = eSIR_FAILURE; |
| 6287 | goto returnAfterError; |
| 6288 | } |
| 6289 | else if( DOT11F_WARNED( nStatus )) |
| 6290 | { |
| 6291 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6292 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 6293 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6294 | } |
| 6295 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 6296 | limLog( pMac, LOG1, |
| 6297 | FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d" |
| 6298 | " initiator = %d reason = %d" ), |
| 6299 | MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr), |
| 6300 | frmDelBAInd.DelBAParameterSet.tid, |
| 6301 | frmDelBAInd.DelBAParameterSet.initiator, |
| 6302 | frmDelBAInd.Reason.code); |
| 6303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6304 | |
| 6305 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6306 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6307 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6308 | ) |
| 6309 | { |
| 6310 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6311 | } |
| 6312 | |
Yeshwanth Sriram Guntuka | da8466f | 2018-06-26 17:22:05 +0530 | [diff] [blame] | 6313 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 6314 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6315 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6316 | psessionEntry->peSessionId, |
| 6317 | pMacHdr->fc.subType)); |
| 6318 | halStatus = halTxFrame( pMac, |
| 6319 | pPacket, |
| 6320 | (tANI_U16) frameLen, |
| 6321 | HAL_TXRX_FRM_802_11_MGMT, |
| 6322 | ANI_TXDIR_TODS, |
| 6323 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6324 | limTxComplete, |
| 6325 | pDelBAIndBuffer, txFlag ); |
| 6326 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6327 | psessionEntry->peSessionId, |
| 6328 | halStatus)); |
| 6329 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6330 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6331 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | statusCode = eSIR_FAILURE; |
| 6333 | //Pkt will be freed up by the callback |
| 6334 | return statusCode; |
| 6335 | } |
| 6336 | else |
| 6337 | return eSIR_SUCCESS; |
| 6338 | |
| 6339 | returnAfterError: |
| 6340 | |
| 6341 | // Release buffer, if allocated |
| 6342 | if( NULL != pDelBAIndBuffer ) |
| 6343 | palPktFree( pMac->hHdd, |
| 6344 | HAL_TXRX_FRM_802_11_MGMT, |
| 6345 | (void *) pDelBAIndBuffer, |
| 6346 | (void *) pPacket ); |
| 6347 | |
| 6348 | return statusCode; |
| 6349 | } |
| 6350 | |
| 6351 | #if defined WLAN_FEATURE_VOWIFI |
| 6352 | |
| 6353 | /** |
| 6354 | * \brief Send a Neighbor Report Request Action frame |
| 6355 | * |
| 6356 | * |
| 6357 | * \param pMac Pointer to the global MAC structure |
| 6358 | * |
| 6359 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 6360 | * |
| 6361 | * \param peer mac address of peer station. |
| 6362 | * |
| 6363 | * \param psessionEntry address of session entry. |
| 6364 | * |
| 6365 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6366 | * |
| 6367 | * |
| 6368 | */ |
| 6369 | |
| 6370 | tSirRetStatus |
| 6371 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 6372 | tpSirMacNeighborReportReq pNeighborReq, |
| 6373 | tSirMacAddr peer, |
| 6374 | tpPESession psessionEntry |
| 6375 | ) |
| 6376 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6377 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6378 | tDot11fNeighborReportRequest frm; |
| 6379 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6380 | tpSirMacMgmtHdr pMacHdr; |
| 6381 | tANI_U32 nBytes, nPayload, nStatus; |
| 6382 | void *pPacket; |
| 6383 | eHalStatus halstatus; |
| 6384 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | |
| 6386 | if ( psessionEntry == NULL ) |
| 6387 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6388 | 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] | 6389 | return eSIR_FAILURE; |
| 6390 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6391 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6392 | |
| 6393 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6394 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 6395 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 6396 | |
| 6397 | |
| 6398 | if( pNeighborReq->ssid_present ) |
| 6399 | { |
| 6400 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 6401 | } |
| 6402 | |
| 6403 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 6404 | if ( DOT11F_FAILED( nStatus ) ) |
| 6405 | { |
| 6406 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6407 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | nStatus ); |
| 6409 | // We'll fall back on the worst case scenario: |
| 6410 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 6411 | } |
| 6412 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6413 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6414 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6415 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6416 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6417 | } |
| 6418 | |
| 6419 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6420 | |
| 6421 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6422 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6423 | { |
| 6424 | 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] | 6425 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6426 | return eSIR_FAILURE; |
| 6427 | } |
| 6428 | |
| 6429 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6430 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6431 | |
| 6432 | // Copy necessary info to BD |
| 6433 | if( eSIR_SUCCESS != |
| 6434 | (statusCode = limPopulateMacHeader( pMac, |
| 6435 | pFrame, |
| 6436 | SIR_MAC_MGMT_FRAME, |
| 6437 | SIR_MAC_MGMT_ACTION, |
| 6438 | peer, psessionEntry->selfMacAddr))) |
| 6439 | goto returnAfterError; |
| 6440 | |
| 6441 | // Update A3 with the BSSID |
| 6442 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6443 | |
| 6444 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6445 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6446 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6447 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6448 | #endif |
| 6449 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6450 | // Now, we're ready to "pack" the frames |
| 6451 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 6452 | &frm, |
| 6453 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6454 | nPayload, |
| 6455 | &nPayload ); |
| 6456 | |
| 6457 | if( DOT11F_FAILED( nStatus )) |
| 6458 | { |
| 6459 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6460 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6461 | nStatus ); |
| 6462 | |
| 6463 | // FIXME - Need to convert to tSirRetStatus |
| 6464 | statusCode = eSIR_FAILURE; |
| 6465 | goto returnAfterError; |
| 6466 | } |
| 6467 | else if( DOT11F_WARNED( nStatus )) |
| 6468 | { |
| 6469 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6470 | FL( "There were warnings while packing Neighbor Report " |
| 6471 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6472 | } |
| 6473 | |
| 6474 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6475 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6476 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6477 | |
| 6478 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6479 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6480 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6481 | ) |
| 6482 | { |
| 6483 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6484 | } |
| 6485 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6486 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6487 | psessionEntry->peSessionId, |
| 6488 | pMacHdr->fc.subType)); |
| 6489 | halstatus = halTxFrame( pMac, |
| 6490 | pPacket, |
| 6491 | (tANI_U16) nBytes, |
| 6492 | HAL_TXRX_FRM_802_11_MGMT, |
| 6493 | ANI_TXDIR_TODS, |
| 6494 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6495 | limTxComplete, |
| 6496 | pFrame, txFlag ); |
| 6497 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6498 | psessionEntry->peSessionId, |
| 6499 | halstatus)); |
| 6500 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6501 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6502 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6503 | statusCode = eSIR_FAILURE; |
| 6504 | //Pkt will be freed up by the callback |
| 6505 | return statusCode; |
| 6506 | } |
| 6507 | else |
| 6508 | return eSIR_SUCCESS; |
| 6509 | |
| 6510 | returnAfterError: |
| 6511 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6512 | |
| 6513 | return statusCode; |
| 6514 | } // End limSendNeighborReportRequestFrame. |
| 6515 | |
| 6516 | /** |
| 6517 | * \brief Send a Link Report Action frame |
| 6518 | * |
| 6519 | * |
| 6520 | * \param pMac Pointer to the global MAC structure |
| 6521 | * |
| 6522 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6523 | * |
| 6524 | * \param peer mac address of peer station. |
| 6525 | * |
| 6526 | * \param psessionEntry address of session entry. |
| 6527 | * |
| 6528 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6529 | * |
| 6530 | * |
| 6531 | */ |
| 6532 | |
| 6533 | tSirRetStatus |
| 6534 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6535 | tpSirMacLinkReport pLinkReport, |
| 6536 | tSirMacAddr peer, |
| 6537 | tpPESession psessionEntry |
| 6538 | ) |
| 6539 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6540 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6541 | tDot11fLinkMeasurementReport frm; |
| 6542 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6543 | tpSirMacMgmtHdr pMacHdr; |
| 6544 | tANI_U32 nBytes, nPayload, nStatus; |
| 6545 | void *pPacket; |
| 6546 | eHalStatus halstatus; |
| 6547 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6548 | |
| 6549 | |
| 6550 | if ( psessionEntry == NULL ) |
| 6551 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6552 | 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] | 6553 | return eSIR_FAILURE; |
| 6554 | } |
| 6555 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6556 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6557 | |
| 6558 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6559 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6560 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6561 | |
| 6562 | |
| 6563 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6564 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6565 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6566 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6567 | //such case this way than changing the frame parser. |
| 6568 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6569 | frm.TPCEleLen.TPCLen = 2; |
| 6570 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6571 | frm.LinkMargin.linkMargin = 0; |
| 6572 | |
| 6573 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6574 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6575 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6576 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6577 | |
| 6578 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6579 | if ( DOT11F_FAILED( nStatus ) ) |
| 6580 | { |
| 6581 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6582 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6583 | nStatus ); |
| 6584 | // We'll fall back on the worst case scenario: |
| 6585 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6586 | } |
| 6587 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6588 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6589 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6590 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6591 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6592 | } |
| 6593 | |
| 6594 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6595 | |
| 6596 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6597 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6598 | { |
| 6599 | 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] | 6600 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | return eSIR_FAILURE; |
| 6602 | } |
| 6603 | |
| 6604 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6605 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6606 | |
| 6607 | // Copy necessary info to BD |
| 6608 | if( eSIR_SUCCESS != |
| 6609 | (statusCode = limPopulateMacHeader( pMac, |
| 6610 | pFrame, |
| 6611 | SIR_MAC_MGMT_FRAME, |
| 6612 | SIR_MAC_MGMT_ACTION, |
| 6613 | peer, psessionEntry->selfMacAddr))) |
| 6614 | goto returnAfterError; |
| 6615 | |
| 6616 | // Update A3 with the BSSID |
| 6617 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6618 | |
| 6619 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6620 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6621 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6622 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6623 | #endif |
| 6624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6625 | // Now, we're ready to "pack" the frames |
| 6626 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6627 | &frm, |
| 6628 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6629 | nPayload, |
| 6630 | &nPayload ); |
| 6631 | |
| 6632 | if( DOT11F_FAILED( nStatus )) |
| 6633 | { |
| 6634 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6635 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | nStatus ); |
| 6637 | |
| 6638 | // FIXME - Need to convert to tSirRetStatus |
| 6639 | statusCode = eSIR_FAILURE; |
| 6640 | goto returnAfterError; |
| 6641 | } |
| 6642 | else if( DOT11F_WARNED( nStatus )) |
| 6643 | { |
| 6644 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6645 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6646 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6647 | } |
| 6648 | |
| 6649 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6650 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6651 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6652 | |
| 6653 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6655 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6656 | ) |
| 6657 | { |
| 6658 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6659 | } |
| 6660 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6661 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6662 | psessionEntry->peSessionId, |
| 6663 | pMacHdr->fc.subType)); |
| 6664 | halstatus = halTxFrame( pMac, |
| 6665 | pPacket, |
| 6666 | (tANI_U16) nBytes, |
| 6667 | HAL_TXRX_FRM_802_11_MGMT, |
| 6668 | ANI_TXDIR_TODS, |
| 6669 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6670 | limTxComplete, |
| 6671 | pFrame, txFlag ); |
| 6672 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6673 | psessionEntry->peSessionId, |
| 6674 | halstatus)); |
| 6675 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6677 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6678 | statusCode = eSIR_FAILURE; |
| 6679 | //Pkt will be freed up by the callback |
| 6680 | return statusCode; |
| 6681 | } |
| 6682 | else |
| 6683 | return eSIR_SUCCESS; |
| 6684 | |
| 6685 | returnAfterError: |
| 6686 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6687 | |
| 6688 | return statusCode; |
| 6689 | } // End limSendLinkReportActionFrame. |
| 6690 | |
| 6691 | /** |
| 6692 | * \brief Send a Beacon Report Action frame |
| 6693 | * |
| 6694 | * |
| 6695 | * \param pMac Pointer to the global MAC structure |
| 6696 | * |
| 6697 | * \param dialog_token dialog token to be used in the action frame. |
| 6698 | * |
| 6699 | * \param num_report number of reports in pRRMReport. |
| 6700 | * |
| 6701 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6702 | * |
| 6703 | * \param peer mac address of peer station. |
| 6704 | * |
| 6705 | * \param psessionEntry address of session entry. |
| 6706 | * |
| 6707 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6708 | * |
| 6709 | * |
| 6710 | */ |
| 6711 | |
| 6712 | tSirRetStatus |
| 6713 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6714 | tANI_U8 dialog_token, |
| 6715 | tANI_U8 num_report, |
| 6716 | tpSirMacRadioMeasureReport pRRMReport, |
| 6717 | tSirMacAddr peer, |
| 6718 | tpPESession psessionEntry |
| 6719 | ) |
| 6720 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6721 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6722 | tANI_U8 *pFrame; |
| 6723 | tpSirMacMgmtHdr pMacHdr; |
| 6724 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6725 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6726 | eHalStatus halstatus; |
| 6727 | tANI_U8 i; |
| 6728 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6729 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6730 | tDot11fRadioMeasurementReport *frm = |
| 6731 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6732 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6733 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6734 | return eSIR_FAILURE; |
| 6735 | } |
| 6736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6737 | if ( psessionEntry == NULL ) |
| 6738 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6739 | 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] | 6740 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6741 | return eSIR_FAILURE; |
| 6742 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6743 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6744 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6745 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6746 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6747 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6748 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6749 | 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] | 6750 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6751 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6752 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6753 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6754 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6755 | 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] | 6756 | switch( pRRMReport[i].type ) |
| 6757 | { |
| 6758 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6759 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6760 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6761 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6762 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6763 | break; |
| 6764 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6765 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6766 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6767 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6768 | break; |
| 6769 | } |
| 6770 | } |
| 6771 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6772 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6773 | if ( DOT11F_FAILED( nStatus ) ) |
| 6774 | { |
| 6775 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6776 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6777 | nStatus ); |
| 6778 | // We'll fall back on the worst case scenario: |
| 6779 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6780 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6781 | return eSIR_FAILURE; |
| 6782 | } |
| 6783 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6784 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6785 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6786 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6787 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6788 | } |
| 6789 | |
| 6790 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6791 | |
| 6792 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6793 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6794 | { |
| 6795 | 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] | 6796 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6797 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6798 | return eSIR_FAILURE; |
| 6799 | } |
| 6800 | |
| 6801 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6802 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6803 | |
| 6804 | // Copy necessary info to BD |
| 6805 | if( eSIR_SUCCESS != |
| 6806 | (statusCode = limPopulateMacHeader( pMac, |
| 6807 | pFrame, |
| 6808 | SIR_MAC_MGMT_FRAME, |
| 6809 | SIR_MAC_MGMT_ACTION, |
| 6810 | peer, psessionEntry->selfMacAddr))) |
| 6811 | goto returnAfterError; |
| 6812 | |
| 6813 | // Update A3 with the BSSID |
| 6814 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6815 | |
| 6816 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6817 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6818 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6819 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6820 | #endif |
| 6821 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6822 | // Now, we're ready to "pack" the frames |
| 6823 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6824 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6825 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6826 | nPayload, |
| 6827 | &nPayload ); |
| 6828 | |
| 6829 | if( DOT11F_FAILED( nStatus )) |
| 6830 | { |
| 6831 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6832 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6833 | nStatus ); |
| 6834 | |
| 6835 | // FIXME - Need to convert to tSirRetStatus |
| 6836 | statusCode = eSIR_FAILURE; |
| 6837 | goto returnAfterError; |
| 6838 | } |
| 6839 | else if( DOT11F_WARNED( nStatus )) |
| 6840 | { |
| 6841 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6842 | FL( "There were warnings while packing Radio " |
| 6843 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6844 | } |
| 6845 | |
| 6846 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6847 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6848 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6849 | |
| 6850 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6851 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6852 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6853 | ) |
| 6854 | { |
| 6855 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6856 | } |
| 6857 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6858 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6859 | psessionEntry->peSessionId, |
| 6860 | pMacHdr->fc.subType)); |
| 6861 | halstatus = halTxFrame( pMac, |
| 6862 | pPacket, |
| 6863 | (tANI_U16) nBytes, |
| 6864 | HAL_TXRX_FRM_802_11_MGMT, |
| 6865 | ANI_TXDIR_TODS, |
| 6866 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6867 | limTxComplete, |
| 6868 | pFrame, txFlag ); |
| 6869 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6870 | psessionEntry->peSessionId, |
| 6871 | halstatus)); |
| 6872 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6873 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6874 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6875 | statusCode = eSIR_FAILURE; |
| 6876 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6877 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6878 | return statusCode; |
| 6879 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6880 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6881 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6882 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6883 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6884 | |
| 6885 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6886 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6887 | 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] | 6888 | return statusCode; |
| 6889 | } // End limSendBeaconReportActionFrame. |
| 6890 | |
| 6891 | #endif |
| 6892 | |
| 6893 | #ifdef WLAN_FEATURE_11W |
| 6894 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6895 | * \brief Send SA query request action frame to peer |
| 6896 | * |
| 6897 | * \sa limSendSaQueryRequestFrame |
| 6898 | * |
| 6899 | * |
| 6900 | * \param pMac The global tpAniSirGlobal object |
| 6901 | * |
| 6902 | * \param transId Transaction identifier |
| 6903 | * |
| 6904 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6905 | * |
| 6906 | * \param psessionEntry The PE session entry |
| 6907 | * |
| 6908 | * \return eSIR_SUCCESS if setup completes successfully |
| 6909 | * eSIR_FAILURE is some problem is encountered |
| 6910 | */ |
| 6911 | |
| 6912 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6913 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6914 | { |
| 6915 | |
| 6916 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6917 | tANI_U8 *pFrame; |
| 6918 | tSirRetStatus nSirStatus; |
| 6919 | tpSirMacMgmtHdr pMacHdr; |
| 6920 | tANI_U32 nBytes, nPayload, nStatus; |
| 6921 | void *pPacket; |
| 6922 | eHalStatus halstatus; |
| 6923 | tANI_U8 txFlag = 0; |
| 6924 | |
| 6925 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6926 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6927 | /* 11w action field is : |
| 6928 | action: 0 --> SA Query Request action frame |
| 6929 | action: 1 --> SA Query Response action frame */ |
| 6930 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6931 | /* 11w SA Query Request transId */ |
| 6932 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6933 | |
| 6934 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6935 | if ( DOT11F_FAILED( nStatus ) ) |
| 6936 | { |
| 6937 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6938 | "for an SA Query Request (0x%08x)."), |
| 6939 | nStatus ); |
| 6940 | // We'll fall back on the worst case scenario: |
| 6941 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6942 | } |
| 6943 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6944 | { |
| 6945 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6946 | "the packed size for an SA Query Request" |
| 6947 | " (0x%08x)."), nStatus ); |
| 6948 | } |
| 6949 | |
| 6950 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6951 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6952 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6953 | { |
| 6954 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6955 | "action frame"), nBytes ); |
| 6956 | return eSIR_FAILURE; |
| 6957 | } |
| 6958 | |
| 6959 | // Paranoia: |
| 6960 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6961 | |
| 6962 | // Copy necessary info to BD |
| 6963 | nSirStatus = limPopulateMacHeader( pMac, |
| 6964 | pFrame, |
| 6965 | SIR_MAC_MGMT_FRAME, |
| 6966 | SIR_MAC_MGMT_ACTION, |
| 6967 | peer, psessionEntry->selfMacAddr ); |
| 6968 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6969 | goto returnAfterError; |
| 6970 | |
| 6971 | // Update A3 with the BSSID |
| 6972 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6973 | |
| 6974 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6975 | |
| 6976 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6977 | // in the FC |
| 6978 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6979 | |
| 6980 | // Pack 11w SA Query Request frame |
| 6981 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6982 | &frm, |
| 6983 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6984 | nPayload, |
| 6985 | &nPayload ); |
| 6986 | |
| 6987 | if ( DOT11F_FAILED( nStatus )) |
| 6988 | { |
| 6989 | limLog( pMac, LOGE, |
| 6990 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6991 | nStatus ); |
| 6992 | // FIXME - Need to convert to tSirRetStatus |
| 6993 | nSirStatus = eSIR_FAILURE; |
| 6994 | goto returnAfterError; |
| 6995 | } |
| 6996 | else if ( DOT11F_WARNED( nStatus )) |
| 6997 | { |
| 6998 | limLog( pMac, LOGW, |
| 6999 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 7000 | nStatus); |
| 7001 | } |
| 7002 | |
| 7003 | limLog( pMac, LOG1, |
| 7004 | FL( "Sending an SA Query Request to " )); |
| 7005 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 7006 | limPrintMacAddr( pMac, peer, LOGE ); |
| 7007 | limLog( pMac, LOGE, |
| 7008 | FL( "Sending an SA Query Request from " )); |
| 7009 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 7010 | |
| 7011 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 7012 | #ifdef WLAN_FEATURE_P2P |
| 7013 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 7014 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 7015 | #endif |
| 7016 | ) |
| 7017 | { |
| 7018 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 7019 | } |
| 7020 | |
| 7021 | halstatus = halTxFrame( pMac, |
| 7022 | pPacket, |
| 7023 | (tANI_U16) nBytes, |
| 7024 | HAL_TXRX_FRM_802_11_MGMT, |
| 7025 | ANI_TXDIR_TODS, |
| 7026 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 7027 | limTxComplete, |
| 7028 | pFrame, txFlag ); |
| 7029 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 7030 | { |
| 7031 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 7032 | nSirStatus = eSIR_FAILURE; |
| 7033 | //Pkt will be freed up by the callback |
| 7034 | return nSirStatus; |
| 7035 | } |
| 7036 | else { |
| 7037 | return eSIR_SUCCESS; |
| 7038 | } |
| 7039 | |
| 7040 | returnAfterError: |
| 7041 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 7042 | return nSirStatus; |
| 7043 | } // End limSendSaQueryRequestFrame |
| 7044 | |
| 7045 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7046 | * \brief Send SA query response action frame to peer |
| 7047 | * |
| 7048 | * \sa limSendSaQueryResponseFrame |
| 7049 | * |
| 7050 | * |
| 7051 | * \param pMac The global tpAniSirGlobal object |
| 7052 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7053 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7054 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7055 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 7056 | * |
| 7057 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7058 | * |
| 7059 | * \return eSIR_SUCCESS if setup completes successfully |
| 7060 | * eSIR_FAILURE is some problem is encountered |
| 7061 | */ |
| 7062 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7063 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7064 | tSirMacAddr peer,tpPESession psessionEntry) |
| 7065 | { |
| 7066 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7067 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7068 | tANI_U8 *pFrame; |
| 7069 | tSirRetStatus nSirStatus; |
| 7070 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7071 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7072 | void *pPacket; |
| 7073 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 7074 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7075 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 7076 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7077 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 7078 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | action: 0 --> SA query request action frame |
| 7080 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7081 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 7082 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7083 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7084 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7085 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7086 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 7087 | if ( DOT11F_FAILED( nStatus ) ) |
| 7088 | { |
| 7089 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 7090 | "or a SA Query Response (0x%08x)."), |
| 7091 | nStatus ); |
| 7092 | // We'll fall back on the worst case scenario: |
| 7093 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 7094 | } |
| 7095 | else if ( DOT11F_WARNED( nStatus ) ) |
| 7096 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 7097 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7098 | "the packed size for an SA Query Response" |
| 7099 | " (0x%08x)."), nStatus ); |
| 7100 | } |
| 7101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7102 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 7103 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 7104 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 7105 | { |
| 7106 | 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] | 7107 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7108 | return eSIR_FAILURE; |
| 7109 | } |
| 7110 | |
| 7111 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 7112 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7113 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7114 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7115 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7116 | pFrame, |
| 7117 | SIR_MAC_MGMT_FRAME, |
| 7118 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7119 | peer, psessionEntry->selfMacAddr ); |
| 7120 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7121 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7122 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7123 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7124 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 7125 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7126 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7127 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7128 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 7129 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7130 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7131 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7132 | // Pack 11w SA query response frame |
| 7133 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 7134 | &frm, |
| 7135 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 7136 | nPayload, |
| 7137 | &nPayload ); |
| 7138 | |
| 7139 | if ( DOT11F_FAILED( nStatus )) |
| 7140 | { |
| 7141 | limLog( pMac, LOGE, |
| 7142 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 7143 | nStatus ); |
| 7144 | // FIXME - Need to convert to tSirRetStatus |
| 7145 | nSirStatus = eSIR_FAILURE; |
| 7146 | goto returnAfterError; |
| 7147 | } |
| 7148 | else if ( DOT11F_WARNED( nStatus )) |
| 7149 | { |
| 7150 | limLog( pMac, LOGW, |
| 7151 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 7152 | nStatus); |
| 7153 | } |
| 7154 | |
| 7155 | limLog( pMac, LOG1, |
| 7156 | FL( "Sending a SA Query Response to " )); |
| 7157 | limPrintMacAddr( pMac, peer, LOGW ); |
| 7158 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7159 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7160 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7161 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 7162 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7163 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7164 | ) |
| 7165 | { |
| 7166 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 7167 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7168 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 7169 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 7170 | psessionEntry->peSessionId, |
| 7171 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7172 | halstatus = halTxFrame( pMac, |
| 7173 | pPacket, |
| 7174 | (tANI_U16) nBytes, |
| 7175 | HAL_TXRX_FRM_802_11_MGMT, |
| 7176 | ANI_TXDIR_TODS, |
| 7177 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 7178 | limTxComplete, |
| 7179 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 7180 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 7181 | psessionEntry->peSessionId, |
| 7182 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7183 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7184 | { |
| 7185 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 7186 | nSirStatus = eSIR_FAILURE; |
| 7187 | //Pkt will be freed up by the callback |
| 7188 | return nSirStatus; |
| 7189 | } |
| 7190 | else { |
| 7191 | return eSIR_SUCCESS; |
| 7192 | } |
| 7193 | |
| 7194 | returnAfterError: |
| 7195 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 7196 | return nSirStatus; |
| 7197 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7198 | #endif |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 7199 | |
| 7200 | #ifdef WLAN_FEATURE_RMC |
| 7201 | tSirRetStatus |
| 7202 | limSendRMCActionFrame(tpAniSirGlobal pMac, |
| 7203 | tSirMacAddr peerMacAddr, |
| 7204 | tSirRMCInfo *pRMC, |
| 7205 | tpPESession psessionEntry) |
| 7206 | { |
| 7207 | tSirRetStatus nSirStatus; |
| 7208 | tANI_U8 *pFrame; |
| 7209 | tDot11fRMC RMC; |
| 7210 | tANI_U32 nPayload, nBytes, nStatus; |
| 7211 | tpSirMacMgmtHdr pMacHdr; |
| 7212 | void *pPacket; |
| 7213 | eHalStatus halstatus; |
| 7214 | tANI_U8 txFlag = 0; |
| 7215 | tANI_U8 MagicCode[] = { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e }; |
| 7216 | |
| 7217 | if (NULL == psessionEntry) |
| 7218 | { |
| 7219 | return eSIR_FAILURE; |
| 7220 | } |
| 7221 | |
| 7222 | vos_mem_set(( tANI_U8* )&RMC, sizeof( RMC ), 0); |
| 7223 | |
| 7224 | RMC.Action.action = pRMC->action; |
| 7225 | RMC.RMCDialogToken.token = pRMC->dialogToken; |
| 7226 | RMC.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 7227 | RMC.RMCVersion.version = SIR_MAC_RMC_VER; |
| 7228 | |
| 7229 | vos_mem_copy(&RMC.RMCOUI.oui, SIR_MAC_RMC_OUI, SIR_MAC_RMC_OUI_SIZE); |
| 7230 | vos_mem_copy(&RMC.MagicCode.magic, MagicCode, sizeof(MagicCode)); |
| 7231 | |
| 7232 | vos_mem_copy(&RMC.Ruler.mac, pRMC->mcastRuler, sizeof(tSirMacAddr)); |
| 7233 | |
| 7234 | nStatus = dot11fGetPackedRMCSize( pMac, &RMC, &nPayload ); |
| 7235 | if ( DOT11F_FAILED( nStatus ) ) |
| 7236 | { |
| 7237 | limLog( pMac, LOGE, FL("Failed to calculate the packed size for " |
| 7238 | "an RMC (0x%08x)."), |
| 7239 | nStatus ); |
| 7240 | // We'll fall back on the worst case scenario: |
| 7241 | nPayload = sizeof( tDot11fRMC ); |
| 7242 | } |
| 7243 | else if ( DOT11F_WARNED( nStatus ) ) |
| 7244 | { |
| 7245 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 7246 | "the packed size for an RMC Action Frame" |
| 7247 | " (0x%08x)."), nStatus ); |
| 7248 | } |
| 7249 | |
| 7250 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 7251 | |
| 7252 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 7253 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 7254 | ( void** ) &pPacket ); |
| 7255 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 7256 | { |
| 7257 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an RMC " |
| 7258 | "Action Frame."), nBytes ); |
| 7259 | return eSIR_FAILURE; |
| 7260 | } |
| 7261 | |
| 7262 | // Paranoia: |
| 7263 | vos_mem_set( pFrame, nBytes, 0 ); |
| 7264 | |
| 7265 | // Next, we fill out the buffer descriptor: |
| 7266 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 7267 | SIR_MAC_MGMT_ACTION, peerMacAddr, |
| 7268 | psessionEntry->selfMacAddr); |
| 7269 | if ( eSIR_SUCCESS != nSirStatus ) |
| 7270 | { |
| 7271 | limLog( pMac, LOGE, FL("Failed to populate the buffer descriptor " |
| 7272 | "for an RMC Action Frame (%d)."), |
| 7273 | nSirStatus ); |
| 7274 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 7275 | ( void* ) pFrame, ( void* ) pPacket ); |
| 7276 | return nSirStatus; |
| 7277 | } |
| 7278 | |
| 7279 | // Update A3 with the BSSID |
| 7280 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 7281 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 7282 | |
| 7283 | // That done, pack the struct: |
| 7284 | nStatus = dot11fPackRMC( pMac, &RMC, |
| 7285 | pFrame + sizeof(tSirMacMgmtHdr), |
| 7286 | nPayload, &nPayload ); |
| 7287 | if ( DOT11F_FAILED( nStatus ) ) |
| 7288 | { |
| 7289 | limLog( pMac, LOGE, FL("Failed to pack an RMC " |
| 7290 | "(0x%08x)."), |
| 7291 | nStatus ); |
| 7292 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, |
| 7293 | ( void* ) pPacket ); |
| 7294 | return eSIR_FAILURE; |
| 7295 | } |
| 7296 | else if ( DOT11F_WARNED( nStatus ) ) |
| 7297 | { |
| 7298 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 7299 | "an RMC (0x%08x)."), nStatus ); |
| 7300 | } |
| 7301 | |
| 7302 | limLog( pMac, LOG1, FL("Sending an RMC Action frame to " |
| 7303 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMacAddr)); |
| 7304 | |
| 7305 | /* |
| 7306 | * With this masking, RMC action frames will be sent |
| 7307 | * at self-sta rates for both 2G and 5G bands. |
| 7308 | */ |
| 7309 | txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK; |
| 7310 | |
| 7311 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 7312 | psessionEntry->peSessionId, |
| 7313 | pMacHdr->fc.subType)); |
| 7314 | // Queue RMC Action frame in high priority WQ |
| 7315 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 7316 | HAL_TXRX_FRM_802_11_MGMT, |
| 7317 | ANI_TXDIR_TODS, |
| 7318 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 7319 | limTxComplete, pFrame, txFlag ); |
| 7320 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 7321 | psessionEntry->peSessionId, |
| 7322 | halstatus)); |
| 7323 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 7324 | { |
| 7325 | limLog( pMac, LOGE, FL( "*** Could not send an RMC Action frame" |
| 7326 | " (%X) ***" ), halstatus ); |
| 7327 | //Pkt will be freed up by the callback |
| 7328 | return eSIR_FAILURE; |
| 7329 | } |
| 7330 | |
| 7331 | return eSIR_SUCCESS; |
| 7332 | |
| 7333 | } // End limSendRMCActionFrame. |
| 7334 | |
| 7335 | #endif /* WLAN_FEATURE_RMC */ |