Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2017 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 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 801 | |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 802 | if ( psessionEntry->pLimStartBssReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 803 | { |
| 804 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 805 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 806 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 807 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 808 | } |
| 809 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 810 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | |
| 812 | #if defined(FEATURE_WLAN_WAPI) |
| 813 | if( psessionEntry->pLimStartBssReq ) |
| 814 | { |
| 815 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 816 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | } |
| 818 | |
| 819 | #endif // defined(FEATURE_WLAN_WAPI) |
| 820 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 821 | addnIEPresent = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 823 | { |
| 824 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 825 | } |
| 826 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 827 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 828 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 829 | { |
| 830 | |
| 831 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 832 | &addnIEPresent) != eSIR_SUCCESS) |
| 833 | { |
| 834 | 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] | 835 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 836 | return; |
| 837 | } |
| 838 | } |
| 839 | |
| 840 | if (addnIEPresent) |
| 841 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 842 | |
| 843 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 844 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 845 | { |
| 846 | PELOGE(limLog(pMac, LOGE, |
| 847 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 848 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | return; |
| 850 | } |
| 851 | |
| 852 | //Probe rsp IE available |
| 853 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 854 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 855 | { |
| 856 | 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] | 857 | vos_mem_free(addIE); |
| 858 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | return; |
| 860 | } |
| 861 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 862 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 863 | { |
| 864 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 865 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 866 | &addnIE1Len) ) |
| 867 | { |
| 868 | limLog(pMac, LOGP, |
| 869 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 870 | vos_mem_free(addIE); |
| 871 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 872 | return; |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | //Probe rsp IE available |
| 877 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 878 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 879 | { |
| 880 | 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] | 881 | vos_mem_free(addIE); |
| 882 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 883 | return; |
| 884 | } |
| 885 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 886 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 887 | { |
| 888 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 889 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 890 | &addnIE2Len) ) |
| 891 | { |
| 892 | limLog(pMac, LOGP, |
| 893 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 894 | vos_mem_free(addIE); |
| 895 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 896 | return; |
| 897 | } |
| 898 | } |
| 899 | |
| 900 | //Probe rsp IE available |
| 901 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 902 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 903 | { |
| 904 | 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] | 905 | vos_mem_free(addIE); |
| 906 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | return; |
| 908 | } |
| 909 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 910 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 911 | { |
| 912 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 913 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 914 | &addIE[addnIE1Len + addnIE2Len], |
| 915 | &addnIE3Len) ) |
| 916 | { |
| 917 | limLog(pMac, LOGP, |
| 918 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 919 | vos_mem_free(addIE); |
| 920 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 921 | return; |
| 922 | } |
| 923 | } |
| 924 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 925 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 926 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 927 | { |
| 928 | limLog(pMac, LOGP, |
| 929 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 930 | vos_mem_free(addIE); |
| 931 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | return; |
| 933 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 934 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 935 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 936 | addIE, |
| 937 | &totalAddnIeLen, |
| 938 | &extractedExtCap ); |
| 939 | if(eSIR_SUCCESS != nSirStatus ) |
| 940 | { |
| 941 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 942 | limLog(pMac, LOG1, |
| 943 | FL("Unable to Stripoff ExtCap IE from Probe Rsp")); |
| 944 | } |
| 945 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 946 | nBytes = nBytes + totalAddnIeLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 947 | limLog(pMac, LOG1, |
| 948 | FL("probe rsp packet size is %d "), nBytes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 949 | if (probeReqP2pIe) |
| 950 | { |
| 951 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 952 | if (pP2pIe != NULL) |
| 953 | { |
| 954 | //get NoA attribute stream P2P IE |
| 955 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 956 | if (noaLen != 0) |
| 957 | { |
| 958 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 959 | &noaStream[0], noaLen); |
| 960 | nBytes = nBytes + total_noaLen; |
Kaushik, Sushant | a5ee77a | 2014-07-30 19:35:25 +0530 | [diff] [blame] | 961 | limLog(pMac, LOG1, |
| 962 | FL("p2p probe rsp packet size is %d, noalength is %d"), |
| 963 | nBytes, total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 964 | } |
| 965 | } |
| 966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 967 | } |
| 968 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 969 | /*merge ExtCap IE*/ |
| 970 | if (extractedExtCapFlag && extractedExtCap.present) |
| 971 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 972 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap, true); |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
| 976 | if ( DOT11F_FAILED( nStatus ) ) |
| 977 | { |
| 978 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 979 | "or a Probe Response (0x%08x)."), |
| 980 | nStatus ); |
| 981 | // We'll fall back on the worst case scenario: |
| 982 | nPayload = sizeof( tDot11fProbeResponse ); |
| 983 | } |
| 984 | else if ( DOT11F_WARNED( nStatus ) ) |
| 985 | { |
| 986 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 987 | "the packed size for a Probe Response " |
| 988 | "(0x%08x)."), nStatus ); |
| 989 | } |
| 990 | |
| 991 | nBytes += nPayload + sizeof( tSirMacMgmtHdr ); |
| 992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 993 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 994 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 995 | ( void** ) &pPacket ); |
| 996 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 997 | { |
| 998 | 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] | 999 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1000 | if ( addIE != NULL ) |
| 1001 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1002 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1003 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1004 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1005 | return; |
| 1006 | } |
| 1007 | |
| 1008 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1009 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | |
| 1011 | // Next, we fill out the buffer descriptor: |
| 1012 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1013 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 1014 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1015 | { |
| 1016 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1017 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1018 | nSirStatus ); |
| 1019 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1020 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1021 | if ( addIE != NULL ) |
| 1022 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1023 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1024 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1025 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1026 | return; |
| 1027 | } |
| 1028 | |
| 1029 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1030 | |
| 1031 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1032 | |
| 1033 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1034 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1035 | nPayload, &nPayload ); |
| 1036 | if ( DOT11F_FAILED( nStatus ) ) |
| 1037 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1038 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | nStatus ); |
| 1040 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1041 | if ( addIE != NULL ) |
| 1042 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1043 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1045 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1046 | return; // allocated! |
| 1047 | } |
| 1048 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1049 | { |
| 1050 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1051 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1052 | } |
| 1053 | |
| 1054 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 1055 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1056 | |
| 1057 | pMac->sys.probeRespond++; |
| 1058 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1059 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 1060 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1061 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1062 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 1063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | |
| 1065 | if ( addnIEPresent ) |
| 1066 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1067 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | if (noaLen != 0) |
| 1070 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1071 | 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] | 1072 | { |
| 1073 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 1074 | FL("Not able to insert NoA because of length constraint." |
| 1075 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1076 | vos_mem_free(addIE); |
| 1077 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1078 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1079 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1080 | return; |
| 1081 | } |
| 1082 | else |
| 1083 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1084 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 1085 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1086 | } |
| 1087 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | |
| 1089 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1091 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1092 | ) |
| 1093 | { |
| 1094 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1095 | } |
| 1096 | |
| 1097 | // Queue Probe Response frame in high priority WQ |
| 1098 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 1099 | ( tANI_U16 ) nBytes, |
| 1100 | HAL_TXRX_FRM_802_11_MGMT, |
| 1101 | ANI_TXDIR_TODS, |
| 1102 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 1103 | limTxComplete, pFrame, txFlag ); |
| 1104 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1105 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1106 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1107 | //Pkt will be freed up by the callback |
| 1108 | } |
| 1109 | |
| 1110 | if ( addIE != NULL ) |
| 1111 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1112 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1113 | } |
| 1114 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1115 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1116 | return; |
| 1117 | |
| 1118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | } // End limSendProbeRspMgmtFrame. |
| 1120 | |
| 1121 | void |
| 1122 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 1123 | tSirMacAddr peerMacAddr, |
| 1124 | tSirAddtsReqInfo *pAddTS, |
| 1125 | tpPESession psessionEntry) |
| 1126 | { |
| 1127 | tANI_U16 i; |
| 1128 | tANI_U8 *pFrame; |
| 1129 | tSirRetStatus nSirStatus; |
| 1130 | tDot11fAddTSRequest AddTSReq; |
| 1131 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 1132 | tANI_U32 nPayload, nBytes, nStatus; |
| 1133 | tpSirMacMgmtHdr pMacHdr; |
| 1134 | void *pPacket; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1135 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | tANI_U32 phyMode; |
| 1137 | #endif |
| 1138 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1139 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1140 | |
| 1141 | if(NULL == psessionEntry) |
| 1142 | { |
| 1143 | return; |
| 1144 | } |
| 1145 | |
| 1146 | if ( ! pAddTS->wmeTspecPresent ) |
| 1147 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1148 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1149 | |
| 1150 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1151 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1152 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1153 | if ( pAddTS->lleTspecPresent ) |
| 1154 | { |
| 1155 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 1156 | } |
| 1157 | else |
| 1158 | { |
| 1159 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 1160 | } |
| 1161 | |
| 1162 | if ( pAddTS->lleTspecPresent ) |
| 1163 | { |
| 1164 | AddTSReq.num_WMMTCLAS = 0; |
| 1165 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 1166 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1167 | { |
| 1168 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1169 | &AddTSReq.TCLAS[i] ); |
| 1170 | } |
| 1171 | } |
| 1172 | else |
| 1173 | { |
| 1174 | AddTSReq.num_TCLAS = 0; |
| 1175 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1176 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1177 | { |
| 1178 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1179 | &AddTSReq.WMMTCLAS[i] ); |
| 1180 | } |
| 1181 | } |
| 1182 | |
| 1183 | if ( pAddTS->tclasProcPresent ) |
| 1184 | { |
| 1185 | if ( pAddTS->lleTspecPresent ) |
| 1186 | { |
| 1187 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1188 | AddTSReq.TCLASSPROC.present = 1; |
| 1189 | } |
| 1190 | else |
| 1191 | { |
| 1192 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1193 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1194 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1195 | } |
| 1196 | } |
| 1197 | |
| 1198 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1199 | if ( DOT11F_FAILED( nStatus ) ) |
| 1200 | { |
| 1201 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1202 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | nStatus ); |
| 1204 | // We'll fall back on the worst case scenario: |
| 1205 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1206 | } |
| 1207 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1208 | { |
| 1209 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1210 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1211 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1212 | } |
| 1213 | } |
| 1214 | else |
| 1215 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1216 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1217 | |
| 1218 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1219 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1220 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1221 | |
| 1222 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1223 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1224 | |
| 1225 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1226 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1227 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1228 | |
| 1229 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1230 | { |
| 1231 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1232 | } |
| 1233 | else |
| 1234 | { |
| 1235 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1236 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1237 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1238 | #endif |
| 1239 | // fillWmeTspecIE |
| 1240 | |
| 1241 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1242 | if ( DOT11F_FAILED( nStatus ) ) |
| 1243 | { |
| 1244 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1245 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1246 | nStatus ); |
| 1247 | // We'll fall back on the worst case scenario: |
| 1248 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1249 | } |
| 1250 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1251 | { |
| 1252 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1253 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1254 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1255 | } |
| 1256 | } |
| 1257 | |
| 1258 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1259 | |
| 1260 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1261 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1262 | ( void** ) &pPacket ); |
| 1263 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1264 | { |
| 1265 | 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] | 1266 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1267 | return; |
| 1268 | } |
| 1269 | |
| 1270 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1271 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1272 | |
| 1273 | // Next, we fill out the buffer descriptor: |
| 1274 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1275 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1276 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1277 | { |
| 1278 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1279 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | nSirStatus ); |
| 1281 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1282 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1283 | return; |
| 1284 | } |
| 1285 | |
| 1286 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1287 | |
| 1288 | #if 0 |
| 1289 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1290 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1291 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1292 | { |
| 1293 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1294 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1295 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1296 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1297 | return; |
| 1298 | } |
| 1299 | #endif //TO SUPPORT BT-AMP |
| 1300 | |
| 1301 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1302 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1303 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1304 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1305 | #endif |
| 1306 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1307 | // That done, pack the struct: |
| 1308 | if ( ! pAddTS->wmeTspecPresent ) |
| 1309 | { |
| 1310 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1311 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1312 | nPayload, &nPayload ); |
| 1313 | if ( DOT11F_FAILED( nStatus ) ) |
| 1314 | { |
| 1315 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1316 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1317 | nStatus ); |
| 1318 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1319 | return; // allocated! |
| 1320 | } |
| 1321 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1322 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1323 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1324 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | } |
| 1326 | } |
| 1327 | else |
| 1328 | { |
| 1329 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1330 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1331 | nPayload, &nPayload ); |
| 1332 | if ( DOT11F_FAILED( nStatus ) ) |
| 1333 | { |
| 1334 | 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] | 1335 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1336 | nStatus ); |
| 1337 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1338 | return; // allocated! |
| 1339 | } |
| 1340 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1341 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1342 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1343 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1344 | } |
| 1345 | } |
| 1346 | |
Abhishek Singh | 127a844 | 2014-12-15 17:31:27 +0530 | [diff] [blame] | 1347 | limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") ); |
| 1348 | limPrintMacAddr( pMac, peerMacAddr, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1349 | |
| 1350 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1352 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | ) |
| 1354 | { |
| 1355 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1356 | } |
| 1357 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1358 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1359 | psessionEntry->peSessionId, |
| 1360 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1361 | // Queue Addts Response frame in high priority WQ |
| 1362 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1363 | HAL_TXRX_FRM_802_11_MGMT, |
| 1364 | ANI_TXDIR_TODS, |
| 1365 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1366 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1367 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1368 | psessionEntry->peSessionId, |
| 1369 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1371 | { |
| 1372 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1373 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1374 | //Pkt will be freed up by the callback |
| 1375 | } |
| 1376 | |
| 1377 | } // End limSendAddtsReqActionFrame. |
| 1378 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1379 | |
| 1380 | |
| 1381 | void |
| 1382 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1383 | tANI_U16 statusCode, |
| 1384 | tANI_U16 aid, |
| 1385 | tSirMacAddr peerMacAddr, |
| 1386 | tANI_U8 subType, |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1387 | tpDphHashNode pSta,tpPESession psessionEntry, |
| 1388 | assoc_rsp_tx_context *tx_complete_context) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1389 | { |
| 1390 | static tDot11fAssocResponse frm; |
| 1391 | tANI_U8 *pFrame, *macAddr; |
| 1392 | tpSirMacMgmtHdr pMacHdr; |
| 1393 | tSirRetStatus nSirStatus; |
| 1394 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1395 | tHalBitVal qosMode, wmeMode; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1396 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1397 | void *pPacket; |
| 1398 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1399 | tUpdateBeaconParams beaconParams; |
| 1400 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1401 | tANI_U32 addnIEPresent = false; |
| 1402 | tANI_U32 addnIELen=0; |
| 1403 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1404 | tpSirAssocReq pAssocReq = NULL; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1405 | tANI_U16 addStripoffIELen = 0; |
| 1406 | tDot11fIEExtCap extractedExtCap; |
| 1407 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1408 | tANI_U32 nBytes = 0; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 1409 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1410 | #ifdef WLAN_FEATURE_11W |
| 1411 | tANI_U32 retryInterval; |
| 1412 | tANI_U32 maxRetries; |
| 1413 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | |
| 1415 | if(NULL == psessionEntry) |
| 1416 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1417 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | return; |
| 1419 | } |
| 1420 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1421 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | |
| 1423 | limGetQosMode(psessionEntry, &qosMode); |
| 1424 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1425 | |
| 1426 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1427 | // STA sent a traffic spec. |
| 1428 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1429 | |
| 1430 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1431 | |
| 1432 | frm.Status.status = statusCode; |
| 1433 | |
| 1434 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1435 | |
| 1436 | if ( NULL == pSta ) |
| 1437 | { |
| 1438 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1439 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1440 | } |
| 1441 | else |
| 1442 | { |
| 1443 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1444 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1445 | } |
| 1446 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1447 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1448 | { |
| 1449 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1450 | { |
| 1451 | pAssocReq = |
| 1452 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1453 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1454 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1455 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1456 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | } |
| 1458 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1459 | |
| 1460 | if ( NULL != pSta ) |
| 1461 | { |
| 1462 | if ( eHAL_SET == qosMode ) |
| 1463 | { |
| 1464 | if ( pSta->lleEnabled ) |
| 1465 | { |
| 1466 | lleMode = 1; |
| 1467 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1468 | { |
| 1469 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1470 | |
| 1471 | // FramesToDo:... |
| 1472 | // if ( fAddTS ) |
| 1473 | // { |
| 1474 | // tANI_U8 *pAf = pBody; |
| 1475 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1476 | // tANI_U32 tlen; |
| 1477 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1478 | // &tlen, bufLen - frameLen); |
| 1479 | // } // End if on Add TS. |
| 1480 | } |
| 1481 | } // End if on .11e enabled in 'pSta'. |
| 1482 | } // End if on QOS Mode on. |
| 1483 | |
| 1484 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1485 | { |
| 1486 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1487 | { |
| 1488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1489 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1490 | |
| 1491 | if ( pSta->wsmEnabled ) |
| 1492 | { |
| 1493 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1494 | } |
| 1495 | } |
| 1496 | } |
| 1497 | |
| 1498 | if ( pSta->aniPeer ) |
| 1499 | { |
| 1500 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1501 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1502 | { |
| 1503 | edcaInclude = 1; |
| 1504 | } |
| 1505 | |
| 1506 | } // End if on Airgo peer. |
| 1507 | |
| 1508 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1509 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1510 | { |
Krishna Kumaar Natarajan | 025a860 | 2015-08-04 16:31:36 +0530 | [diff] [blame] | 1511 | limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1512 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Sachin Ahuja | c3a2623 | 2014-09-23 22:27:30 +0530 | [diff] [blame] | 1513 | /* |
| 1514 | *Check the STA capability and update the HTCaps accordingly |
| 1515 | */ |
| 1516 | frm.HTCaps.supportedChannelWidthSet = |
| 1517 | (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ? |
| 1518 | pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ; |
| 1519 | |
| 1520 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1521 | frm.HTCaps.shortGI40MHz = 0; |
| 1522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1523 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1524 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 1525 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 1526 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 1527 | frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave, |
| 1528 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz, |
| 1529 | frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor); |
| 1530 | |
| 1531 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1532 | |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1533 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1534 | /* Populate Overlapping BSS Scan Parameters IEs, |
| 1535 | * when operating in HT40 in 2.4GHz. |
| 1536 | */ |
Hardik Kantilal Patel | 3c23524 | 2015-01-02 17:56:18 +0530 | [diff] [blame] | 1537 | if ((pMac->roam.configParam.apHT40_24GEnabled) |
| 1538 | && (IS_DOT11_MODE_HT(psessionEntry->dot11mode))) |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1539 | { |
| 1540 | PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters, |
| 1541 | psessionEntry); |
Hardik Kantilal Patel | ee5874c | 2015-01-14 15:23:28 +0530 | [diff] [blame] | 1542 | /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in |
| 1543 | * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK |
| 1544 | * Mode in 40 MHz bit in HT capablity. |
| 1545 | */ |
| 1546 | frm.HTCaps.dsssCckMode40MHz = 1; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1547 | } |
| 1548 | #endif |
| 1549 | |
| 1550 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1551 | #ifdef WLAN_FEATURE_11AC |
| 1552 | if( pSta->mlmStaContext.vhtCapability && |
| 1553 | psessionEntry->vhtCapability ) |
| 1554 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1555 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 1556 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 1557 | psessionEntry->currentOperChannel, eSIR_TRUE ); |
| 1558 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation, |
| 1559 | psessionEntry->currentOperChannel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1560 | } |
| 1561 | #endif |
| 1562 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1563 | #ifdef WLAN_FEATURE_11W |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1564 | if( eSIR_MAC_TRY_AGAIN_LATER == statusCode ) |
| 1565 | { |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1566 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
| 1567 | &maxRetries ) != eSIR_SUCCESS ) |
| 1568 | limLog( pMac, LOGE, |
| 1569 | FL("Could not retrieve PMF SA Query maximum retries value") ); |
| 1570 | else |
| 1571 | if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
| 1572 | &retryInterval ) != eSIR_SUCCESS) |
| 1573 | limLog( pMac, LOGE, |
| 1574 | FL("Could not retrieve PMF SA Query timer interval value") ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1575 | else |
Chet Lanctot | fadc8e3 | 2014-04-24 14:50:52 -0700 | [diff] [blame] | 1576 | PopulateDot11fTimeoutInterval( |
| 1577 | pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1578 | (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval ); |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1579 | } |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1580 | #endif |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 1581 | } // End if on non-NULL 'pSta'. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1582 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1583 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1584 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1585 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1586 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1587 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1589 | |
| 1590 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1591 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1592 | |
| 1593 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1594 | |
| 1595 | //Send message to HAL about beacon parameter change. |
| 1596 | if(beaconParams.paramChangeBitmap) |
| 1597 | { |
| 1598 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1599 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1600 | } |
| 1601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1602 | if ( pAssocReq != NULL ) |
| 1603 | { |
| 1604 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1605 | &addnIEPresent) != eSIR_SUCCESS) |
| 1606 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1607 | limLog(pMac, LOGP, FL("Unable to get " |
| 1608 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1609 | return; |
| 1610 | } |
| 1611 | |
| 1612 | if (addnIEPresent) |
| 1613 | { |
| 1614 | //Assoc rsp IE available |
| 1615 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1616 | &addnIELen) != eSIR_SUCCESS) |
| 1617 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1618 | limLog(pMac, LOGP, FL("Unable to get " |
| 1619 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1620 | return; |
| 1621 | } |
| 1622 | |
| 1623 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1624 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1625 | { |
| 1626 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1627 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1628 | { |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1629 | |
| 1630 | vos_mem_set(( tANI_U8* )&extractedExtCap, |
| 1631 | sizeof( tDot11fIEExtCap ), 0); |
Mahesh A Saptasagar | e00ff53 | 2014-10-17 19:05:14 +0530 | [diff] [blame] | 1632 | addStripoffIELen = addnIELen; |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1633 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, |
| 1634 | &addIE[0], |
| 1635 | &addStripoffIELen, |
| 1636 | &extractedExtCap ); |
| 1637 | if(eSIR_SUCCESS != nSirStatus) |
| 1638 | { |
| 1639 | limLog(pMac, LOG1, |
| 1640 | FL("Unable to Stripoff ExtCap IE from Assoc Rsp")); |
| 1641 | } |
| 1642 | else |
| 1643 | { |
| 1644 | addnIELen = addStripoffIELen; |
| 1645 | extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
| 1646 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1647 | nBytes = nBytes + addnIELen; |
| 1648 | } |
| 1649 | } |
| 1650 | } |
| 1651 | } |
| 1652 | |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1653 | /* merge the ExtCap struct*/ |
| 1654 | if (extractedExtCapFlag && extractedExtCap.present) |
| 1655 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 1656 | limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap, true); |
Mahesh A Saptasagar | 38c177e | 2014-10-17 18:55:48 +0530 | [diff] [blame] | 1657 | } |
| 1658 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 1659 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1660 | if ( DOT11F_FAILED( nStatus ) ) |
| 1661 | { |
| 1662 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
| 1663 | "or an Association Response (0x%08x)."), |
| 1664 | nStatus ); |
| 1665 | return; |
| 1666 | } |
| 1667 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1668 | { |
| 1669 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 1670 | "the packed size for an Association Re" |
| 1671 | "sponse (0x%08x)."), nStatus ); |
| 1672 | } |
| 1673 | |
| 1674 | nBytes += sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1675 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1676 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1677 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1678 | ( void** ) &pPacket ); |
| 1679 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1680 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1681 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1682 | return; |
| 1683 | } |
| 1684 | |
| 1685 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1686 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1687 | |
| 1688 | // Next, we fill out the buffer descriptor: |
| 1689 | nSirStatus = limPopulateMacHeader( pMac, |
| 1690 | pFrame, |
| 1691 | SIR_MAC_MGMT_FRAME, |
| 1692 | ( LIM_ASSOC == subType ) ? |
| 1693 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1694 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1695 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1696 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1697 | { |
| 1698 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1699 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | nSirStatus ); |
| 1701 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1702 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1703 | return; |
| 1704 | } |
| 1705 | |
| 1706 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1708 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1709 | |
| 1710 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1711 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1712 | nPayload, &nPayload ); |
| 1713 | if ( DOT11F_FAILED( nStatus ) ) |
| 1714 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1715 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1716 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1717 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1718 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1719 | return; // allocated! |
| 1720 | } |
| 1721 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1722 | { |
| 1723 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1724 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1725 | } |
| 1726 | |
| 1727 | macAddr = pMacHdr->da; |
| 1728 | |
| 1729 | if (subType == LIM_ASSOC) |
| 1730 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1731 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1732 | FL("*** Sending Assoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1733 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1734 | } |
| 1735 | else{ |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1736 | limLog(pMac, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1738 | statusCode, aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1739 | } |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1740 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1741 | |
| 1742 | if ( addnIEPresent ) |
| 1743 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1744 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1745 | } |
| 1746 | |
| 1747 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1748 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1749 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1750 | ) |
| 1751 | { |
| 1752 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1753 | } |
| 1754 | |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 1755 | limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR |
| 1756 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 1757 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 1758 | |
| 1759 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 1760 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1761 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1762 | psessionEntry->peSessionId, |
| 1763 | pMacHdr->fc.subType)); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1764 | |
| 1765 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 1766 | { |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1767 | limLog(pMac, LOG1, FL("Re/AssocRsp - txBdToken %u"), |
| 1768 | pMac->lim.txBdToken); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1769 | /// Queue Association Response frame in high priority WQ |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1770 | if (tx_complete_context) |
| 1771 | { |
| 1772 | tx_complete_context->txBdToken = pMac->lim.txBdToken; |
| 1773 | halstatus = halTxFrameWithTxComplete(pMac, pPacket, |
| 1774 | (tANI_U16) nBytes, |
| 1775 | HAL_TXRX_FRM_802_11_MGMT, |
| 1776 | ANI_TXDIR_TODS, |
| 1777 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1778 | limTxComplete, pFrame, limAssocRspTxCompleteCnf, |
| 1779 | txFlag, pMac->lim.txBdToken); |
| 1780 | } |
| 1781 | else |
| 1782 | halstatus = halTxFrameWithTxComplete(pMac, pPacket, |
| 1783 | (tANI_U16) nBytes, |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1784 | HAL_TXRX_FRM_802_11_MGMT, |
| 1785 | ANI_TXDIR_TODS, |
| 1786 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1787 | limTxComplete, pFrame, limTxBdComplete, |
Kapil Gupta | 956c0c4 | 2017-06-16 19:24:31 +0530 | [diff] [blame] | 1788 | txFlag, pMac->lim.txBdToken); |
| 1789 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 1790 | pMac->lim.txBdToken++; |
| 1791 | } |
| 1792 | else |
| 1793 | { |
| 1794 | /// Queue Association Response frame in high priority WQ |
| 1795 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1796 | HAL_TXRX_FRM_802_11_MGMT, |
| 1797 | ANI_TXDIR_TODS, |
| 1798 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1799 | limTxComplete, pFrame, txFlag ); |
| 1800 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1801 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1802 | psessionEntry->peSessionId, |
| 1803 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1804 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1805 | { |
| 1806 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1807 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1808 | nSirStatus); |
| 1809 | |
| 1810 | //Pkt will be freed up by the callback |
| 1811 | } |
| 1812 | |
| 1813 | // update the ANI peer station count |
| 1814 | //FIXME_PROTECTION : take care of different type of station |
| 1815 | // counter inside this function. |
| 1816 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1817 | |
| 1818 | } // End limSendAssocRspMgmtFrame. |
| 1819 | |
| 1820 | |
| 1821 | |
| 1822 | void |
| 1823 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1824 | tSirMacAddr peer, |
| 1825 | tANI_U16 nStatusCode, |
| 1826 | tSirAddtsReqInfo *pAddTS, |
| 1827 | tSirMacScheduleIE *pSchedule, |
| 1828 | tpPESession psessionEntry) |
| 1829 | { |
| 1830 | tANI_U8 *pFrame; |
| 1831 | tpSirMacMgmtHdr pMacHdr; |
| 1832 | tDot11fAddTSResponse AddTSRsp; |
| 1833 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1834 | tSirRetStatus nSirStatus; |
| 1835 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1836 | void *pPacket; |
| 1837 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1838 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1839 | |
| 1840 | if(NULL == psessionEntry) |
| 1841 | { |
| 1842 | return; |
| 1843 | } |
| 1844 | |
| 1845 | if ( ! pAddTS->wmeTspecPresent ) |
| 1846 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1847 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1848 | |
| 1849 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1850 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1851 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1852 | AddTSRsp.Status.status = nStatusCode; |
| 1853 | |
| 1854 | // The TsDelay information element is only filled in for a specific |
| 1855 | // status code: |
| 1856 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1857 | { |
| 1858 | if ( pAddTS->wsmTspecPresent ) |
| 1859 | { |
| 1860 | AddTSRsp.WMMTSDelay.version = 1; |
| 1861 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1862 | AddTSRsp.WMMTSDelay.present = 1; |
| 1863 | } |
| 1864 | else |
| 1865 | { |
| 1866 | AddTSRsp.TSDelay.delay = 10; |
| 1867 | AddTSRsp.TSDelay.present = 1; |
| 1868 | } |
| 1869 | } |
| 1870 | |
| 1871 | if ( pAddTS->wsmTspecPresent ) |
| 1872 | { |
| 1873 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1874 | } |
| 1875 | else |
| 1876 | { |
| 1877 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1878 | } |
| 1879 | |
| 1880 | if ( pAddTS->wsmTspecPresent ) |
| 1881 | { |
| 1882 | AddTSRsp.num_WMMTCLAS = 0; |
| 1883 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1884 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1885 | { |
| 1886 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1887 | &AddTSRsp.TCLAS[i] ); |
| 1888 | } |
| 1889 | } |
| 1890 | else |
| 1891 | { |
| 1892 | AddTSRsp.num_TCLAS = 0; |
| 1893 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1894 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1895 | { |
| 1896 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1897 | &AddTSRsp.WMMTCLAS[i] ); |
| 1898 | } |
| 1899 | } |
| 1900 | |
| 1901 | if ( pAddTS->tclasProcPresent ) |
| 1902 | { |
| 1903 | if ( pAddTS->wsmTspecPresent ) |
| 1904 | { |
| 1905 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1906 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1907 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1908 | } |
| 1909 | else |
| 1910 | { |
| 1911 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1912 | AddTSRsp.TCLASSPROC.present = 1; |
| 1913 | } |
| 1914 | } |
| 1915 | |
| 1916 | // schedule element is included only if requested in the tspec and we are |
| 1917 | // using hcca (or both edca and hcca) |
| 1918 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1919 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1920 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1921 | // sta figure it out |
| 1922 | if ((pSchedule != NULL) && |
| 1923 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1924 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1925 | { |
| 1926 | if ( pAddTS->wsmTspecPresent ) |
| 1927 | { |
| 1928 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1929 | } |
| 1930 | else |
| 1931 | { |
| 1932 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1933 | } |
| 1934 | } |
| 1935 | |
| 1936 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1937 | if ( DOT11F_FAILED( nStatus ) ) |
| 1938 | { |
| 1939 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1940 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1941 | nStatus ); |
| 1942 | // We'll fall back on the worst case scenario: |
| 1943 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1944 | } |
| 1945 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1946 | { |
| 1947 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1948 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1949 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1950 | } |
| 1951 | } |
| 1952 | else |
| 1953 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1954 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | |
| 1956 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1957 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1958 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1959 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1960 | |
| 1961 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1962 | |
| 1963 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1964 | if ( DOT11F_FAILED( nStatus ) ) |
| 1965 | { |
| 1966 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1967 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1968 | nStatus ); |
| 1969 | // We'll fall back on the worst case scenario: |
| 1970 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1971 | } |
| 1972 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1973 | { |
| 1974 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1975 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1976 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1977 | } |
| 1978 | } |
| 1979 | |
| 1980 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1981 | |
| 1982 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1983 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1984 | { |
| 1985 | 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] | 1986 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1987 | return; |
| 1988 | } |
| 1989 | |
| 1990 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1991 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1992 | |
| 1993 | // Next, we fill out the buffer descriptor: |
| 1994 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1995 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1996 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1997 | { |
| 1998 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1999 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2000 | nSirStatus ); |
| 2001 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2002 | return; // allocated! |
| 2003 | } |
| 2004 | |
| 2005 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2006 | |
| 2007 | |
| 2008 | #if 0 |
| 2009 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2010 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2011 | { |
| 2012 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2013 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2014 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2015 | return; // allocated! |
| 2016 | } |
| 2017 | #endif //TO SUPPORT BT-AMP |
| 2018 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 2019 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2020 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2021 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2022 | #endif |
| 2023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2024 | // That done, pack the struct: |
| 2025 | if ( ! pAddTS->wmeTspecPresent ) |
| 2026 | { |
| 2027 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 2028 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2029 | nPayload, &nPayload ); |
| 2030 | if ( DOT11F_FAILED( nStatus ) ) |
| 2031 | { |
| 2032 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2033 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2034 | nStatus ); |
| 2035 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2036 | return; |
| 2037 | } |
| 2038 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2039 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2040 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2041 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2042 | } |
| 2043 | } |
| 2044 | else |
| 2045 | { |
| 2046 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 2047 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2048 | nPayload, &nPayload ); |
| 2049 | if ( DOT11F_FAILED( nStatus ) ) |
| 2050 | { |
| 2051 | 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] | 2052 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | nStatus ); |
| 2054 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2055 | return; |
| 2056 | } |
| 2057 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2058 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2059 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2060 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2061 | } |
| 2062 | } |
| 2063 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2064 | limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2065 | nStatusCode ); |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2066 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2067 | |
| 2068 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2069 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2070 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2071 | ) |
| 2072 | { |
| 2073 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2074 | } |
| 2075 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2076 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2077 | psessionEntry->peSessionId, |
| 2078 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2079 | // Queue the frame in high priority WQ: |
| 2080 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2081 | HAL_TXRX_FRM_802_11_MGMT, |
| 2082 | ANI_TXDIR_TODS, |
| 2083 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2084 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2085 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2086 | psessionEntry->peSessionId, |
| 2087 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2088 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2089 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2090 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2091 | nSirStatus ); |
| 2092 | //Pkt will be freed up by the callback |
| 2093 | } |
| 2094 | |
| 2095 | } // End limSendAddtsRspActionFrame. |
| 2096 | |
| 2097 | void |
| 2098 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 2099 | tSirMacAddr peer, |
| 2100 | tANI_U8 wmmTspecPresent, |
| 2101 | tSirMacTSInfo *pTsinfo, |
| 2102 | tSirMacTspecIE *pTspecIe, |
| 2103 | tpPESession psessionEntry) |
| 2104 | { |
| 2105 | tANI_U8 *pFrame; |
| 2106 | tpSirMacMgmtHdr pMacHdr; |
| 2107 | tDot11fDelTS DelTS; |
| 2108 | tDot11fWMMDelTS WMMDelTS; |
| 2109 | tSirRetStatus nSirStatus; |
| 2110 | tANI_U32 nBytes, nPayload, nStatus; |
| 2111 | void *pPacket; |
| 2112 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2113 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2114 | |
| 2115 | if(NULL == psessionEntry) |
| 2116 | { |
| 2117 | return; |
| 2118 | } |
| 2119 | |
| 2120 | if ( ! wmmTspecPresent ) |
| 2121 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2122 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2123 | |
| 2124 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 2125 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2126 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 2127 | |
| 2128 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 2129 | if ( DOT11F_FAILED( nStatus ) ) |
| 2130 | { |
| 2131 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2132 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2133 | nStatus ); |
| 2134 | // We'll fall back on the worst case scenario: |
| 2135 | nPayload = sizeof( tDot11fDelTS ); |
| 2136 | } |
| 2137 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2138 | { |
| 2139 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2140 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2141 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2142 | } |
| 2143 | } |
| 2144 | else |
| 2145 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2146 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2147 | |
| 2148 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 2149 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 2150 | WMMDelTS.DialogToken.token = 0; |
| 2151 | WMMDelTS.StatusCode.statusCode = 0; |
| 2152 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 2153 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 2154 | if ( DOT11F_FAILED( nStatus ) ) |
| 2155 | { |
| 2156 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2157 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2158 | nStatus ); |
| 2159 | // We'll fall back on the worst case scenario: |
| 2160 | nPayload = sizeof( tDot11fDelTS ); |
| 2161 | } |
| 2162 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2163 | { |
| 2164 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 2165 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2166 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | } |
| 2168 | } |
| 2169 | |
| 2170 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 2171 | |
| 2172 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 2173 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2174 | { |
| 2175 | 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] | 2176 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2177 | return; |
| 2178 | } |
| 2179 | |
| 2180 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2181 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2182 | |
| 2183 | // Next, we fill out the buffer descriptor: |
| 2184 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2185 | SIR_MAC_MGMT_ACTION, peer, |
| 2186 | psessionEntry->selfMacAddr); |
| 2187 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2188 | { |
| 2189 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2190 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2191 | nSirStatus ); |
| 2192 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2193 | return; // allocated! |
| 2194 | } |
| 2195 | |
| 2196 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2197 | |
| 2198 | #if 0 |
| 2199 | |
| 2200 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 2201 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 2202 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 2203 | { |
| 2204 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2205 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2206 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2207 | return; // allocated! |
| 2208 | } |
| 2209 | #endif //TO SUPPORT BT-AMP |
| 2210 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 2211 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2212 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 2213 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2214 | #endif |
| 2215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2216 | // That done, pack the struct: |
| 2217 | if ( !wmmTspecPresent ) |
| 2218 | { |
| 2219 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 2220 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2221 | nPayload, &nPayload ); |
| 2222 | if ( DOT11F_FAILED( nStatus ) ) |
| 2223 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2224 | 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] | 2225 | nStatus ); |
| 2226 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2227 | return; // allocated! |
| 2228 | } |
| 2229 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2230 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2231 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2232 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2233 | } |
| 2234 | } |
| 2235 | else |
| 2236 | { |
| 2237 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 2238 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 2239 | nPayload, &nPayload ); |
| 2240 | if ( DOT11F_FAILED( nStatus ) ) |
| 2241 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2242 | 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] | 2243 | nStatus ); |
| 2244 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2245 | return; // allocated! |
| 2246 | } |
| 2247 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2248 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2249 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 2250 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | } |
| 2252 | } |
| 2253 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2254 | limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 2255 | limPrintMacAddr(pMac, pMacHdr->da, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2256 | |
| 2257 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2258 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2259 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2260 | ) |
| 2261 | { |
| 2262 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2263 | } |
| 2264 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2265 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2266 | psessionEntry->peSessionId, |
| 2267 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2269 | HAL_TXRX_FRM_802_11_MGMT, |
| 2270 | ANI_TXDIR_TODS, |
| 2271 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2272 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2273 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2274 | psessionEntry->peSessionId, |
| 2275 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2277 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2278 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2279 | nSirStatus ); |
| 2280 | //Pkt will be freed up by the callback |
| 2281 | } |
| 2282 | |
| 2283 | } // End limSendDeltsReqActionFrame. |
| 2284 | |
| 2285 | void |
| 2286 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2287 | tLimMlmAssocReq *pMlmAssocReq, |
| 2288 | tpPESession psessionEntry) |
| 2289 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2290 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | tANI_U16 caps; |
| 2292 | tANI_U8 *pFrame; |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2293 | tSirRetStatus nSirStatus = eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2294 | tLimMlmAssocCnf mlmAssocCnf; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2295 | tANI_U32 nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2296 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2297 | void *pPacket; |
| 2298 | eHalStatus halstatus; |
| 2299 | tANI_U16 nAddIELen; |
| 2300 | tANI_U8 *pAddIE; |
| 2301 | tANI_U8 *wpsIe = NULL; |
| 2302 | #if defined WLAN_FEATURE_VOWIFI |
| 2303 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2304 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2305 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2306 | tpSirMacMgmtHdr pMacHdr; |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2307 | tDot11fIEExtCap extractedExtCap; |
| 2308 | tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE; |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2309 | tANI_U32 nBytes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2310 | |
| 2311 | if(NULL == psessionEntry) |
| 2312 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2313 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2314 | return; |
| 2315 | } |
| 2316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2317 | /* check this early to avoid unncessary operation */ |
| 2318 | if(NULL == psessionEntry->pLimJoinReq) |
| 2319 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2320 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2321 | return; |
| 2322 | } |
| 2323 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2324 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2325 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2326 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2327 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2328 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2329 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2330 | return; |
| 2331 | } |
| 2332 | |
| 2333 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2334 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2335 | |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2336 | vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0); |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 2337 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2338 | { |
| 2339 | nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE, |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2340 | &nAddIELen, |
| 2341 | &extractedExtCap ); |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2342 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2343 | if(eSIR_SUCCESS != nSirStatus ) |
| 2344 | { |
| 2345 | extractedExtCapFlag = eANI_BOOLEAN_FALSE; |
| 2346 | limLog(pMac, LOG1, |
| 2347 | FL("Unable to Stripoff ExtCap IE from Assoc Req")); |
| 2348 | } |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2349 | /* TODO:remove this code once driver provides the call back function |
| 2350 | * to supplicant for set_qos_map |
| 2351 | */ |
| 2352 | else |
| 2353 | { |
Hu Wang | c12631c | 2016-08-11 09:57:03 +0800 | [diff] [blame] | 2354 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *)extractedExtCap.bytes; |
| 2355 | if (p_ext_cap->interworkingService) { |
| 2356 | p_ext_cap->qosMap = 1; |
| 2357 | } |
| 2358 | extractedExtCap.num_bytes = lim_compute_ext_cap_ie_length(&extractedExtCap); |
| 2359 | extractedExtCapFlag = (extractedExtCap.num_bytes > 0); |
Leela Venkata Kiran Kumar Reddy Chirala | 2f9b571 | 2014-05-06 00:09:42 -0700 | [diff] [blame] | 2360 | } |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 2361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | caps = pMlmAssocReq->capabilityInfo; |
| 2363 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2364 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2365 | #if defined(FEATURE_WLAN_WAPI) |
| 2366 | /* CR: 262463 : |
| 2367 | According to WAPI standard: |
| 2368 | 7.3.1.4 Capability Information field |
| 2369 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2370 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2371 | Reassociation management frames. */ |
| 2372 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2373 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2374 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2375 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2376 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2377 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2378 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2379 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2380 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | |
| 2382 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2383 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2384 | |
| 2385 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2386 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2387 | |
| 2388 | // We prefer .11e asociations: |
| 2389 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2390 | |
| 2391 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2392 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2393 | |
| 2394 | if ( psessionEntry->lim11hEnable && |
| 2395 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2396 | { |
| 2397 | #if defined WLAN_FEATURE_VOWIFI |
| 2398 | PowerCapsPopulated = TRUE; |
| 2399 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2400 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2401 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2402 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2403 | |
| 2404 | } |
| 2405 | |
| 2406 | #if defined WLAN_FEATURE_VOWIFI |
| 2407 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2408 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2409 | { |
| 2410 | if (PowerCapsPopulated == FALSE) |
| 2411 | { |
| 2412 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2413 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2414 | } |
| 2415 | } |
| 2416 | #endif |
| 2417 | |
| 2418 | if ( fQosEnabled && |
| 2419 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2420 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | |
| 2422 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2423 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2424 | |
| 2425 | #if defined WLAN_FEATURE_VOWIFI |
| 2426 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2427 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2428 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2429 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2430 | } |
| 2431 | #endif |
| 2432 | // The join request *should* contain zero or one of the WPA and RSN |
| 2433 | // IEs. The payload send along with the request is a |
| 2434 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2435 | |
| 2436 | // typedef struct sSirRSNie |
| 2437 | // { |
| 2438 | // tANI_U16 length; |
| 2439 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2440 | // } tSirRSNie, *tpSirRSNie; |
| 2441 | |
| 2442 | // So, we should be able to make the following two calls harmlessly, |
| 2443 | // since they do nothing if they don't find the given IE in the |
| 2444 | // bytestream with which they're provided. |
| 2445 | |
| 2446 | // The net effect of this will be to faithfully transmit whatever |
| 2447 | // security IE is in the join request. |
| 2448 | |
| 2449 | // *However*, if we're associating for the purpose of WPS |
| 2450 | // enrollment, and we've been configured to indicate that by |
| 2451 | // eliding the WPA or RSN IE, we just skip this: |
| 2452 | if( nAddIELen && pAddIE ) |
| 2453 | { |
| 2454 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2455 | } |
| 2456 | if ( NULL == wpsIe ) |
| 2457 | { |
| 2458 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2459 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2460 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2461 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2462 | #if defined(FEATURE_WLAN_WAPI) |
| 2463 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2464 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2466 | } |
| 2467 | |
| 2468 | // include WME EDCA IE as well |
| 2469 | if ( fWmeEnabled ) |
| 2470 | { |
| 2471 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2472 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2473 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2474 | } |
| 2475 | |
| 2476 | if ( fWsmEnabled && |
| 2477 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2478 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2479 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2480 | } |
| 2481 | } |
| 2482 | |
| 2483 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2484 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2485 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | pMac->lim.htCapabilityPresentInBeacon) |
| 2487 | { |
Krishna Kumaar Natarajan | 025a860 | 2015-08-04 16:31:36 +0530 | [diff] [blame] | 2488 | limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2489 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2490 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2491 | |
| 2492 | /* |
| 2493 | * To resolve the interop problem with Broadcom AP, |
| 2494 | * where TQ STA could not pass traffic with GF enabled, |
| 2495 | * TQ STA will do Greenfield only with TQ AP, for |
| 2496 | * everybody else it will be turned off. |
| 2497 | */ |
| 2498 | |
| 2499 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2500 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2501 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2502 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2503 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2504 | } |
| 2505 | #endif |
| 2506 | |
| 2507 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 2508 | |
| 2509 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 2510 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 2511 | pFrm->HTCaps.supportedChannelWidthSet, pFrm->HTCaps.mimoPowerSave, |
| 2512 | pFrm->HTCaps.greenField, pFrm->HTCaps.shortGI20MHz, pFrm->HTCaps.shortGI40MHz, |
| 2513 | pFrm->HTCaps.dsssCckMode40MHz, pFrm->HTCaps.maxRxAMPDUFactor); |
| 2514 | |
| 2515 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2516 | #ifdef WLAN_FEATURE_11AC |
| 2517 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2518 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2519 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2520 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 2521 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, |
| 2522 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 2523 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2524 | } |
| 2525 | #endif |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 2526 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 2527 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2528 | |
| 2529 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2530 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2531 | { |
| 2532 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2533 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2534 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2535 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2536 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2537 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2538 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2539 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2540 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2541 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2542 | { |
| 2543 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2544 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2545 | } |
| 2546 | #endif |
| 2547 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2548 | #ifdef FEATURE_WLAN_ESE |
| 2549 | /* For ESE Associations fill the ESE IEs */ |
| 2550 | if (psessionEntry->isESEconnection && |
| 2551 | psessionEntry->pLimJoinReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2553 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2554 | PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2555 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2556 | PopulateDot11fESEVersion(&pFrm->ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2557 | } |
| 2558 | #endif |
| 2559 | |
c_hpothu | bcd7865 | 2014-04-28 22:31:08 +0530 | [diff] [blame] | 2560 | /* merge the ExtCap struct*/ |
| 2561 | if (extractedExtCapFlag && extractedExtCap.present) |
| 2562 | { |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 2563 | limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap, true); |
| 2564 | } |
| 2565 | |
| 2566 | if (pFrm->ExtCap.present && psessionEntry->ExtCap.present) { |
| 2567 | limMergeExtCapIEStruct(&pFrm->ExtCap, &psessionEntry->ExtCap, false); |
| 2568 | limLog(pMac, LOG1, |
| 2569 | 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] | 2570 | } |
| 2571 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2572 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | if ( DOT11F_FAILED( nStatus ) ) |
| 2574 | { |
| 2575 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2576 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2577 | nStatus ); |
| 2578 | // We'll fall back on the worst case scenario: |
| 2579 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2580 | } |
| 2581 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2582 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2583 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2584 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2585 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2586 | } |
| 2587 | |
| 2588 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2589 | |
| 2590 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2591 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2592 | ( void** ) &pPacket ); |
| 2593 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2594 | { |
| 2595 | 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] | 2596 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2597 | |
| 2598 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2599 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2600 | |
| 2601 | |
| 2602 | /* Update PE session id*/ |
| 2603 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2604 | |
| 2605 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2606 | |
| 2607 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2608 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2609 | |
| 2610 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2611 | ( tANI_U32* ) &mlmAssocCnf); |
| 2612 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2613 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2614 | return; |
| 2615 | } |
| 2616 | |
| 2617 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2618 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2619 | |
| 2620 | // Next, we fill out the buffer descriptor: |
| 2621 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2622 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2623 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2624 | { |
| 2625 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2626 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2627 | nSirStatus ); |
| 2628 | 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] | 2629 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2630 | return; |
| 2631 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2632 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2633 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2634 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2635 | sizeof(tSirMacMgmtHdr), |
| 2636 | nPayload, &nPayload ); |
| 2637 | if ( DOT11F_FAILED( nStatus ) ) |
| 2638 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2639 | 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] | 2640 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2641 | nStatus ); |
| 2642 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2643 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2644 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2645 | return; |
| 2646 | } |
| 2647 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2648 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2649 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2650 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2651 | } |
| 2652 | |
| 2653 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2654 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | nBytes );) |
| 2656 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2657 | |
| 2658 | if( psessionEntry->assocReq != NULL ) |
| 2659 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2660 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2661 | psessionEntry->assocReq = NULL; |
| 2662 | } |
| 2663 | |
| 2664 | if( nAddIELen ) |
| 2665 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2666 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2667 | pAddIE, |
| 2668 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2669 | nPayload += nAddIELen; |
| 2670 | } |
| 2671 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2672 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2673 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2674 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2675 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2676 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2677 | } |
| 2678 | else |
| 2679 | { |
| 2680 | //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] | 2681 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2682 | psessionEntry->assocReqLen = nPayload; |
| 2683 | } |
| 2684 | |
| 2685 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2686 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2687 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2688 | ) |
| 2689 | { |
| 2690 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2691 | } |
| 2692 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 2693 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 2694 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2695 | { |
| 2696 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2697 | } |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 2698 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 2699 | limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_START_EVENT, psessionEntry, |
| 2700 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 2701 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2702 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 2703 | limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR |
| 2704 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 2705 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2706 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 2707 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2708 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2709 | psessionEntry->peSessionId, |
| 2710 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 2711 | |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 2712 | if( ( psessionEntry->is11Gonly == true ) && |
| 2713 | ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){ |
| 2714 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2715 | } |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 2716 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 2717 | { |
| 2718 | limLog(pMac, LOG1, FL("Assoc Req - txBdToken %u"), pMac->lim.txBdToken); |
| 2719 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 2720 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2721 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2722 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2723 | limTxComplete, pFrame, limTxBdComplete, txFlag, |
| 2724 | pMac->lim.txBdToken); |
| 2725 | pMac->lim.txBdToken++; |
| 2726 | } |
| 2727 | else |
| 2728 | { |
| 2729 | halstatus = halTxFrame( pMac, pPacket, |
| 2730 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2731 | HAL_TXRX_FRM_802_11_MGMT, |
| 2732 | ANI_TXDIR_TODS, |
| 2733 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2734 | limTxComplete, pFrame, txFlag ); |
| 2735 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2736 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2737 | psessionEntry->peSessionId, |
| 2738 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2739 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2740 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2741 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2742 | halstatus ); |
| 2743 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2744 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2745 | return; |
| 2746 | } |
| 2747 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 2748 | //Enable caching only if Assoc Request is successfully submitted to the h/w |
| 2749 | WLANTL_EnableCaching(psessionEntry->staId); |
| 2750 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2751 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2752 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2753 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2754 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2755 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2756 | } // End limSendAssocReqMgmtFrame |
| 2757 | |
| 2758 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2759 | #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] | 2760 | /*------------------------------------------------------------------------------------ |
| 2761 | * |
| 2762 | * Send Reassoc Req with FTIEs. |
| 2763 | * |
| 2764 | *----------------------------------------------------------------------------------- |
| 2765 | */ |
| 2766 | void |
| 2767 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2768 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2769 | { |
| 2770 | static tDot11fReAssocRequest frm; |
| 2771 | tANI_U16 caps; |
| 2772 | tANI_U8 *pFrame; |
| 2773 | tSirRetStatus nSirStatus; |
| 2774 | tANI_U32 nBytes, nPayload, nStatus; |
| 2775 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2776 | void *pPacket; |
| 2777 | eHalStatus halstatus; |
| 2778 | #if defined WLAN_FEATURE_VOWIFI |
| 2779 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2780 | #endif |
| 2781 | tANI_U16 ft_ies_length = 0; |
| 2782 | tANI_U8 *pBody; |
| 2783 | tANI_U16 nAddIELen; |
| 2784 | tANI_U8 *pAddIE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2785 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2786 | tANI_U8 *wpsIe = NULL; |
| 2787 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2788 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2789 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2790 | |
| 2791 | if (NULL == psessionEntry) |
| 2792 | { |
| 2793 | return; |
| 2794 | } |
| 2795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | /* check this early to avoid unncessary operation */ |
| 2797 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2798 | { |
| 2799 | return; |
| 2800 | } |
| 2801 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2802 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2803 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2804 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2805 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2806 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2807 | |
| 2808 | caps = pMlmReassocReq->capabilityInfo; |
| 2809 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2810 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2811 | #if defined(FEATURE_WLAN_WAPI) |
| 2812 | /* CR: 262463 : |
| 2813 | According to WAPI standard: |
| 2814 | 7.3.1.4 Capability Information field |
| 2815 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2816 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2817 | Reassociation management frames. */ |
| 2818 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2819 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2820 | #endif |
| 2821 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2822 | |
| 2823 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2824 | |
| 2825 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2826 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2827 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2828 | |
| 2829 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2830 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2831 | &frm.SuppRates,psessionEntry); |
| 2832 | |
| 2833 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2834 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2835 | |
| 2836 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2837 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2838 | |
| 2839 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2840 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2841 | |
| 2842 | if ( psessionEntry->lim11hEnable && |
| 2843 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2844 | { |
| 2845 | #if defined WLAN_FEATURE_VOWIFI |
| 2846 | PowerCapsPopulated = TRUE; |
| 2847 | |
| 2848 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2849 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2850 | #endif |
| 2851 | } |
| 2852 | |
| 2853 | #if defined WLAN_FEATURE_VOWIFI |
| 2854 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2855 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2856 | { |
| 2857 | if (PowerCapsPopulated == FALSE) |
| 2858 | { |
| 2859 | PowerCapsPopulated = TRUE; |
| 2860 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2861 | } |
| 2862 | } |
| 2863 | #endif |
| 2864 | |
| 2865 | if ( fQosEnabled && |
| 2866 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2867 | { |
| 2868 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2869 | } |
| 2870 | |
| 2871 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2872 | &frm.ExtSuppRates, psessionEntry ); |
| 2873 | |
| 2874 | #if defined WLAN_FEATURE_VOWIFI |
| 2875 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2876 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2877 | { |
| 2878 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2879 | } |
| 2880 | #endif |
| 2881 | |
| 2882 | // Ideally this should be enabled for 11r also. But 11r does |
| 2883 | // not follow the usual norm of using the Opaque object |
| 2884 | // for rsnie and fties. Instead we just add |
| 2885 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2886 | // This should ideally! be fixed. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2887 | #if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2888 | // |
| 2889 | // The join request *should* contain zero or one of the WPA and RSN |
| 2890 | // IEs. The payload send along with the request is a |
| 2891 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2892 | |
| 2893 | // typedef struct sSirRSNie |
| 2894 | // { |
| 2895 | // tANI_U16 length; |
| 2896 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2897 | // } tSirRSNie, *tpSirRSNie; |
| 2898 | |
| 2899 | // So, we should be able to make the following two calls harmlessly, |
| 2900 | // since they do nothing if they don't find the given IE in the |
| 2901 | // bytestream with which they're provided. |
| 2902 | |
| 2903 | // The net effect of this will be to faithfully transmit whatever |
| 2904 | // security IE is in the join request. |
| 2905 | |
| 2906 | // *However*, if we're associating for the purpose of WPS |
| 2907 | // enrollment, and we've been configured to indicate that by |
| 2908 | // eliding the WPA or RSN IE, we just skip this: |
| 2909 | if (!psessionEntry->is11Rconnection) |
| 2910 | { |
| 2911 | if( nAddIELen && pAddIE ) |
| 2912 | { |
| 2913 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2914 | } |
| 2915 | if ( NULL == wpsIe ) |
| 2916 | { |
| 2917 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2918 | &frm.RSNOpaque ); |
| 2919 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2920 | &frm.WPAOpaque ); |
| 2921 | } |
| 2922 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2923 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2924 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2925 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2926 | PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2927 | &frm.ESECckmOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2928 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2929 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2930 | } |
| 2931 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2932 | #ifdef FEATURE_WLAN_ESE |
| 2933 | // For ESE Associations fill the ESE IEs |
| 2934 | if (psessionEntry->isESEconnection && |
| 2935 | psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2936 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2937 | #ifndef FEATURE_DISABLE_RM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2938 | PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2939 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2940 | PopulateDot11fESEVersion(&frm.ESEVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2941 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2942 | #endif //FEATURE_WLAN_ESE |
| 2943 | #endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2944 | |
| 2945 | // include WME EDCA IE as well |
| 2946 | if ( fWmeEnabled ) |
| 2947 | { |
| 2948 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2949 | { |
| 2950 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2951 | } |
| 2952 | |
| 2953 | if ( fWsmEnabled && |
| 2954 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2955 | { |
| 2956 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2957 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2958 | #ifdef FEATURE_WLAN_ESE |
| 2959 | if (psessionEntry->isESEconnection) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2960 | { |
| 2961 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2962 | |
| 2963 | // 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] | 2964 | if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2965 | { |
| 2966 | tANI_U32 phyMode; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2967 | tSirMacESETSRSIE tsrsIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2968 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2969 | |
| 2970 | tsrsIE.tsid = 0; |
| 2971 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2972 | { |
| 2973 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2974 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2975 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2976 | { |
| 2977 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2978 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2979 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | } |
| 2981 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2982 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | } |
| 2984 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2985 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2986 | pMac->lim.htCapabilityPresentInBeacon) |
| 2987 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2988 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2989 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 2990 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 2991 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 2992 | frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave, |
| 2993 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz, |
| 2994 | frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor); |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2995 | #if defined WLAN_FEATURE_VOWIFI_11R |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 2996 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && |
| 2997 | (pMac->ft.ftSmeContext.addMDIE == TRUE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2998 | #if defined FEATURE_WLAN_ESE |
| 2999 | && !psessionEntry->isESEconnection |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 3000 | #endif |
| 3001 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3002 | { |
| 3003 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 3004 | } |
| 3005 | #endif |
| 3006 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3007 | #ifdef WLAN_FEATURE_11AC |
| 3008 | if ( psessionEntry->vhtCapability && |
| 3009 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 3010 | { |
| 3011 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 3012 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 3013 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Abhishek Singh | e038dc6 | 2015-05-22 11:36:45 +0530 | [diff] [blame] | 3014 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3015 | } |
| 3016 | #endif |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 3017 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 3018 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3019 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3020 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3021 | if ( DOT11F_FAILED( nStatus ) ) |
| 3022 | { |
| 3023 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3024 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3025 | nStatus ); |
| 3026 | // We'll fall back on the worst case scenario: |
| 3027 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3028 | } |
| 3029 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3030 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3031 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3032 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3033 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3034 | } |
| 3035 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3036 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3037 | |
| 3038 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 3039 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3040 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 3041 | #endif |
| 3042 | |
| 3043 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3044 | if (psessionEntry->is11Rconnection) |
| 3045 | { |
| 3046 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 3047 | } |
| 3048 | #endif |
| 3049 | |
| 3050 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3051 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 3052 | ( void** ) &pPacket ); |
| 3053 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3054 | { |
| 3055 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3056 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3057 | 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] | 3058 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3059 | goto end; |
| 3060 | } |
| 3061 | |
| 3062 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3063 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3064 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3065 | #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] | 3066 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3067 | #endif |
| 3068 | // Next, we fill out the buffer descriptor: |
| 3069 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3070 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3071 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3072 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3073 | { |
| 3074 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3075 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3076 | nSirStatus ); |
| 3077 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3078 | goto end; |
| 3079 | } |
| 3080 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3081 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3082 | // That done, pack the ReAssoc Request: |
| 3083 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3084 | sizeof(tSirMacMgmtHdr), |
| 3085 | nPayload, &nPayload ); |
| 3086 | if ( DOT11F_FAILED( nStatus ) ) |
| 3087 | { |
| 3088 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3089 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3090 | nStatus ); |
| 3091 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3092 | goto end; |
| 3093 | } |
| 3094 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3095 | { |
| 3096 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3097 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3098 | } |
| 3099 | |
| 3100 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3101 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | nBytes, nPayload );) |
| 3103 | if( psessionEntry->assocReq != NULL ) |
| 3104 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3105 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3106 | psessionEntry->assocReq = NULL; |
| 3107 | } |
| 3108 | |
| 3109 | if( nAddIELen ) |
| 3110 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3111 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3112 | pAddIE, |
| 3113 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3114 | nPayload += nAddIELen; |
| 3115 | } |
| 3116 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3117 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3118 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3119 | { |
| 3120 | 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] | 3121 | } |
| 3122 | else |
| 3123 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | //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] | 3125 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3127 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3128 | |
| 3129 | if (psessionEntry->is11Rconnection) |
| 3130 | { |
| 3131 | { |
| 3132 | int i = 0; |
| 3133 | |
| 3134 | pBody = pFrame + nBytes; |
| 3135 | for (i=0; i<ft_ies_length; i++) |
| 3136 | { |
| 3137 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 3138 | pBody++; |
| 3139 | } |
| 3140 | } |
| 3141 | } |
| 3142 | |
| 3143 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3144 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 3145 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3146 | (tANI_U8 *)pFrame, |
| 3147 | (nBytes + ft_ies_length));) |
| 3148 | #endif |
| 3149 | |
| 3150 | |
| 3151 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3152 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3153 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3154 | ) |
| 3155 | { |
| 3156 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3157 | } |
| 3158 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3159 | if( NULL != psessionEntry->assocReq ) |
| 3160 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3161 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3162 | psessionEntry->assocReq = NULL; |
| 3163 | } |
Agrawal Ashish | ad64dc2 | 2016-02-04 11:32:15 +0530 | [diff] [blame] | 3164 | if (ft_ies_length) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3165 | { |
Agrawal Ashish | ad64dc2 | 2016-02-04 11:32:15 +0530 | [diff] [blame] | 3166 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 3167 | if (NULL == psessionEntry->assocReq) |
| 3168 | { |
| 3169 | limLog(pMac, LOGE, |
| 3170 | FL("Unable to allocate memory for FT IEs")); |
| 3171 | psessionEntry->assocReqLen = 0; |
| 3172 | } |
| 3173 | else |
| 3174 | { |
| 3175 | /* Store the FT IEs. This is sent to csr/hdd in join cnf response.*/ |
| 3176 | vos_mem_copy(psessionEntry->assocReq, |
| 3177 | pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 3178 | (ft_ies_length)); |
| 3179 | psessionEntry->assocReqLen = ft_ies_length; |
| 3180 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3181 | } |
| 3182 | else |
| 3183 | { |
Agrawal Ashish | ad64dc2 | 2016-02-04 11:32:15 +0530 | [diff] [blame] | 3184 | limLog(pMac, LOG1, FL("FT IEs not present")); |
| 3185 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 3186 | } |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 3187 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 3188 | limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry, |
| 3189 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 3190 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3191 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3192 | psessionEntry->peSessionId, |
| 3193 | pMacHdr->fc.subType)); |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3194 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3195 | { |
| 3196 | limLog( pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken); |
| 3197 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3198 | ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3199 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3200 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3201 | limTxComplete, pFrame, limTxBdComplete, txFlag, |
| 3202 | pMac->lim.txBdToken); |
| 3203 | pMac->lim.txBdToken++; |
| 3204 | } |
| 3205 | else |
| 3206 | { |
| 3207 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 3208 | HAL_TXRX_FRM_802_11_MGMT, |
| 3209 | ANI_TXDIR_TODS, |
| 3210 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3211 | limTxComplete, pFrame, txFlag ); |
| 3212 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3213 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3214 | psessionEntry->peSessionId, |
| 3215 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3216 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3217 | { |
| 3218 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3219 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3220 | nSirStatus ); |
| 3221 | //Pkt will be freed up by the callback |
| 3222 | goto end; |
| 3223 | } |
| 3224 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 3225 | // Enable TL cahching in case of roaming |
| 3226 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3228 | end: |
| 3229 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3230 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3232 | |
| 3233 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3234 | |
| 3235 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 3236 | tLimMlmReassocReq *pMlmReassocReq, |
| 3237 | tpPESession psessionEntry) |
| 3238 | { |
| 3239 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 3240 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
Sachin Ahuja | 07a4301 | 2015-01-30 17:04:38 +0530 | [diff] [blame] | 3241 | #ifdef FEATURE_WLAN_ESE |
| 3242 | tANI_U32 val=0; |
| 3243 | #endif |
| 3244 | if (pMlmReassocReq == NULL) |
| 3245 | { |
| 3246 | limLog(pMac, LOGE, |
| 3247 | FL("Invalid pMlmReassocReq")); |
| 3248 | goto end; |
| 3249 | } |
Hema Aparna Medicharla | 43d0f7b | 2015-02-12 17:07:59 +0530 | [diff] [blame] | 3250 | |
| 3251 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 3252 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 3253 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 3254 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3255 | |
| 3256 | // Prepare and send Reassociation request frame |
| 3257 | // start reassoc timer. |
Sachin Ahuja | 07a4301 | 2015-01-30 17:04:38 +0530 | [diff] [blame] | 3258 | #ifdef FEATURE_WLAN_ESE |
| 3259 | /* |
| 3260 | * In case of Ese Reassociation, change the reassoc timer |
| 3261 | * value. |
| 3262 | */ |
| 3263 | val = pMlmReassocReq->reassocFailureTimeout; |
| 3264 | if (psessionEntry->isESEconnection) |
| 3265 | { |
| 3266 | val = val/LIM_MAX_REASSOC_RETRY_LIMIT; |
| 3267 | } |
| 3268 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) != |
| 3269 | TX_SUCCESS) |
| 3270 | { |
| 3271 | limLog(pMac, LOGP, |
| 3272 | FL("unable to deactivate Reassoc failure timer")); |
| 3273 | } |
| 3274 | val = SYS_MS_TO_TICKS(val); |
| 3275 | if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer, |
| 3276 | val, 0) != TX_SUCCESS) |
| 3277 | { |
| 3278 | limLog(pMac, LOGP, |
| 3279 | FL("unable to change Reassociation failure timer")); |
| 3280 | } |
| 3281 | #endif |
| 3282 | |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3283 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 3284 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 3285 | 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] | 3286 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3287 | != TX_SUCCESS) |
| 3288 | { |
| 3289 | // Could not start reassoc failure timer. |
| 3290 | // Log error |
| 3291 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3292 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3293 | // Return Reassoc confirm with |
| 3294 | // Resources Unavailable |
| 3295 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3296 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3297 | goto end; |
| 3298 | } |
| 3299 | |
| 3300 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 3301 | return; |
| 3302 | |
| 3303 | end: |
| 3304 | // Free up buffer allocated for reassocReq |
| 3305 | if (pMlmReassocReq != NULL) |
| 3306 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3307 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3308 | pMlmReassocReq = NULL; |
| 3309 | } |
| 3310 | if (pTmpMlmReassocReq != NULL) |
| 3311 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3312 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 3313 | pTmpMlmReassocReq = NULL; |
| 3314 | } |
| 3315 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 3316 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3317 | /* Update PE sessio Id*/ |
| 3318 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3319 | |
| 3320 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3321 | } |
| 3322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3323 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3324 | |
| 3325 | |
| 3326 | void |
| 3327 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 3328 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 3329 | { |
| 3330 | static tDot11fReAssocRequest frm; |
| 3331 | tANI_U16 caps; |
| 3332 | tANI_U8 *pFrame; |
| 3333 | tSirRetStatus nSirStatus; |
| 3334 | tANI_U32 nBytes, nPayload, nStatus; |
| 3335 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 3336 | void *pPacket; |
| 3337 | eHalStatus halstatus; |
| 3338 | tANI_U16 nAddIELen; |
| 3339 | tANI_U8 *pAddIE; |
| 3340 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3341 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3342 | #if defined WLAN_FEATURE_VOWIFI |
| 3343 | tANI_U8 PowerCapsPopulated = FALSE; |
| 3344 | #endif |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3345 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3346 | |
| 3347 | if(NULL == psessionEntry) |
| 3348 | { |
| 3349 | return; |
| 3350 | } |
| 3351 | |
| 3352 | /* check this early to avoid unncessary operation */ |
| 3353 | if(NULL == psessionEntry->pLimReAssocReq) |
| 3354 | { |
| 3355 | return; |
| 3356 | } |
| 3357 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 3358 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 3359 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3360 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3361 | |
| 3362 | caps = pMlmReassocReq->capabilityInfo; |
| 3363 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 3364 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 3365 | #if defined(FEATURE_WLAN_WAPI) |
| 3366 | /* CR: 262463 : |
| 3367 | According to WAPI standard: |
| 3368 | 7.3.1.4 Capability Information field |
| 3369 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 3370 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 3371 | Reassociation management frames. */ |
| 3372 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 3373 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 3374 | #endif |
| 3375 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 3376 | |
| 3377 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 3378 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3379 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 3380 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3381 | |
| 3382 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 3383 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3384 | &frm.SuppRates,psessionEntry); |
| 3385 | |
| 3386 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 3387 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 3388 | |
| 3389 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 3390 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 3391 | |
| 3392 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 3393 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 3394 | |
| 3395 | |
| 3396 | if ( psessionEntry->lim11hEnable && |
| 3397 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 3398 | { |
| 3399 | #if defined WLAN_FEATURE_VOWIFI |
| 3400 | PowerCapsPopulated = TRUE; |
| 3401 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 3402 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 3403 | #endif |
| 3404 | } |
| 3405 | |
| 3406 | #if defined WLAN_FEATURE_VOWIFI |
| 3407 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3408 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 3409 | { |
| 3410 | if (PowerCapsPopulated == FALSE) |
| 3411 | { |
| 3412 | PowerCapsPopulated = TRUE; |
| 3413 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 3414 | } |
| 3415 | } |
| 3416 | #endif |
| 3417 | |
| 3418 | if ( fQosEnabled && |
| 3419 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 3420 | { |
| 3421 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 3422 | } |
| 3423 | |
| 3424 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3425 | &frm.ExtSuppRates, psessionEntry ); |
| 3426 | |
| 3427 | #if defined WLAN_FEATURE_VOWIFI |
| 3428 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 3429 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 3430 | { |
| 3431 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 3432 | } |
| 3433 | #endif |
| 3434 | // The join request *should* contain zero or one of the WPA and RSN |
| 3435 | // IEs. The payload send along with the request is a |
| 3436 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 3437 | |
| 3438 | // typedef struct sSirRSNie |
| 3439 | // { |
| 3440 | // tANI_U16 length; |
| 3441 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 3442 | // } tSirRSNie, *tpSirRSNie; |
| 3443 | |
| 3444 | // So, we should be able to make the following two calls harmlessly, |
| 3445 | // since they do nothing if they don't find the given IE in the |
| 3446 | // bytestream with which they're provided. |
| 3447 | |
| 3448 | // The net effect of this will be to faithfully transmit whatever |
| 3449 | // security IE is in the join request. |
| 3450 | |
| 3451 | // *However*, if we're associating for the purpose of WPS |
| 3452 | // enrollment, and we've been configured to indicate that by |
| 3453 | // eliding the WPA or RSN IE, we just skip this: |
| 3454 | if( nAddIELen && pAddIE ) |
| 3455 | { |
| 3456 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3457 | } |
| 3458 | if ( NULL == wpsIe ) |
| 3459 | { |
| 3460 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3461 | &frm.RSNOpaque ); |
| 3462 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3463 | &frm.WPAOpaque ); |
| 3464 | #if defined(FEATURE_WLAN_WAPI) |
| 3465 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3466 | &frm.WAPIOpaque ); |
| 3467 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3468 | } |
| 3469 | |
| 3470 | // include WME EDCA IE as well |
| 3471 | if ( fWmeEnabled ) |
| 3472 | { |
| 3473 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3474 | { |
| 3475 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3476 | } |
| 3477 | |
| 3478 | if ( fWsmEnabled && |
| 3479 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3480 | { |
| 3481 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3482 | } |
| 3483 | } |
| 3484 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3485 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3486 | pMac->lim.htCapabilityPresentInBeacon) |
| 3487 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3488 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3489 | } |
Agrawal Ashish | b10d039 | 2015-08-06 16:18:20 +0530 | [diff] [blame] | 3490 | limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d," |
| 3491 | "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), |
| 3492 | frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave, |
| 3493 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz, |
| 3494 | frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3495 | #ifdef WLAN_FEATURE_11AC |
| 3496 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3497 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3498 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3499 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 3500 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, |
| 3501 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Hu Wang | 5193b57 | 2016-08-11 10:04:47 +0800 | [diff] [blame] | 3502 | if (psessionEntry->ExtCap.present) |
Agrawal Ashish | 5ac89da | 2015-10-26 19:08:47 +0530 | [diff] [blame] | 3503 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3504 | } |
| 3505 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3506 | |
| 3507 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3508 | if ( DOT11F_FAILED( nStatus ) ) |
| 3509 | { |
| 3510 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3511 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3512 | nStatus ); |
| 3513 | // We'll fall back on the worst case scenario: |
| 3514 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3515 | } |
| 3516 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3517 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3518 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3519 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3520 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3521 | } |
| 3522 | |
| 3523 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3524 | |
| 3525 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3526 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3527 | ( void** ) &pPacket ); |
| 3528 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3529 | { |
| 3530 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3531 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3532 | 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] | 3533 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3534 | goto end; |
| 3535 | } |
| 3536 | |
| 3537 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3538 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3539 | |
| 3540 | // Next, we fill out the buffer descriptor: |
| 3541 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3542 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3543 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3544 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3545 | { |
| 3546 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3547 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3548 | nSirStatus ); |
| 3549 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3550 | goto end; |
| 3551 | } |
| 3552 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3553 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3554 | // That done, pack the Probe Request: |
| 3555 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3556 | sizeof(tSirMacMgmtHdr), |
| 3557 | nPayload, &nPayload ); |
| 3558 | if ( DOT11F_FAILED( nStatus ) ) |
| 3559 | { |
| 3560 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3561 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3562 | nStatus ); |
| 3563 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3564 | goto end; |
| 3565 | } |
| 3566 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3567 | { |
| 3568 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3569 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3570 | } |
| 3571 | |
| 3572 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3573 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3574 | nBytes );) |
| 3575 | |
| 3576 | if( psessionEntry->assocReq != NULL ) |
| 3577 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3578 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3579 | psessionEntry->assocReq = NULL; |
| 3580 | } |
| 3581 | |
| 3582 | if( nAddIELen ) |
| 3583 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3584 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3585 | pAddIE, |
| 3586 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3587 | nPayload += nAddIELen; |
| 3588 | } |
| 3589 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3590 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3591 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3592 | { |
| 3593 | 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] | 3594 | } |
| 3595 | else |
| 3596 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3597 | //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] | 3598 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3599 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3600 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3601 | |
| 3602 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3603 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3604 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3605 | ) |
| 3606 | { |
| 3607 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3608 | } |
| 3609 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 3610 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 3611 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3612 | { |
| 3613 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3614 | } |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 3615 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 3616 | limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry, |
| 3617 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 3618 | #endif |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3619 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3620 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3621 | psessionEntry->peSessionId, |
| 3622 | pMacHdr->fc.subType)); |
Katya Nigam | 6390293 | 2014-06-26 19:04:23 +0530 | [diff] [blame] | 3623 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3624 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3625 | { |
| 3626 | limLog(pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken); |
| 3627 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 3628 | ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3629 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3630 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3631 | limTxComplete, pFrame, limTxBdComplete, |
| 3632 | txFlag, pMac->lim.txBdToken ); |
| 3633 | pMac->lim.txBdToken++; |
| 3634 | } |
| 3635 | else |
| 3636 | { |
| 3637 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3638 | HAL_TXRX_FRM_802_11_MGMT, |
| 3639 | ANI_TXDIR_TODS, |
| 3640 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3641 | limTxComplete, pFrame, txFlag ); |
| 3642 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3643 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3644 | psessionEntry->peSessionId, |
| 3645 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3646 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3647 | { |
| 3648 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3649 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | nSirStatus ); |
| 3651 | //Pkt will be freed up by the callback |
| 3652 | goto end; |
| 3653 | } |
| 3654 | |
Katya Nigam | ccaeda7 | 2015-04-20 18:51:22 +0530 | [diff] [blame] | 3655 | // enable caching |
| 3656 | WLANTL_EnableCaching(psessionEntry->staId); |
| 3657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3658 | end: |
| 3659 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3660 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3661 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3662 | |
| 3663 | } // limSendReassocReqMgmtFrame |
| 3664 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3665 | eHalStatus limAuthTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3666 | { |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3667 | tANI_U32 txCompleteSuccess; |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3668 | tpSirTxBdStatus pTxBdStatus; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3669 | |
| 3670 | if (!pData) |
| 3671 | { |
| 3672 | limLog(pMac, LOG1, |
| 3673 | FL(" pData is NULL")); |
| 3674 | return eHAL_STATUS_FAILURE; |
| 3675 | } |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3676 | |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 3677 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 3678 | { |
| 3679 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 3680 | txCompleteSuccess = pTxBdStatus->txCompleteStatus; |
| 3681 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 3682 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 3683 | } |
| 3684 | else |
| 3685 | { |
| 3686 | txCompleteSuccess = *((tANI_U32*) pData); |
| 3687 | limLog(pMac, LOG1, |
| 3688 | FL("txCompleteSuccess= %d"), txCompleteSuccess); |
| 3689 | } |
| 3690 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3691 | if(txCompleteSuccess) |
| 3692 | { |
| 3693 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS; |
| 3694 | // 'Change' timer for future activations |
| 3695 | limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER); |
| 3696 | } |
| 3697 | else |
| 3698 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE; |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 3699 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
Deepthi Gowri | 639d504 | 2015-11-16 20:23:39 +0530 | [diff] [blame] | 3700 | limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_START_EVENT, NULL, |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 3701 | pMac->authAckStatus, eSIR_SUCCESS); |
| 3702 | #endif |
| 3703 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3704 | return eHAL_STATUS_SUCCESS; |
| 3705 | } |
| 3706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3707 | /** |
| 3708 | * \brief Send an Authentication frame |
| 3709 | * |
| 3710 | * |
| 3711 | * \param pMac Pointer to Global MAC structure |
| 3712 | * |
| 3713 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3714 | * to be sent |
| 3715 | * |
| 3716 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3717 | * frame is destined |
| 3718 | * |
| 3719 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3720 | * Authentication frame3 |
| 3721 | * |
| 3722 | * |
| 3723 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3724 | * is formatted and sent when this function is called. |
| 3725 | * |
| 3726 | * |
| 3727 | */ |
| 3728 | |
| 3729 | void |
| 3730 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3731 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3732 | tSirMacAddr peerMacAddr, |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame^] | 3733 | tANI_U8 wep_challenge_len, |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 3734 | tpPESession psessionEntry, |
| 3735 | tAniBool waitForAck |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3736 | ) |
| 3737 | { |
| 3738 | tANI_U8 *pFrame, *pBody; |
| 3739 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3740 | tpSirMacMgmtHdr pMacHdr; |
| 3741 | tANI_U16 i; |
| 3742 | void *pPacket; |
| 3743 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3744 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3745 | |
| 3746 | if(NULL == psessionEntry) |
| 3747 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3748 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3749 | return; |
| 3750 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3751 | |
| 3752 | limLog(pMac, LOG1, |
| 3753 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3754 | pAuthFrameBody->authTransactionSeqNumber, |
| 3755 | pAuthFrameBody->authStatusCode, |
| 3756 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3757 | MAC_ADDR_ARRAY(peerMacAddr)); |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame^] | 3758 | if (wep_challenge_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3759 | { |
| 3760 | /// Auth frame3 to be sent with encrypted framebody |
| 3761 | /** |
| 3762 | * Allocate buffer for Authenticaton frame of size equal |
| 3763 | * to management frame header length plus 2 bytes each for |
| 3764 | * auth algorithm number, transaction number, status code, |
| 3765 | * 128 bytes for challenge text and 4 bytes each for |
| 3766 | * IV & ICV. |
| 3767 | */ |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame^] | 3768 | bodyLen = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
| 3769 | frameLen = sizeof(tSirMacMgmtHdr) + bodyLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3770 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3771 | else |
| 3772 | { |
| 3773 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3774 | { |
| 3775 | case SIR_MAC_AUTH_FRAME_1: |
| 3776 | /** |
| 3777 | * Allocate buffer for Authenticaton frame of size |
| 3778 | * equal to management frame header length plus 2 bytes |
| 3779 | * each for auth algorithm number, transaction number |
| 3780 | * and status code. |
| 3781 | */ |
| 3782 | |
| 3783 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3784 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3785 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3786 | |
| 3787 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3788 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3789 | { |
| 3790 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3791 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3792 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3793 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3794 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3795 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3796 | else |
| 3797 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3798 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3799 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3800 | frameLen += (2+SIR_MDIE_SIZE); |
| 3801 | } |
| 3802 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3803 | #endif |
| 3804 | break; |
| 3805 | |
| 3806 | case SIR_MAC_AUTH_FRAME_2: |
| 3807 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3808 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3809 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3810 | { |
| 3811 | /** |
| 3812 | * Allocate buffer for Authenticaton frame of size |
| 3813 | * equal to management frame header length plus |
| 3814 | * 2 bytes each for auth algorithm number, |
| 3815 | * transaction number and status code. |
| 3816 | */ |
| 3817 | |
| 3818 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3819 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3820 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3821 | } |
| 3822 | else |
| 3823 | { |
| 3824 | // Shared Key algorithm with challenge text |
| 3825 | // to be sent |
| 3826 | /** |
| 3827 | * Allocate buffer for Authenticaton frame of size |
| 3828 | * equal to management frame header length plus |
| 3829 | * 2 bytes each for auth algorithm number, |
| 3830 | * transaction number, status code and 128 bytes |
| 3831 | * for challenge text. |
| 3832 | */ |
| 3833 | |
| 3834 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3835 | sizeof(tSirMacAuthFrame); |
| 3836 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3837 | } |
| 3838 | |
| 3839 | break; |
| 3840 | |
| 3841 | case SIR_MAC_AUTH_FRAME_3: |
| 3842 | /// Auth frame3 to be sent without encrypted framebody |
| 3843 | /** |
| 3844 | * Allocate buffer for Authenticaton frame of size equal |
| 3845 | * to management frame header length plus 2 bytes each |
| 3846 | * for auth algorithm number, transaction number and |
| 3847 | * status code. |
| 3848 | */ |
| 3849 | |
| 3850 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3851 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3852 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3853 | |
| 3854 | break; |
| 3855 | |
| 3856 | case SIR_MAC_AUTH_FRAME_4: |
| 3857 | /** |
| 3858 | * Allocate buffer for Authenticaton frame of size equal |
| 3859 | * to management frame header length plus 2 bytes each |
| 3860 | * for auth algorithm number, transaction number and |
| 3861 | * status code. |
| 3862 | */ |
| 3863 | |
| 3864 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3865 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3866 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3867 | |
| 3868 | break; |
| 3869 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3870 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3871 | |
| 3872 | |
| 3873 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3874 | |
| 3875 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3876 | { |
| 3877 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3878 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3879 | |
| 3880 | return; |
| 3881 | } |
| 3882 | |
| 3883 | for (i = 0; i < frameLen; i++) |
| 3884 | pFrame[i] = 0; |
| 3885 | |
| 3886 | // Prepare BD |
| 3887 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3888 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3889 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3890 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3891 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3892 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3893 | return; |
| 3894 | } |
| 3895 | |
| 3896 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame^] | 3897 | if (wep_challenge_len) |
| 3898 | pMacHdr->fc.wep = LIM_WEP_IN_FC; |
| 3899 | else |
| 3900 | pMacHdr->fc.wep = LIM_NO_WEP_IN_FC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | |
| 3902 | // Prepare BSSId |
| 3903 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3904 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3905 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3906 | (tANI_U8 *) psessionEntry->bssId, |
| 3907 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3908 | } |
| 3909 | |
| 3910 | /// Prepare Authentication frame body |
| 3911 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3912 | |
yeshwanth sriram guntuka | ccf694b | 2017-08-14 13:30:56 +0530 | [diff] [blame^] | 3913 | if (wep_challenge_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3914 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3915 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3916 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3917 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3918 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3919 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3920 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3921 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3923 | } |
| 3924 | else |
| 3925 | { |
| 3926 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3927 | pBody += sizeof(tANI_U16); |
| 3928 | bodyLen -= sizeof(tANI_U16); |
| 3929 | |
| 3930 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3931 | pBody += sizeof(tANI_U16); |
| 3932 | bodyLen -= sizeof(tANI_U16); |
| 3933 | |
| 3934 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3935 | pBody += sizeof(tANI_U16); |
| 3936 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3937 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3938 | sizeof (pAuthFrameBody->length) + |
| 3939 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3940 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3941 | |
| 3942 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3943 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3944 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3945 | { |
| 3946 | |
| 3947 | { |
| 3948 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3949 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3950 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3951 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3952 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3953 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3954 | (tANI_U8 *)pBody, |
| 3955 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3956 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3957 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3958 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3959 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3960 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3961 | } |
| 3962 | } |
| 3963 | else |
| 3964 | { |
| 3965 | /* MDID attr is 54*/ |
| 3966 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3967 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3968 | *pBody = SIR_MDIE_SIZE; |
| 3969 | pBody++; |
| 3970 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3971 | { |
| 3972 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3973 | pBody++; |
| 3974 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3975 | } |
| 3976 | } |
| 3977 | } |
| 3978 | #endif |
| 3979 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3980 | limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3981 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3982 | pAuthFrameBody->authTransactionSeqNumber, |
| 3983 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3984 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3985 | MAC_ADDR_ARRAY(pMacHdr->da)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3986 | } |
| 3987 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3988 | |
| 3989 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3990 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3991 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3992 | #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] | 3993 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3994 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3995 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3996 | ) |
| 3997 | { |
| 3998 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3999 | } |
| 4000 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4001 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE || |
| 4002 | psessionEntry->pePersona == VOS_STA_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4003 | { |
| 4004 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4005 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4006 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4007 | limLog( pMac, LOG1, |
| 4008 | FL("Sending Auth Frame over WQ5 with waitForAck %d to "MAC_ADDRESS_STR |
| 4009 | " From " MAC_ADDRESS_STR), waitForAck, MAC_ADDR_ARRAY(pMacHdr->da), |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4010 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 4011 | |
| 4012 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4013 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4014 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4015 | psessionEntry->peSessionId, |
| 4016 | pMacHdr->fc.subType)); |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 4017 | |
| 4018 | if( ( psessionEntry->is11Gonly == true ) && |
| 4019 | ( !IS_BROADCAST_MAC(peerMacAddr) ) ){ |
| 4020 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4021 | } |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4022 | if(eSIR_TRUE == waitForAck) |
| 4023 | { |
| 4024 | pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD; |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 4025 | limLog(pMac, LOG1, FL("Auth frame - txBdToken %u"), |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 4026 | pMac->lim.txBdToken); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4027 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, |
| 4028 | ( tANI_U16 ) frameLen, |
| 4029 | HAL_TXRX_FRM_802_11_MGMT, |
| 4030 | ANI_TXDIR_TODS, |
| 4031 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Ganesh Kondabattini | ffc00b1 | 2015-03-18 13:11:33 +0530 | [diff] [blame] | 4032 | limTxComplete, pFrame, limAuthTxCompleteCnf, txFlag, |
| 4033 | pMac->lim.txBdToken); |
| 4034 | pMac->lim.txBdToken++; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4035 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4036 | psessionEntry->peSessionId, |
| 4037 | halstatus)); |
| 4038 | if (!HAL_STATUS_SUCCESS(halstatus)) |
| 4039 | { |
| 4040 | limLog( pMac, LOGE, |
| 4041 | FL("Could not send Auth frame, retCode=%X "), |
| 4042 | halstatus ); |
| 4043 | pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE; |
| 4044 | //Pkt will be freed up by the callback |
| 4045 | } |
| 4046 | } |
| 4047 | else |
| 4048 | { |
| 4049 | /// Queue Authentication frame in high priority WQ |
| 4050 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4051 | HAL_TXRX_FRM_802_11_MGMT, |
| 4052 | ANI_TXDIR_TODS, |
| 4053 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4054 | limTxComplete, pFrame, txFlag ); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4055 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4056 | psessionEntry->peSessionId, |
| 4057 | halstatus)); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4058 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4059 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4060 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4061 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | halstatus); |
| 4063 | |
| 4064 | //Pkt will be freed up by the callback |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4065 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4066 | } |
| 4067 | |
| 4068 | return; |
| 4069 | } /*** end limSendAuthMgmtFrame() ***/ |
| 4070 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4071 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 4072 | { |
| 4073 | tANI_U16 aid; |
| 4074 | tpDphHashNode pStaDs; |
| 4075 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 4076 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 4077 | tpPESession psessionEntry; |
| 4078 | |
| 4079 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 4080 | if (pMlmDeauthReq) |
| 4081 | { |
| 4082 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4083 | { |
| 4084 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4085 | } |
| 4086 | |
| 4087 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 4088 | { |
| 4089 | |
| 4090 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4091 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4092 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4093 | goto end; |
| 4094 | } |
| 4095 | |
| 4096 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4097 | if (pStaDs == NULL) |
| 4098 | { |
| 4099 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4100 | goto end; |
| 4101 | } |
| 4102 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4103 | /// Receive path cleanup with dummy packet |
| 4104 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4105 | |
| 4106 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4107 | if ( psessionEntry->limSystemRole == eLIM_STA_ROLE ) |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4108 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4109 | PELOGE(limLog(pMac, LOG1, |
| 4110 | FL("FT Preauth SessionId %d Cleanup" |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4111 | #ifdef FEATURE_WLAN_ESE |
| 4112 | " isESE %d" |
| 4113 | #endif |
| 4114 | #ifdef FEATURE_WLAN_LFR |
| 4115 | " isLFR %d" |
| 4116 | #endif |
| 4117 | " is11r %d, Deauth reason %d Trigger = %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4118 | psessionEntry->peSessionId, |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4119 | #ifdef FEATURE_WLAN_ESE |
| 4120 | psessionEntry->isESEconnection, |
| 4121 | #endif |
| 4122 | #ifdef FEATURE_WLAN_LFR |
| 4123 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 4124 | #endif |
| 4125 | psessionEntry->is11Rconnection, |
| 4126 | pMlmDeauthReq->reasonCode, |
| 4127 | pMlmDeauthReq->deauthTrigger);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4128 | |
| 4129 | limFTCleanup(pMac); |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 4130 | } |
| 4131 | #endif |
| 4132 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4133 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4134 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4135 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 4136 | } |
| 4137 | return eHAL_STATUS_SUCCESS; |
| 4138 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4139 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4140 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 4141 | sizeof(tSirMacAddr)); |
| 4142 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 4143 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 4144 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 4145 | |
| 4146 | // Free up buffer allocated |
| 4147 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4148 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4149 | |
| 4150 | limPostSmeMessage(pMac, |
| 4151 | LIM_MLM_DEAUTH_CNF, |
| 4152 | (tANI_U32 *) &mlmDeauthCnf); |
| 4153 | return eHAL_STATUS_SUCCESS; |
| 4154 | } |
| 4155 | |
| 4156 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 4157 | { |
| 4158 | tANI_U16 aid; |
| 4159 | tpDphHashNode pStaDs; |
| 4160 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 4161 | tpPESession psessionEntry; |
| 4162 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 4163 | |
| 4164 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 4165 | if (pMlmDisassocReq) |
| 4166 | { |
| 4167 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4168 | { |
| 4169 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4170 | } |
| 4171 | |
| 4172 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 4173 | { |
| 4174 | |
| 4175 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4176 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4177 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4178 | goto end; |
| 4179 | } |
| 4180 | |
| 4181 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4182 | if (pStaDs == NULL) |
| 4183 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 4184 | limLog(pMac, LOGE, |
| 4185 | FL("StaDs Null")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4186 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4187 | goto end; |
| 4188 | } |
| 4189 | |
| 4190 | /// Receive path cleanup with dummy packet |
| 4191 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 4192 | { |
| 4193 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 4194 | limLog(pMac, LOGE, |
| 4195 | FL("CleanupRxPath error")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4196 | goto end; |
| 4197 | } |
| 4198 | |
| 4199 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4200 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 4201 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4202 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4203 | { |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4204 | PELOGE(limLog(pMac, LOG1, |
| 4205 | FL("FT Preauth SessionId %d Cleanup" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4206 | #ifdef FEATURE_WLAN_ESE |
| 4207 | " isESE %d" |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4208 | #endif |
| 4209 | #ifdef FEATURE_WLAN_LFR |
| 4210 | " isLFR %d" |
| 4211 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4212 | " is11r %d reason %d"), |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4213 | psessionEntry->peSessionId, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4214 | #ifdef FEATURE_WLAN_ESE |
| 4215 | psessionEntry->isESEconnection, |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4216 | #endif |
| 4217 | #ifdef FEATURE_WLAN_LFR |
| 4218 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 4219 | #endif |
| 4220 | psessionEntry->is11Rconnection, |
| 4221 | pMlmDisassocReq->reasonCode);); |
Mukul Sharma | 0820d0e | 2014-11-11 19:49:02 +0530 | [diff] [blame] | 4222 | limFTCleanup(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4223 | } |
| 4224 | #endif |
| 4225 | |
| 4226 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4227 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4228 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 4229 | return eHAL_STATUS_SUCCESS; |
| 4230 | } |
| 4231 | else |
| 4232 | { |
| 4233 | return eHAL_STATUS_SUCCESS; |
| 4234 | } |
| 4235 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4236 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4237 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 4238 | sizeof(tSirMacAddr)); |
| 4239 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 4240 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 4241 | |
| 4242 | /* Update PE session ID*/ |
| 4243 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 4244 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 4245 | if(pMlmDisassocReq != NULL) |
| 4246 | { |
| 4247 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4248 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 4249 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 4250 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4251 | |
| 4252 | limPostSmeMessage(pMac, |
| 4253 | LIM_MLM_DISASSOC_CNF, |
| 4254 | (tANI_U32 *) &mlmDisassocCnf); |
| 4255 | return eHAL_STATUS_SUCCESS; |
| 4256 | } |
| 4257 | |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 4258 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4259 | { |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 4260 | if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 4261 | { |
| 4262 | tpSirTxBdStatus pTxBdStatus; |
| 4263 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 4264 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 4265 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 4266 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4267 | return limSendDisassocCnf(pMac); |
| 4268 | } |
| 4269 | |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 4270 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4271 | { |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 4272 | if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 4273 | { |
| 4274 | tpSirTxBdStatus pTxBdStatus; |
| 4275 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 4276 | limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"), |
| 4277 | pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken); |
| 4278 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4279 | return limSendDeauthCnf(pMac); |
| 4280 | } |
| 4281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4282 | /** |
| 4283 | * \brief This function is called to send Disassociate frame. |
| 4284 | * |
| 4285 | * |
| 4286 | * \param pMac Pointer to Global MAC structure |
| 4287 | * |
| 4288 | * \param nReason Indicates the reason that need to be sent in |
| 4289 | * Disassociation frame |
| 4290 | * |
| 4291 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 4292 | * sent |
| 4293 | * |
| 4294 | * |
| 4295 | */ |
| 4296 | |
| 4297 | void |
| 4298 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 4299 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4300 | tSirMacAddr peer, |
| 4301 | tpPESession psessionEntry, |
| 4302 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4303 | { |
| 4304 | tDot11fDisassociation frm; |
| 4305 | tANI_U8 *pFrame; |
| 4306 | tSirRetStatus nSirStatus; |
| 4307 | tpSirMacMgmtHdr pMacHdr; |
| 4308 | tANI_U32 nBytes, nPayload, nStatus; |
| 4309 | void *pPacket; |
| 4310 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4311 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4312 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4313 | if(NULL == psessionEntry) |
| 4314 | { |
| 4315 | return; |
| 4316 | } |
| 4317 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4318 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4319 | |
| 4320 | frm.Reason.code = nReason; |
| 4321 | |
| 4322 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 4323 | if ( DOT11F_FAILED( nStatus ) ) |
| 4324 | { |
| 4325 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4326 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4327 | nStatus ); |
| 4328 | // We'll fall back on the worst case scenario: |
| 4329 | nPayload = sizeof( tDot11fDisassociation ); |
| 4330 | } |
| 4331 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4332 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4333 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4334 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4335 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4336 | } |
| 4337 | |
| 4338 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4339 | |
| 4340 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4341 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4342 | ( void** ) &pPacket ); |
| 4343 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4344 | { |
| 4345 | 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] | 4346 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4347 | return; |
| 4348 | } |
| 4349 | |
| 4350 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4351 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4352 | |
| 4353 | // Next, we fill out the buffer descriptor: |
| 4354 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4355 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 4356 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4357 | { |
| 4358 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4359 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4360 | nSirStatus ); |
| 4361 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4362 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4363 | return; // just allocated... |
| 4364 | } |
| 4365 | |
| 4366 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4367 | |
| 4368 | // Prepare the BSSID |
| 4369 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4370 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4371 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4372 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4373 | #endif |
| 4374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4375 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 4376 | sizeof(tSirMacMgmtHdr), |
| 4377 | nPayload, &nPayload ); |
| 4378 | if ( DOT11F_FAILED( nStatus ) ) |
| 4379 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4380 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4381 | nStatus ); |
| 4382 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4383 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4384 | return; // allocated! |
| 4385 | } |
| 4386 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4387 | { |
| 4388 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4389 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4390 | } |
| 4391 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4392 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 4393 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4394 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4395 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4396 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4397 | |
| 4398 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4399 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4400 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4401 | ) |
| 4402 | { |
| 4403 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4404 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4405 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4406 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4407 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4408 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4409 | { |
| 4410 | /* This frame will be sent on air by firmware, |
| 4411 | which will ensure that this frame goes out |
| 4412 | even though DEL_STA is sent immediately */ |
| 4413 | /* Without this for DEL_STA command there is |
| 4414 | risk of flushing frame in BTQM queue without |
| 4415 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4416 | limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR |
| 4417 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4418 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4419 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4420 | } |
| 4421 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4422 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4423 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4424 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4425 | psessionEntry->peSessionId, |
| 4426 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4427 | // Queue Disassociation frame in high priority WQ |
| 4428 | /* get the duration from the request */ |
| 4429 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4430 | HAL_TXRX_FRM_802_11_MGMT, |
| 4431 | ANI_TXDIR_TODS, |
| 4432 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4433 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 4434 | txFlag, |
| 4435 | pMac->lim.txBdToken++); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4436 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4437 | psessionEntry->peSessionId, |
| 4438 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4439 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4440 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4441 | if (tx_timer_change( |
| 4442 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 4443 | != TX_SUCCESS) |
| 4444 | { |
| 4445 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4446 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4447 | return; |
| 4448 | } |
| 4449 | else if(TX_SUCCESS != tx_timer_activate( |
| 4450 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 4451 | { |
| 4452 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4453 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4454 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 4455 | return; |
| 4456 | } |
| 4457 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 4458 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4459 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4460 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4461 | psessionEntry->peSessionId, |
| 4462 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4463 | // Queue Disassociation frame in high priority WQ |
| 4464 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4465 | HAL_TXRX_FRM_802_11_MGMT, |
| 4466 | ANI_TXDIR_TODS, |
| 4467 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4468 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4469 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4470 | psessionEntry->peSessionId, |
| 4471 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4472 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4473 | { |
| 4474 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4475 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4476 | nSirStatus ); |
| 4477 | //Pkt will be freed up by the callback |
| 4478 | return; |
| 4479 | } |
| 4480 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4481 | } // End limSendDisassocMgmtFrame. |
| 4482 | |
| 4483 | /** |
| 4484 | * \brief This function is called to send a Deauthenticate frame |
| 4485 | * |
| 4486 | * |
| 4487 | * \param pMac Pointer to global MAC structure |
| 4488 | * |
| 4489 | * \param nReason Indicates the reason that need to be sent in the |
| 4490 | * Deauthenticate frame |
| 4491 | * |
| 4492 | * \param peeer address of the STA to which the frame is to be sent |
| 4493 | * |
| 4494 | * |
| 4495 | */ |
| 4496 | |
| 4497 | void |
| 4498 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 4499 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4500 | tSirMacAddr peer, |
| 4501 | tpPESession psessionEntry, |
| 4502 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4503 | { |
| 4504 | tDot11fDeAuth frm; |
| 4505 | tANI_U8 *pFrame; |
| 4506 | tSirRetStatus nSirStatus; |
| 4507 | tpSirMacMgmtHdr pMacHdr; |
| 4508 | tANI_U32 nBytes, nPayload, nStatus; |
| 4509 | void *pPacket; |
| 4510 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4511 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4512 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4513 | #ifdef FEATURE_WLAN_TDLS |
| 4514 | tANI_U16 aid; |
| 4515 | tpDphHashNode pStaDs; |
| 4516 | #endif |
| 4517 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4518 | if(NULL == psessionEntry) |
| 4519 | { |
| 4520 | return; |
| 4521 | } |
| 4522 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4523 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | |
| 4525 | frm.Reason.code = nReason; |
| 4526 | |
| 4527 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 4528 | if ( DOT11F_FAILED( nStatus ) ) |
| 4529 | { |
| 4530 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4531 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4532 | nStatus ); |
| 4533 | // We'll fall back on the worst case scenario: |
| 4534 | nPayload = sizeof( tDot11fDeAuth ); |
| 4535 | } |
| 4536 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4537 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4538 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4540 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4541 | } |
| 4542 | |
| 4543 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4544 | |
| 4545 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4546 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 4547 | ( void** ) &pPacket ); |
| 4548 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4549 | { |
| 4550 | 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] | 4551 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | return; |
| 4553 | } |
| 4554 | |
| 4555 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4556 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4557 | |
| 4558 | // Next, we fill out the buffer descriptor: |
| 4559 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4560 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 4561 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4562 | { |
| 4563 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4564 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4565 | nSirStatus ); |
| 4566 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4567 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4568 | return; // just allocated... |
| 4569 | } |
| 4570 | |
| 4571 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4572 | |
| 4573 | // Prepare the BSSID |
| 4574 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4575 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4576 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4577 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4578 | #endif |
| 4579 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4580 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 4581 | sizeof(tSirMacMgmtHdr), |
| 4582 | nPayload, &nPayload ); |
| 4583 | if ( DOT11F_FAILED( nStatus ) ) |
| 4584 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4585 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | nStatus ); |
| 4587 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 4588 | ( void* ) pFrame, ( void* ) pPacket ); |
| 4589 | return; |
| 4590 | } |
| 4591 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4592 | { |
| 4593 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4594 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4595 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4596 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4597 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4598 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4599 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4600 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | |
| 4602 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4603 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4604 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4605 | ) |
| 4606 | { |
| 4607 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4608 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4609 | |
Sushant Kaushik | e8681d2 | 2015-04-21 12:08:25 +0530 | [diff] [blame] | 4610 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4611 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4612 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4613 | { |
| 4614 | /* This frame will be sent on air by firmware, |
| 4615 | which will ensure that this frame goes out |
| 4616 | even though DEL_STA is sent immediately */ |
| 4617 | /* Without this for DEL_STA command there is |
| 4618 | risk of flushing frame in BTQM queue without |
| 4619 | sending on air */ |
Agarwal Ashish | a8e81f5 | 2014-04-02 01:59:52 +0530 | [diff] [blame] | 4620 | limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR |
| 4621 | " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da), |
| 4622 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4623 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4624 | } |
| 4625 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4626 | #ifdef FEATURE_WLAN_TDLS |
| 4627 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4628 | #endif |
| 4629 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4630 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4631 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4632 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4633 | psessionEntry->peSessionId, |
| 4634 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4635 | // Queue Disassociation frame in high priority WQ |
| 4636 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4637 | HAL_TXRX_FRM_802_11_MGMT, |
| 4638 | ANI_TXDIR_TODS, |
| 4639 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 4640 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag, |
| 4641 | pMac->lim.txBdToken++); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4642 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4643 | psessionEntry->peSessionId, |
| 4644 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4645 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4646 | { |
| 4647 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4648 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4649 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4650 | //Pkt will be freed up by the callback limTxComplete |
| 4651 | |
| 4652 | /*Call limProcessDeauthAckTimeout which will send |
| 4653 | * DeauthCnf for this frame |
| 4654 | */ |
| 4655 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4656 | return; |
| 4657 | } |
| 4658 | |
| 4659 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4660 | |
| 4661 | if (tx_timer_change( |
| 4662 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4663 | != TX_SUCCESS) |
| 4664 | { |
| 4665 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4666 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4667 | return; |
| 4668 | } |
| 4669 | else if(TX_SUCCESS != tx_timer_activate( |
| 4670 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4671 | { |
| 4672 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4673 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4674 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4675 | return; |
| 4676 | } |
| 4677 | } |
| 4678 | else |
| 4679 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4680 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4681 | psessionEntry->peSessionId, |
| 4682 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4683 | #ifdef FEATURE_WLAN_TDLS |
| 4684 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4685 | { |
| 4686 | // Queue Disassociation frame in high priority WQ |
| 4687 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4688 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4689 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4690 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4691 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4692 | } |
| 4693 | else |
| 4694 | { |
| 4695 | #endif |
| 4696 | // Queue Disassociation frame in high priority WQ |
| 4697 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4698 | HAL_TXRX_FRM_802_11_MGMT, |
| 4699 | ANI_TXDIR_TODS, |
| 4700 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4701 | limTxComplete, pFrame, txFlag ); |
| 4702 | #ifdef FEATURE_WLAN_TDLS |
| 4703 | } |
| 4704 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4705 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4706 | psessionEntry->peSessionId, |
| 4707 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4708 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4709 | { |
| 4710 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4711 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4712 | nSirStatus ); |
| 4713 | //Pkt will be freed up by the callback |
| 4714 | return; |
| 4715 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4716 | } |
| 4717 | |
| 4718 | } // End limSendDeauthMgmtFrame. |
| 4719 | |
| 4720 | |
| 4721 | #ifdef ANI_SUPPORT_11H |
| 4722 | /** |
| 4723 | * \brief Send a Measurement Report Action frame |
| 4724 | * |
| 4725 | * |
| 4726 | * \param pMac Pointer to the global MAC structure |
| 4727 | * |
| 4728 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4729 | * |
| 4730 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4731 | * |
| 4732 | * |
| 4733 | */ |
| 4734 | |
| 4735 | tSirRetStatus |
| 4736 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4737 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4738 | tSirMacAddr peer) |
| 4739 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4740 | tDot11fMeasurementReport frm; |
| 4741 | tANI_U8 *pFrame; |
| 4742 | tSirRetStatus nSirStatus; |
| 4743 | tpSirMacMgmtHdr pMacHdr; |
| 4744 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4745 | void *pPacket; |
| 4746 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4747 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4748 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4749 | |
| 4750 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4751 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4752 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4753 | |
| 4754 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4755 | { |
| 4756 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4757 | nSirStatus = |
| 4758 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4759 | &frm.MeasurementReport ); |
| 4760 | break; |
| 4761 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4762 | nSirStatus = |
| 4763 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4764 | &frm.MeasurementReport ); |
| 4765 | break; |
| 4766 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4767 | nSirStatus = |
| 4768 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4769 | &frm.MeasurementReport ); |
| 4770 | break; |
| 4771 | default: |
| 4772 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4773 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4774 | pMeasReqFrame->measReqIE.measType ); |
| 4775 | return eSIR_FAILURE; |
| 4776 | } |
| 4777 | |
| 4778 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4779 | |
| 4780 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4781 | if ( DOT11F_FAILED( nStatus ) ) |
| 4782 | { |
| 4783 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4784 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4785 | nStatus ); |
| 4786 | // We'll fall back on the worst case scenario: |
| 4787 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4788 | } |
| 4789 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4790 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4791 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4792 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4793 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4794 | } |
| 4795 | |
| 4796 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4797 | |
| 4798 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4799 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4800 | { |
| 4801 | 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] | 4802 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | return eSIR_FAILURE; |
| 4804 | } |
| 4805 | |
| 4806 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4807 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4808 | |
| 4809 | // Next, we fill out the buffer descriptor: |
| 4810 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4811 | SIR_MAC_MGMT_ACTION, peer); |
| 4812 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4813 | { |
| 4814 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4815 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4816 | nSirStatus ); |
| 4817 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4818 | return eSIR_FAILURE; // just allocated... |
| 4819 | } |
| 4820 | |
| 4821 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4822 | |
| 4823 | nCfg = 6; |
| 4824 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4825 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4826 | { |
| 4827 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4828 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4829 | nSirStatus ); |
| 4830 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4831 | return eSIR_FAILURE; // just allocated... |
| 4832 | } |
| 4833 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4834 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4835 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4836 | #endif |
| 4837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4838 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4839 | sizeof(tSirMacMgmtHdr), |
| 4840 | nPayload, &nPayload ); |
| 4841 | if ( DOT11F_FAILED( nStatus ) ) |
| 4842 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4843 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4844 | nStatus ); |
| 4845 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4846 | return eSIR_FAILURE; // allocated! |
| 4847 | } |
| 4848 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4849 | { |
| 4850 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4851 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4852 | } |
| 4853 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4854 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4855 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4856 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4857 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4858 | HAL_TXRX_FRM_802_11_MGMT, |
| 4859 | ANI_TXDIR_TODS, |
| 4860 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4861 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4862 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4863 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4864 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4865 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4866 | { |
| 4867 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4868 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4869 | nSirStatus ); |
| 4870 | //Pkt will be freed up by the callback |
| 4871 | return eSIR_FAILURE; // just allocated... |
| 4872 | } |
| 4873 | |
| 4874 | return eSIR_SUCCESS; |
| 4875 | |
| 4876 | } // End limSendMeasReportFrame. |
| 4877 | |
| 4878 | |
| 4879 | /** |
| 4880 | * \brief Send a TPC Request Action frame |
| 4881 | * |
| 4882 | * |
| 4883 | * \param pMac Pointer to the global MAC datastructure |
| 4884 | * |
| 4885 | * \param peer MAC address to which the frame should be sent |
| 4886 | * |
| 4887 | * |
| 4888 | */ |
| 4889 | |
| 4890 | void |
| 4891 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4892 | tSirMacAddr peer) |
| 4893 | { |
| 4894 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4895 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4896 | tSirRetStatus nSirStatus; |
| 4897 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4898 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4899 | void *pPacket; |
| 4900 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4901 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4902 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4903 | |
| 4904 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4905 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4906 | frm.DialogToken.token = 1; |
| 4907 | frm.TPCRequest.present = 1; |
| 4908 | |
| 4909 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4910 | if ( DOT11F_FAILED( nStatus ) ) |
| 4911 | { |
| 4912 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4913 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4914 | nStatus ); |
| 4915 | // We'll fall back on the worst case scenario: |
| 4916 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4917 | } |
| 4918 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4919 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4920 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4921 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4922 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4923 | } |
| 4924 | |
| 4925 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4926 | |
| 4927 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4928 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4929 | { |
| 4930 | 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] | 4931 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4932 | return; |
| 4933 | } |
| 4934 | |
| 4935 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4936 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4937 | |
| 4938 | // Next, we fill out the buffer descriptor: |
| 4939 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4940 | SIR_MAC_MGMT_ACTION, peer); |
| 4941 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4942 | { |
| 4943 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4944 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4945 | nSirStatus ); |
| 4946 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4947 | return; // just allocated... |
| 4948 | } |
| 4949 | |
| 4950 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4951 | |
| 4952 | nCfg = 6; |
| 4953 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4954 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4955 | { |
| 4956 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4957 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4958 | nSirStatus ); |
| 4959 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4960 | return; // just allocated... |
| 4961 | } |
| 4962 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4963 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4964 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4965 | #endif |
| 4966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4967 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4968 | sizeof(tSirMacMgmtHdr), |
| 4969 | nPayload, &nPayload ); |
| 4970 | if ( DOT11F_FAILED( nStatus ) ) |
| 4971 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4972 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4973 | nStatus ); |
| 4974 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4975 | return; // allocated! |
| 4976 | } |
| 4977 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4978 | { |
| 4979 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4980 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4981 | } |
| 4982 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4983 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4984 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4985 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4987 | HAL_TXRX_FRM_802_11_MGMT, |
| 4988 | ANI_TXDIR_TODS, |
| 4989 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4990 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4991 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4992 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4993 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4994 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4995 | { |
| 4996 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4997 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | nSirStatus ); |
| 4999 | //Pkt will be freed up by the callback |
| 5000 | return; |
| 5001 | } |
| 5002 | |
| 5003 | } // End limSendTpcRequestFrame. |
| 5004 | |
| 5005 | |
| 5006 | /** |
| 5007 | * \brief Send a TPC Report Action frame |
| 5008 | * |
| 5009 | * |
| 5010 | * \param pMac Pointer to the global MAC datastructure |
| 5011 | * |
| 5012 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 5013 | * |
| 5014 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5015 | * |
| 5016 | * |
| 5017 | */ |
| 5018 | |
| 5019 | tSirRetStatus |
| 5020 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 5021 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 5022 | tSirMacAddr peer) |
| 5023 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5024 | tDot11fTPCReport frm; |
| 5025 | tANI_U8 *pFrame; |
| 5026 | tSirRetStatus nSirStatus; |
| 5027 | tpSirMacMgmtHdr pMacHdr; |
| 5028 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 5029 | void *pPacket; |
| 5030 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5031 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5032 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5033 | |
| 5034 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5035 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 5036 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 5037 | |
| 5038 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 5039 | // "misplaced this function, need to replace: |
| 5040 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 5041 | // pMac->lim.gLimCurrentChannelId, 0); |
| 5042 | frm.TPCReport.tx_power = 0; |
| 5043 | frm.TPCReport.link_margin = 0; |
| 5044 | frm.TPCReport.present = 1; |
| 5045 | |
| 5046 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 5047 | if ( DOT11F_FAILED( nStatus ) ) |
| 5048 | { |
| 5049 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5050 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5051 | nStatus ); |
| 5052 | // We'll fall back on the worst case scenario: |
| 5053 | nPayload = sizeof( tDot11fTPCReport ); |
| 5054 | } |
| 5055 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5056 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5057 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5058 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5059 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5060 | } |
| 5061 | |
| 5062 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5063 | |
| 5064 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5065 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5066 | { |
| 5067 | 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] | 5068 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5069 | return eSIR_FAILURE; |
| 5070 | } |
| 5071 | |
| 5072 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5073 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5074 | |
| 5075 | // Next, we fill out the buffer descriptor: |
| 5076 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5077 | SIR_MAC_MGMT_ACTION, peer); |
| 5078 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5079 | { |
| 5080 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5081 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5082 | nSirStatus ); |
| 5083 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5084 | return eSIR_FAILURE; // just allocated... |
| 5085 | } |
| 5086 | |
| 5087 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5088 | |
| 5089 | nCfg = 6; |
| 5090 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 5091 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5092 | { |
| 5093 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5094 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5095 | nSirStatus ); |
| 5096 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5097 | return eSIR_FAILURE; // just allocated... |
| 5098 | } |
| 5099 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5100 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5101 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5102 | #endif |
| 5103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5104 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 5105 | sizeof(tSirMacMgmtHdr), |
| 5106 | nPayload, &nPayload ); |
| 5107 | if ( DOT11F_FAILED( nStatus ) ) |
| 5108 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5109 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | nStatus ); |
| 5111 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5112 | return eSIR_FAILURE; // allocated! |
| 5113 | } |
| 5114 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5115 | { |
| 5116 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5117 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5118 | } |
| 5119 | |
| 5120 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5121 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5122 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5123 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5124 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5125 | HAL_TXRX_FRM_802_11_MGMT, |
| 5126 | ANI_TXDIR_TODS, |
| 5127 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5128 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5129 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5130 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 5131 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5132 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5133 | { |
| 5134 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5135 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5136 | nSirStatus ); |
| 5137 | //Pkt will be freed up by the callback |
| 5138 | return eSIR_FAILURE; // just allocated... |
| 5139 | } |
| 5140 | |
| 5141 | return eSIR_SUCCESS; |
| 5142 | |
| 5143 | } // End limSendTpcReportFrame. |
| 5144 | #endif //ANI_SUPPORT_11H |
| 5145 | |
| 5146 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | /** |
| 5148 | * \brief Send a Channel Switch Announcement |
| 5149 | * |
| 5150 | * |
| 5151 | * \param pMac Pointer to the global MAC datastructure |
| 5152 | * |
| 5153 | * \param peer MAC address to which this frame will be sent |
| 5154 | * |
| 5155 | * \param nMode |
| 5156 | * |
| 5157 | * \param nNewChannel |
| 5158 | * |
| 5159 | * \param nCount |
| 5160 | * |
| 5161 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5162 | * |
| 5163 | * |
| 5164 | */ |
| 5165 | |
| 5166 | tSirRetStatus |
| 5167 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5168 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5169 | tANI_U8 nMode, |
| 5170 | tANI_U8 nNewChannel, |
| 5171 | tANI_U8 nCount, |
| 5172 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5173 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5174 | tDot11fChannelSwitch frm; |
| 5175 | tANI_U8 *pFrame; |
| 5176 | tSirRetStatus nSirStatus; |
| 5177 | tpSirMacMgmtHdr pMacHdr; |
| 5178 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5179 | void *pPacket; |
| 5180 | eHalStatus halstatus; |
| 5181 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5182 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5183 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | |
| 5185 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5186 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5187 | frm.ChanSwitchAnn.switchMode = nMode; |
| 5188 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5189 | frm.ChanSwitchAnn.switchCount = nCount; |
| 5190 | frm.ChanSwitchAnn.present = 1; |
| 5191 | |
| 5192 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5193 | if ( DOT11F_FAILED( nStatus ) ) |
| 5194 | { |
| 5195 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5196 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5197 | nStatus ); |
| 5198 | // We'll fall back on the worst case scenario: |
| 5199 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5200 | } |
| 5201 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5202 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5203 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5204 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5205 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | } |
| 5207 | |
| 5208 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5209 | |
| 5210 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5211 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5212 | { |
| 5213 | 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] | 5214 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5215 | return eSIR_FAILURE; |
| 5216 | } |
| 5217 | |
| 5218 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5219 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5220 | |
| 5221 | // Next, we fill out the buffer descriptor: |
| 5222 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5223 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5224 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5225 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5226 | (tANI_U8 *) psessionEntry->bssId, |
| 5227 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5228 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5229 | { |
| 5230 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5231 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5232 | nSirStatus ); |
| 5233 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5234 | return eSIR_FAILURE; // just allocated... |
| 5235 | } |
| 5236 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5237 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5239 | |
| 5240 | nCfg = 6; |
| 5241 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 5242 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5243 | { |
| 5244 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5245 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5246 | nSirStatus ); |
| 5247 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5248 | return eSIR_FAILURE; // just allocated... |
| 5249 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5250 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5251 | |
| 5252 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5253 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5254 | #endif |
| 5255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5256 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5257 | sizeof(tSirMacMgmtHdr), |
| 5258 | nPayload, &nPayload ); |
| 5259 | if ( DOT11F_FAILED( nStatus ) ) |
| 5260 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5261 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5262 | nStatus ); |
| 5263 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5264 | return eSIR_FAILURE; // allocated! |
| 5265 | } |
| 5266 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5267 | { |
| 5268 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5269 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5270 | } |
| 5271 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5272 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5273 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5274 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5275 | ) |
| 5276 | { |
| 5277 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5278 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5279 | |
| 5280 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5281 | psessionEntry->peSessionId, |
| 5282 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5284 | HAL_TXRX_FRM_802_11_MGMT, |
| 5285 | ANI_TXDIR_TODS, |
| 5286 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5287 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5288 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5289 | psessionEntry->peSessionId, |
| 5290 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5291 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5292 | { |
| 5293 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5294 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5295 | nSirStatus ); |
| 5296 | //Pkt will be freed up by the callback |
| 5297 | return eSIR_FAILURE; |
| 5298 | } |
| 5299 | |
| 5300 | return eSIR_SUCCESS; |
| 5301 | |
| 5302 | } // End limSendChannelSwitchMgmtFrame. |
| 5303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5304 | |
| 5305 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5306 | #ifdef WLAN_FEATURE_11AC |
| 5307 | tSirRetStatus |
| 5308 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 5309 | tSirMacAddr peer, |
| 5310 | tANI_U8 nMode, |
| 5311 | tpPESession psessionEntry ) |
| 5312 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5313 | tDot11fOperatingMode frm; |
| 5314 | tANI_U8 *pFrame; |
| 5315 | tSirRetStatus nSirStatus; |
| 5316 | tpSirMacMgmtHdr pMacHdr; |
| 5317 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 5318 | void *pPacket; |
| 5319 | eHalStatus halstatus; |
| 5320 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5321 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5322 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5323 | |
| 5324 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 5325 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 5326 | frm.OperatingMode.chanWidth = nMode; |
| 5327 | frm.OperatingMode.rxNSS = 0; |
| 5328 | frm.OperatingMode.rxNSSType = 0; |
| 5329 | |
| 5330 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 5331 | if ( DOT11F_FAILED( nStatus ) ) |
| 5332 | { |
| 5333 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5334 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5335 | nStatus ); |
| 5336 | // We'll fall back on the worst case scenario: |
| 5337 | nPayload = sizeof( tDot11fOperatingMode); |
| 5338 | } |
| 5339 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5340 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5341 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5342 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5343 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5344 | } |
| 5345 | |
| 5346 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5347 | |
| 5348 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5349 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5350 | { |
| 5351 | 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] | 5352 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5353 | return eSIR_FAILURE; |
| 5354 | } |
| 5355 | |
| 5356 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5357 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5358 | |
| 5359 | |
| 5360 | // Next, we fill out the buffer descriptor: |
| 5361 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 5362 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5363 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5364 | } else |
| 5365 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5366 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 5367 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5368 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5369 | (tANI_U8 *) psessionEntry->bssId, |
| 5370 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5371 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5372 | { |
| 5373 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5374 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5375 | nSirStatus ); |
| 5376 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5377 | return eSIR_FAILURE; // just allocated... |
| 5378 | } |
| 5379 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 5380 | sizeof(tSirMacMgmtHdr), |
| 5381 | nPayload, &nPayload ); |
| 5382 | if ( DOT11F_FAILED( nStatus ) ) |
| 5383 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5384 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5385 | nStatus ); |
| 5386 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5387 | return eSIR_FAILURE; // allocated! |
| 5388 | } |
| 5389 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5390 | { |
| 5391 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5392 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5393 | } |
| 5394 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5395 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5396 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5397 | ) |
| 5398 | { |
| 5399 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5400 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5401 | |
| 5402 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5403 | psessionEntry->peSessionId, |
| 5404 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5405 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5406 | HAL_TXRX_FRM_802_11_MGMT, |
| 5407 | ANI_TXDIR_TODS, |
| 5408 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5409 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5410 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5411 | psessionEntry->peSessionId, |
| 5412 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5413 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5414 | { |
| 5415 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5416 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5417 | nSirStatus ); |
| 5418 | //Pkt will be freed up by the callback |
| 5419 | return eSIR_FAILURE; |
| 5420 | } |
| 5421 | |
| 5422 | return eSIR_SUCCESS; |
| 5423 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5424 | |
| 5425 | /** |
| 5426 | * \brief Send a VHT Channel Switch Announcement |
| 5427 | * |
| 5428 | * |
| 5429 | * \param pMac Pointer to the global MAC datastructure |
| 5430 | * |
| 5431 | * \param peer MAC address to which this frame will be sent |
| 5432 | * |
| 5433 | * \param nChanWidth |
| 5434 | * |
| 5435 | * \param nNewChannel |
| 5436 | * |
| 5437 | * |
| 5438 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5439 | * |
| 5440 | * |
| 5441 | */ |
| 5442 | |
| 5443 | tSirRetStatus |
| 5444 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 5445 | tSirMacAddr peer, |
| 5446 | tANI_U8 nChanWidth, |
| 5447 | tANI_U8 nNewChannel, |
| 5448 | tANI_U8 ncbMode, |
| 5449 | tpPESession psessionEntry ) |
| 5450 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5451 | tDot11fChannelSwitch frm; |
| 5452 | tANI_U8 *pFrame; |
| 5453 | tSirRetStatus nSirStatus; |
| 5454 | tpSirMacMgmtHdr pMacHdr; |
| 5455 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 5456 | void *pPacket; |
| 5457 | eHalStatus halstatus; |
| 5458 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5459 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5460 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5461 | |
| 5462 | |
| 5463 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 5464 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 5465 | frm.ChanSwitchAnn.switchMode = 1; |
| 5466 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 5467 | frm.ChanSwitchAnn.switchCount = 1; |
| 5468 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 5469 | frm.ExtChanSwitchAnn.present = 1; |
| 5470 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 5471 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 5472 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 5473 | frm.ChanSwitchAnn.present = 1; |
| 5474 | frm.WiderBWChanSwitchAnn.present = 1; |
| 5475 | |
| 5476 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 5477 | if ( DOT11F_FAILED( nStatus ) ) |
| 5478 | { |
| 5479 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5480 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5481 | nStatus ); |
| 5482 | // We'll fall back on the worst case scenario: |
| 5483 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 5484 | } |
| 5485 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5486 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5487 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5488 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5489 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5490 | } |
| 5491 | |
| 5492 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5493 | |
| 5494 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5495 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5496 | { |
| 5497 | 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] | 5498 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5499 | return eSIR_FAILURE; |
| 5500 | } |
| 5501 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5502 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5503 | |
| 5504 | // Next, we fill out the buffer descriptor: |
| 5505 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 5506 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 5507 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5508 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 5509 | (tANI_U8 *) psessionEntry->bssId, |
| 5510 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5511 | if ( eSIR_SUCCESS != nSirStatus ) |
| 5512 | { |
| 5513 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5514 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5515 | nSirStatus ); |
| 5516 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5517 | return eSIR_FAILURE; // just allocated... |
| 5518 | } |
| 5519 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 5520 | sizeof(tSirMacMgmtHdr), |
| 5521 | nPayload, &nPayload ); |
| 5522 | if ( DOT11F_FAILED( nStatus ) ) |
| 5523 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5524 | 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] | 5525 | nStatus ); |
| 5526 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5527 | return eSIR_FAILURE; // allocated! |
| 5528 | } |
| 5529 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5530 | { |
| 5531 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5532 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5533 | } |
| 5534 | |
| 5535 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5536 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5537 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5538 | ) |
| 5539 | { |
| 5540 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5541 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5542 | |
| 5543 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5544 | psessionEntry->peSessionId, |
| 5545 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5546 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 5547 | HAL_TXRX_FRM_802_11_MGMT, |
| 5548 | ANI_TXDIR_TODS, |
| 5549 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5550 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5551 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5552 | psessionEntry->peSessionId, |
| 5553 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5554 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5555 | { |
| 5556 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5557 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5558 | nSirStatus ); |
| 5559 | //Pkt will be freed up by the callback |
| 5560 | return eSIR_FAILURE; |
| 5561 | } |
| 5562 | |
| 5563 | return eSIR_SUCCESS; |
| 5564 | |
| 5565 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 5566 | |
| 5567 | |
| 5568 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 5569 | #endif |
| 5570 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5571 | /** |
| 5572 | * \brief Send an ADDBA Req Action Frame to peer |
| 5573 | * |
| 5574 | * \sa limSendAddBAReq |
| 5575 | * |
| 5576 | * \param pMac The global tpAniSirGlobal object |
| 5577 | * |
| 5578 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 5579 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 5580 | * Frame to the peer |
| 5581 | * |
| 5582 | * \return eSIR_SUCCESS if setup completes successfully |
| 5583 | * eSIR_FAILURE is some problem is encountered |
| 5584 | */ |
| 5585 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5586 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5587 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5588 | tDot11fAddBAReq frmAddBAReq; |
| 5589 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5590 | tpSirMacMgmtHdr pMacHdr; |
| 5591 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5592 | tSirRetStatus statusCode; |
| 5593 | eHalStatus halStatus; |
| 5594 | void *pPacket; |
| 5595 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5596 | |
| 5597 | if(NULL == psessionEntry) |
| 5598 | { |
| 5599 | return eSIR_FAILURE; |
| 5600 | } |
| 5601 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5602 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5603 | |
| 5604 | // Category - 3 (BA) |
| 5605 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5606 | |
| 5607 | // Action - 0 (ADDBA Req) |
| 5608 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5609 | |
| 5610 | // FIXME - Dialog Token, generalize this... |
| 5611 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5612 | |
| 5613 | // Fill the ADDBA Parameter Set |
| 5614 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5615 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5616 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5617 | |
| 5618 | // BA timeout |
| 5619 | // 0 - indicates no BA timeout |
| 5620 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5621 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5622 | /* Send SSN whatever we get from FW. |
| 5623 | */ |
| 5624 | frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5625 | |
| 5626 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5627 | |
| 5628 | if( DOT11F_FAILED( nStatus )) |
| 5629 | { |
| 5630 | limLog( pMac, LOGW, |
| 5631 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5632 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | nStatus ); |
| 5634 | |
| 5635 | // We'll fall back on the worst case scenario: |
| 5636 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5637 | } |
| 5638 | else if( DOT11F_WARNED( nStatus )) |
| 5639 | { |
| 5640 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5641 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5642 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5643 | nStatus ); |
| 5644 | } |
| 5645 | |
| 5646 | // Add the MGMT header to frame length |
| 5647 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5648 | |
| 5649 | // Need to allocate a buffer for ADDBA AF |
| 5650 | if( eHAL_STATUS_SUCCESS != |
| 5651 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5652 | HAL_TXRX_FRM_802_11_MGMT, |
| 5653 | (tANI_U16) frameLen, |
| 5654 | (void **) &pAddBAReqBuffer, |
| 5655 | (void **) &pPacket ))) |
| 5656 | { |
| 5657 | // Log error |
| 5658 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5659 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5660 | frameLen, |
| 5661 | halStatus ); |
| 5662 | |
| 5663 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5664 | goto returnAfterError; |
| 5665 | } |
| 5666 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5667 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5668 | |
| 5669 | // Copy necessary info to BD |
| 5670 | if( eSIR_SUCCESS != |
| 5671 | (statusCode = limPopulateMacHeader( pMac, |
| 5672 | pAddBAReqBuffer, |
| 5673 | SIR_MAC_MGMT_FRAME, |
| 5674 | SIR_MAC_MGMT_ACTION, |
| 5675 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5676 | goto returnAfterError; |
| 5677 | |
| 5678 | // Update A3 with the BSSID |
| 5679 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5680 | |
| 5681 | #if 0 |
| 5682 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5683 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5684 | WNI_CFG_BSSID, |
| 5685 | (tANI_U8 *) pMacHdr->bssId, |
| 5686 | &cfgLen )) |
| 5687 | { |
| 5688 | limLog( pMac, LOGP, |
| 5689 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5690 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5691 | |
| 5692 | // FIXME - Need to convert to tSirRetStatus |
| 5693 | statusCode = eSIR_FAILURE; |
| 5694 | goto returnAfterError; |
| 5695 | } |
| 5696 | #endif//TO SUPPORT BT-AMP |
| 5697 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5698 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5699 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5700 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5701 | #endif |
| 5702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5703 | // Now, we're ready to "pack" the frames |
| 5704 | nStatus = dot11fPackAddBAReq( pMac, |
| 5705 | &frmAddBAReq, |
| 5706 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5707 | nPayload, |
| 5708 | &nPayload ); |
| 5709 | |
| 5710 | if( DOT11F_FAILED( nStatus )) |
| 5711 | { |
| 5712 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5713 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5714 | nStatus ); |
| 5715 | |
| 5716 | // FIXME - Need to convert to tSirRetStatus |
| 5717 | statusCode = eSIR_FAILURE; |
| 5718 | goto returnAfterError; |
| 5719 | } |
| 5720 | else if( DOT11F_WARNED( nStatus )) |
| 5721 | { |
| 5722 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5723 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5724 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5725 | } |
| 5726 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5727 | limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with" |
| 5728 | " tid = %d policy = %d buffsize = %d " |
| 5729 | " amsduSupported = %d"), |
| 5730 | MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr), |
| 5731 | frmAddBAReq.AddBAParameterSet.tid, |
| 5732 | frmAddBAReq.AddBAParameterSet.policy, |
| 5733 | frmAddBAReq.AddBAParameterSet.bufferSize, |
| 5734 | frmAddBAReq.AddBAParameterSet.amsduSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5735 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 5736 | limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ), |
| 5737 | frmAddBAReq.BAStartingSequenceControl.ssn, |
| 5738 | frmAddBAReq.BAStartingSequenceControl.fragNumber); |
| 5739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5740 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5741 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5742 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5743 | ) |
| 5744 | { |
| 5745 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5746 | } |
| 5747 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5748 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5749 | psessionEntry->peSessionId, |
| 5750 | pMacHdr->fc.subType)); |
| 5751 | halStatus = halTxFrame( pMac, |
| 5752 | pPacket, |
| 5753 | (tANI_U16) frameLen, |
| 5754 | HAL_TXRX_FRM_802_11_MGMT, |
| 5755 | ANI_TXDIR_TODS, |
| 5756 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5757 | limTxComplete, |
| 5758 | pAddBAReqBuffer, txFlag ); |
| 5759 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5760 | psessionEntry->peSessionId, |
| 5761 | halStatus)); |
| 5762 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5763 | { |
| 5764 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5765 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5766 | halStatus ); |
| 5767 | |
| 5768 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5769 | statusCode = eSIR_FAILURE; |
| 5770 | //Pkt will be freed up by the callback |
| 5771 | return statusCode; |
| 5772 | } |
| 5773 | else |
| 5774 | return eSIR_SUCCESS; |
| 5775 | |
| 5776 | returnAfterError: |
| 5777 | |
| 5778 | // Release buffer, if allocated |
| 5779 | if( NULL != pAddBAReqBuffer ) |
| 5780 | palPktFree( pMac->hHdd, |
| 5781 | HAL_TXRX_FRM_802_11_MGMT, |
| 5782 | (void *) pAddBAReqBuffer, |
| 5783 | (void *) pPacket ); |
| 5784 | |
| 5785 | return statusCode; |
| 5786 | } |
| 5787 | |
| 5788 | /** |
| 5789 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5790 | * |
| 5791 | * \sa limSendAddBARsp |
| 5792 | * |
| 5793 | * \param pMac The global tpAniSirGlobal object |
| 5794 | * |
| 5795 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5796 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5797 | * Frame to the peer |
| 5798 | * |
| 5799 | * \return eSIR_SUCCESS if setup completes successfully |
| 5800 | * eSIR_FAILURE is some problem is encountered |
| 5801 | */ |
| 5802 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5803 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5804 | tpPESession psessionEntry) |
| 5805 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5806 | tDot11fAddBARsp frmAddBARsp; |
| 5807 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5808 | tpSirMacMgmtHdr pMacHdr; |
| 5809 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5810 | tSirRetStatus statusCode; |
| 5811 | eHalStatus halStatus; |
| 5812 | void *pPacket; |
| 5813 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5814 | |
| 5815 | if(NULL == psessionEntry) |
| 5816 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5817 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5818 | return eSIR_FAILURE; |
| 5819 | } |
| 5820 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5821 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | |
| 5823 | // Category - 3 (BA) |
| 5824 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5825 | // Action - 1 (ADDBA Rsp) |
| 5826 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5827 | |
| 5828 | // Should be same as the one we received in the ADDBA Req |
| 5829 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5830 | |
| 5831 | // ADDBA Req status |
| 5832 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5833 | |
| 5834 | // Fill the ADDBA Parameter Set as provided by caller |
| 5835 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5836 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5837 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5838 | |
| 5839 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5840 | { |
| 5841 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5842 | psessionEntry->amsduSupportedInBA; |
| 5843 | } |
| 5844 | else |
| 5845 | { |
| 5846 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5847 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5848 | |
| 5849 | // BA timeout |
| 5850 | // 0 - indicates no BA timeout |
| 5851 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5852 | |
| 5853 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5854 | |
| 5855 | if( DOT11F_FAILED( nStatus )) |
| 5856 | { |
| 5857 | limLog( pMac, LOGW, |
| 5858 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5859 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | nStatus ); |
| 5861 | |
| 5862 | // We'll fall back on the worst case scenario: |
| 5863 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5864 | } |
| 5865 | else if( DOT11F_WARNED( nStatus )) |
| 5866 | { |
| 5867 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5868 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5869 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5870 | nStatus ); |
| 5871 | } |
| 5872 | |
| 5873 | // Need to allocate a buffer for ADDBA AF |
| 5874 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5875 | |
| 5876 | // Allocate shared memory |
| 5877 | if( eHAL_STATUS_SUCCESS != |
| 5878 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5879 | HAL_TXRX_FRM_802_11_MGMT, |
| 5880 | (tANI_U16) frameLen, |
| 5881 | (void **) &pAddBARspBuffer, |
| 5882 | (void **) &pPacket ))) |
| 5883 | { |
| 5884 | // Log error |
| 5885 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5886 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5887 | frameLen, |
| 5888 | halStatus ); |
| 5889 | |
| 5890 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5891 | goto returnAfterError; |
| 5892 | } |
| 5893 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5894 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | |
| 5896 | // Copy necessary info to BD |
| 5897 | if( eSIR_SUCCESS != |
| 5898 | (statusCode = limPopulateMacHeader( pMac, |
| 5899 | pAddBARspBuffer, |
| 5900 | SIR_MAC_MGMT_FRAME, |
| 5901 | SIR_MAC_MGMT_ACTION, |
| 5902 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5903 | goto returnAfterError; |
| 5904 | |
| 5905 | // Update A3 with the BSSID |
| 5906 | |
| 5907 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5908 | |
| 5909 | #if 0 |
| 5910 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5911 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5912 | WNI_CFG_BSSID, |
| 5913 | (tANI_U8 *) pMacHdr->bssId, |
| 5914 | &cfgLen )) |
| 5915 | { |
| 5916 | limLog( pMac, LOGP, |
| 5917 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5918 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5919 | |
| 5920 | // FIXME - Need to convert to tSirRetStatus |
| 5921 | statusCode = eSIR_FAILURE; |
| 5922 | goto returnAfterError; |
| 5923 | } |
| 5924 | #endif // TO SUPPORT BT-AMP |
| 5925 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5926 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5927 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5928 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5929 | #endif |
| 5930 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5931 | // Now, we're ready to "pack" the frames |
| 5932 | nStatus = dot11fPackAddBARsp( pMac, |
| 5933 | &frmAddBARsp, |
| 5934 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5935 | nPayload, |
| 5936 | &nPayload ); |
| 5937 | |
| 5938 | if( DOT11F_FAILED( nStatus )) |
| 5939 | { |
| 5940 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5941 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5942 | nStatus ); |
| 5943 | |
| 5944 | // FIXME - Need to convert to tSirRetStatus |
| 5945 | statusCode = eSIR_FAILURE; |
| 5946 | goto returnAfterError; |
| 5947 | } |
| 5948 | else if( DOT11F_WARNED( nStatus )) |
| 5949 | { |
| 5950 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5951 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5952 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5953 | } |
| 5954 | |
Abhishek Singh | 02d9f6c | 2014-05-12 14:07:53 +0530 | [diff] [blame] | 5955 | limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with" |
| 5956 | " tid = %d policy = %d buffsize = %d" |
| 5957 | " amsduSupported = %d status %d"), |
| 5958 | MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr), |
| 5959 | frmAddBARsp.AddBAParameterSet.tid, |
| 5960 | frmAddBARsp.AddBAParameterSet.policy, |
| 5961 | frmAddBARsp.AddBAParameterSet.bufferSize, |
| 5962 | frmAddBARsp.AddBAParameterSet.amsduSupported, |
| 5963 | frmAddBARsp.Status.status); |
| 5964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5965 | |
| 5966 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5967 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5968 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5969 | ) |
| 5970 | { |
| 5971 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5972 | } |
| 5973 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5974 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5975 | psessionEntry->peSessionId, |
| 5976 | pMacHdr->fc.subType)); |
| 5977 | halStatus = halTxFrame( pMac, |
| 5978 | pPacket, |
| 5979 | (tANI_U16) frameLen, |
| 5980 | HAL_TXRX_FRM_802_11_MGMT, |
| 5981 | ANI_TXDIR_TODS, |
| 5982 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5983 | limTxComplete, |
| 5984 | pAddBARspBuffer, txFlag ); |
| 5985 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5986 | psessionEntry->peSessionId, |
| 5987 | halStatus)); |
| 5988 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5989 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5990 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5991 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5992 | halStatus ); |
| 5993 | |
| 5994 | // FIXME - HAL error codes are different from PE error |
| 5995 | // codes!! And, this routine is returning tSirRetStatus |
| 5996 | statusCode = eSIR_FAILURE; |
| 5997 | //Pkt will be freed up by the callback |
| 5998 | return statusCode; |
| 5999 | } |
| 6000 | else |
| 6001 | return eSIR_SUCCESS; |
| 6002 | |
| 6003 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6004 | // Release buffer, if allocated |
| 6005 | if( NULL != pAddBARspBuffer ) |
| 6006 | palPktFree( pMac->hHdd, |
| 6007 | HAL_TXRX_FRM_802_11_MGMT, |
| 6008 | (void *) pAddBARspBuffer, |
| 6009 | (void *) pPacket ); |
| 6010 | |
| 6011 | return statusCode; |
| 6012 | } |
| 6013 | |
| 6014 | /** |
| 6015 | * \brief Send a DELBA Indication Action Frame to peer |
| 6016 | * |
| 6017 | * \sa limSendDelBAInd |
| 6018 | * |
| 6019 | * \param pMac The global tpAniSirGlobal object |
| 6020 | * |
| 6021 | * \param peerMacAddr MAC Address of peer |
| 6022 | * |
| 6023 | * \param reasonCode Reason for the DELBA notification |
| 6024 | * |
| 6025 | * \param pBAParameterSet The DELBA Parameter Set. |
| 6026 | * This identifies the TID for which the BA session is |
| 6027 | * being deleted. |
| 6028 | * |
| 6029 | * \return eSIR_SUCCESS if setup completes successfully |
| 6030 | * eSIR_FAILURE is some problem is encountered |
| 6031 | */ |
| 6032 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 6033 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 6034 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6035 | tDot11fDelBAInd frmDelBAInd; |
| 6036 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6037 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6038 | tpSirMacMgmtHdr pMacHdr; |
| 6039 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 6040 | tSirRetStatus statusCode; |
| 6041 | eHalStatus halStatus; |
| 6042 | void *pPacket; |
| 6043 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6044 | |
| 6045 | if(NULL == psessionEntry) |
| 6046 | { |
| 6047 | return eSIR_FAILURE; |
| 6048 | } |
| 6049 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6050 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6051 | |
| 6052 | // Category - 3 (BA) |
| 6053 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 6054 | // Action - 2 (DELBA) |
| 6055 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 6056 | |
| 6057 | // Fill the DELBA Parameter Set as provided by caller |
| 6058 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 6059 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 6060 | |
| 6061 | // BA Starting Sequence Number |
| 6062 | // Fragment number will always be zero |
| 6063 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 6064 | |
| 6065 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 6066 | |
| 6067 | if( DOT11F_FAILED( nStatus )) |
| 6068 | { |
| 6069 | limLog( pMac, LOGW, |
| 6070 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6071 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6072 | nStatus ); |
| 6073 | |
| 6074 | // We'll fall back on the worst case scenario: |
| 6075 | nPayload = sizeof( tDot11fDelBAInd ); |
| 6076 | } |
| 6077 | else if( DOT11F_WARNED( nStatus )) |
| 6078 | { |
| 6079 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6080 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6081 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6082 | nStatus ); |
| 6083 | } |
| 6084 | |
| 6085 | // Add the MGMT header to frame length |
| 6086 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6087 | |
| 6088 | // Allocate shared memory |
| 6089 | if( eHAL_STATUS_SUCCESS != |
| 6090 | (halStatus = palPktAlloc( pMac->hHdd, |
| 6091 | HAL_TXRX_FRM_802_11_MGMT, |
| 6092 | (tANI_U16) frameLen, |
| 6093 | (void **) &pDelBAIndBuffer, |
| 6094 | (void **) &pPacket ))) |
| 6095 | { |
| 6096 | // Log error |
| 6097 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6098 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6099 | frameLen, |
| 6100 | halStatus ); |
| 6101 | |
| 6102 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 6103 | goto returnAfterError; |
| 6104 | } |
| 6105 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6106 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6107 | |
| 6108 | // Copy necessary info to BD |
| 6109 | if( eSIR_SUCCESS != |
| 6110 | (statusCode = limPopulateMacHeader( pMac, |
| 6111 | pDelBAIndBuffer, |
| 6112 | SIR_MAC_MGMT_FRAME, |
| 6113 | SIR_MAC_MGMT_ACTION, |
| 6114 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 6115 | goto returnAfterError; |
| 6116 | |
| 6117 | // Update A3 with the BSSID |
| 6118 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 6119 | |
| 6120 | #if 0 |
| 6121 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 6122 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 6123 | WNI_CFG_BSSID, |
| 6124 | (tANI_U8 *) pMacHdr->bssId, |
| 6125 | &cfgLen )) |
| 6126 | { |
| 6127 | limLog( pMac, LOGP, |
| 6128 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6129 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6130 | |
| 6131 | // FIXME - Need to convert to tSirRetStatus |
| 6132 | statusCode = eSIR_FAILURE; |
| 6133 | goto returnAfterError; |
| 6134 | } |
| 6135 | #endif //TO SUPPORT BT-AMP |
| 6136 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 6137 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6138 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6139 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6140 | #endif |
| 6141 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6142 | // Now, we're ready to "pack" the frames |
| 6143 | nStatus = dot11fPackDelBAInd( pMac, |
| 6144 | &frmDelBAInd, |
| 6145 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 6146 | nPayload, |
| 6147 | &nPayload ); |
| 6148 | |
| 6149 | if( DOT11F_FAILED( nStatus )) |
| 6150 | { |
| 6151 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6152 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | nStatus ); |
| 6154 | |
| 6155 | // FIXME - Need to convert to tSirRetStatus |
| 6156 | statusCode = eSIR_FAILURE; |
| 6157 | goto returnAfterError; |
| 6158 | } |
| 6159 | else if( DOT11F_WARNED( nStatus )) |
| 6160 | { |
| 6161 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6162 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 6163 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6164 | } |
| 6165 | |
Abhishek Singh | 1f6e653 | 2014-06-05 17:35:08 +0530 | [diff] [blame] | 6166 | limLog( pMac, LOG1, |
| 6167 | FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d" |
| 6168 | " initiator = %d reason = %d" ), |
| 6169 | MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr), |
| 6170 | frmDelBAInd.DelBAParameterSet.tid, |
| 6171 | frmDelBAInd.DelBAParameterSet.initiator, |
| 6172 | frmDelBAInd.Reason.code); |
| 6173 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6174 | |
| 6175 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6176 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6177 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6178 | ) |
| 6179 | { |
| 6180 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6181 | } |
| 6182 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6183 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6184 | psessionEntry->peSessionId, |
| 6185 | pMacHdr->fc.subType)); |
| 6186 | halStatus = halTxFrame( pMac, |
| 6187 | pPacket, |
| 6188 | (tANI_U16) frameLen, |
| 6189 | HAL_TXRX_FRM_802_11_MGMT, |
| 6190 | ANI_TXDIR_TODS, |
| 6191 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6192 | limTxComplete, |
| 6193 | pDelBAIndBuffer, txFlag ); |
| 6194 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6195 | psessionEntry->peSessionId, |
| 6196 | halStatus)); |
| 6197 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6198 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6199 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6200 | statusCode = eSIR_FAILURE; |
| 6201 | //Pkt will be freed up by the callback |
| 6202 | return statusCode; |
| 6203 | } |
| 6204 | else |
| 6205 | return eSIR_SUCCESS; |
| 6206 | |
| 6207 | returnAfterError: |
| 6208 | |
| 6209 | // Release buffer, if allocated |
| 6210 | if( NULL != pDelBAIndBuffer ) |
| 6211 | palPktFree( pMac->hHdd, |
| 6212 | HAL_TXRX_FRM_802_11_MGMT, |
| 6213 | (void *) pDelBAIndBuffer, |
| 6214 | (void *) pPacket ); |
| 6215 | |
| 6216 | return statusCode; |
| 6217 | } |
| 6218 | |
| 6219 | #if defined WLAN_FEATURE_VOWIFI |
| 6220 | |
| 6221 | /** |
| 6222 | * \brief Send a Neighbor Report Request Action frame |
| 6223 | * |
| 6224 | * |
| 6225 | * \param pMac Pointer to the global MAC structure |
| 6226 | * |
| 6227 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 6228 | * |
| 6229 | * \param peer mac address of peer station. |
| 6230 | * |
| 6231 | * \param psessionEntry address of session entry. |
| 6232 | * |
| 6233 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6234 | * |
| 6235 | * |
| 6236 | */ |
| 6237 | |
| 6238 | tSirRetStatus |
| 6239 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 6240 | tpSirMacNeighborReportReq pNeighborReq, |
| 6241 | tSirMacAddr peer, |
| 6242 | tpPESession psessionEntry |
| 6243 | ) |
| 6244 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6245 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6246 | tDot11fNeighborReportRequest frm; |
| 6247 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6248 | tpSirMacMgmtHdr pMacHdr; |
| 6249 | tANI_U32 nBytes, nPayload, nStatus; |
| 6250 | void *pPacket; |
| 6251 | eHalStatus halstatus; |
| 6252 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6253 | |
| 6254 | if ( psessionEntry == NULL ) |
| 6255 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6256 | 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] | 6257 | return eSIR_FAILURE; |
| 6258 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6259 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6260 | |
| 6261 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6262 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 6263 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 6264 | |
| 6265 | |
| 6266 | if( pNeighborReq->ssid_present ) |
| 6267 | { |
| 6268 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 6269 | } |
| 6270 | |
| 6271 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 6272 | if ( DOT11F_FAILED( nStatus ) ) |
| 6273 | { |
| 6274 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6275 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | nStatus ); |
| 6277 | // We'll fall back on the worst case scenario: |
| 6278 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 6279 | } |
| 6280 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6281 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6282 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6283 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6284 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6285 | } |
| 6286 | |
| 6287 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6288 | |
| 6289 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6290 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6291 | { |
| 6292 | 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] | 6293 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6294 | return eSIR_FAILURE; |
| 6295 | } |
| 6296 | |
| 6297 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6298 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6299 | |
| 6300 | // Copy necessary info to BD |
| 6301 | if( eSIR_SUCCESS != |
| 6302 | (statusCode = limPopulateMacHeader( pMac, |
| 6303 | pFrame, |
| 6304 | SIR_MAC_MGMT_FRAME, |
| 6305 | SIR_MAC_MGMT_ACTION, |
| 6306 | peer, psessionEntry->selfMacAddr))) |
| 6307 | goto returnAfterError; |
| 6308 | |
| 6309 | // Update A3 with the BSSID |
| 6310 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6311 | |
| 6312 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6313 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6314 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6315 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6316 | #endif |
| 6317 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6318 | // Now, we're ready to "pack" the frames |
| 6319 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 6320 | &frm, |
| 6321 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6322 | nPayload, |
| 6323 | &nPayload ); |
| 6324 | |
| 6325 | if( DOT11F_FAILED( nStatus )) |
| 6326 | { |
| 6327 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6328 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6329 | nStatus ); |
| 6330 | |
| 6331 | // FIXME - Need to convert to tSirRetStatus |
| 6332 | statusCode = eSIR_FAILURE; |
| 6333 | goto returnAfterError; |
| 6334 | } |
| 6335 | else if( DOT11F_WARNED( nStatus )) |
| 6336 | { |
| 6337 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6338 | FL( "There were warnings while packing Neighbor Report " |
| 6339 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6340 | } |
| 6341 | |
| 6342 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6343 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6344 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6345 | |
| 6346 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6347 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6348 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6349 | ) |
| 6350 | { |
| 6351 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6352 | } |
| 6353 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6354 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6355 | psessionEntry->peSessionId, |
| 6356 | pMacHdr->fc.subType)); |
| 6357 | halstatus = halTxFrame( pMac, |
| 6358 | pPacket, |
| 6359 | (tANI_U16) nBytes, |
| 6360 | HAL_TXRX_FRM_802_11_MGMT, |
| 6361 | ANI_TXDIR_TODS, |
| 6362 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6363 | limTxComplete, |
| 6364 | pFrame, txFlag ); |
| 6365 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6366 | psessionEntry->peSessionId, |
| 6367 | halstatus)); |
| 6368 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6369 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6370 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6371 | statusCode = eSIR_FAILURE; |
| 6372 | //Pkt will be freed up by the callback |
| 6373 | return statusCode; |
| 6374 | } |
| 6375 | else |
| 6376 | return eSIR_SUCCESS; |
| 6377 | |
| 6378 | returnAfterError: |
| 6379 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6380 | |
| 6381 | return statusCode; |
| 6382 | } // End limSendNeighborReportRequestFrame. |
| 6383 | |
| 6384 | /** |
| 6385 | * \brief Send a Link Report Action frame |
| 6386 | * |
| 6387 | * |
| 6388 | * \param pMac Pointer to the global MAC structure |
| 6389 | * |
| 6390 | * \param pLinkReport Address of a tSirMacLinkReport |
| 6391 | * |
| 6392 | * \param peer mac address of peer station. |
| 6393 | * |
| 6394 | * \param psessionEntry address of session entry. |
| 6395 | * |
| 6396 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6397 | * |
| 6398 | * |
| 6399 | */ |
| 6400 | |
| 6401 | tSirRetStatus |
| 6402 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 6403 | tpSirMacLinkReport pLinkReport, |
| 6404 | tSirMacAddr peer, |
| 6405 | tpPESession psessionEntry |
| 6406 | ) |
| 6407 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6408 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6409 | tDot11fLinkMeasurementReport frm; |
| 6410 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6411 | tpSirMacMgmtHdr pMacHdr; |
| 6412 | tANI_U32 nBytes, nPayload, nStatus; |
| 6413 | void *pPacket; |
| 6414 | eHalStatus halstatus; |
| 6415 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6416 | |
| 6417 | |
| 6418 | if ( psessionEntry == NULL ) |
| 6419 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6420 | 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] | 6421 | return eSIR_FAILURE; |
| 6422 | } |
| 6423 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6424 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6425 | |
| 6426 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 6427 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 6428 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 6429 | |
| 6430 | |
| 6431 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 6432 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 6433 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 6434 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 6435 | //such case this way than changing the frame parser. |
| 6436 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 6437 | frm.TPCEleLen.TPCLen = 2; |
| 6438 | frm.TxPower.txPower = pLinkReport->txPower; |
| 6439 | frm.LinkMargin.linkMargin = 0; |
| 6440 | |
| 6441 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 6442 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 6443 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 6444 | frm.RSNI.rsni = pLinkReport->rsni; |
| 6445 | |
| 6446 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 6447 | if ( DOT11F_FAILED( nStatus ) ) |
| 6448 | { |
| 6449 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6450 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6451 | nStatus ); |
| 6452 | // We'll fall back on the worst case scenario: |
| 6453 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 6454 | } |
| 6455 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6456 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6457 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6458 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6459 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6460 | } |
| 6461 | |
| 6462 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6463 | |
| 6464 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6465 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6466 | { |
| 6467 | 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] | 6468 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6469 | return eSIR_FAILURE; |
| 6470 | } |
| 6471 | |
| 6472 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6473 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6474 | |
| 6475 | // Copy necessary info to BD |
| 6476 | if( eSIR_SUCCESS != |
| 6477 | (statusCode = limPopulateMacHeader( pMac, |
| 6478 | pFrame, |
| 6479 | SIR_MAC_MGMT_FRAME, |
| 6480 | SIR_MAC_MGMT_ACTION, |
| 6481 | peer, psessionEntry->selfMacAddr))) |
| 6482 | goto returnAfterError; |
| 6483 | |
| 6484 | // Update A3 with the BSSID |
| 6485 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6486 | |
| 6487 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6488 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6489 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6490 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6491 | #endif |
| 6492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6493 | // Now, we're ready to "pack" the frames |
| 6494 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 6495 | &frm, |
| 6496 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6497 | nPayload, |
| 6498 | &nPayload ); |
| 6499 | |
| 6500 | if( DOT11F_FAILED( nStatus )) |
| 6501 | { |
| 6502 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6503 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6504 | nStatus ); |
| 6505 | |
| 6506 | // FIXME - Need to convert to tSirRetStatus |
| 6507 | statusCode = eSIR_FAILURE; |
| 6508 | goto returnAfterError; |
| 6509 | } |
| 6510 | else if( DOT11F_WARNED( nStatus )) |
| 6511 | { |
| 6512 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6513 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 6514 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6515 | } |
| 6516 | |
| 6517 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6518 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6519 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6520 | |
| 6521 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6522 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6523 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6524 | ) |
| 6525 | { |
| 6526 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6527 | } |
| 6528 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6529 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6530 | psessionEntry->peSessionId, |
| 6531 | pMacHdr->fc.subType)); |
| 6532 | halstatus = halTxFrame( pMac, |
| 6533 | pPacket, |
| 6534 | (tANI_U16) nBytes, |
| 6535 | HAL_TXRX_FRM_802_11_MGMT, |
| 6536 | ANI_TXDIR_TODS, |
| 6537 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6538 | limTxComplete, |
| 6539 | pFrame, txFlag ); |
| 6540 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6541 | psessionEntry->peSessionId, |
| 6542 | halstatus)); |
| 6543 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6544 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6545 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6546 | statusCode = eSIR_FAILURE; |
| 6547 | //Pkt will be freed up by the callback |
| 6548 | return statusCode; |
| 6549 | } |
| 6550 | else |
| 6551 | return eSIR_SUCCESS; |
| 6552 | |
| 6553 | returnAfterError: |
| 6554 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6555 | |
| 6556 | return statusCode; |
| 6557 | } // End limSendLinkReportActionFrame. |
| 6558 | |
| 6559 | /** |
| 6560 | * \brief Send a Beacon Report Action frame |
| 6561 | * |
| 6562 | * |
| 6563 | * \param pMac Pointer to the global MAC structure |
| 6564 | * |
| 6565 | * \param dialog_token dialog token to be used in the action frame. |
| 6566 | * |
| 6567 | * \param num_report number of reports in pRRMReport. |
| 6568 | * |
| 6569 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 6570 | * |
| 6571 | * \param peer mac address of peer station. |
| 6572 | * |
| 6573 | * \param psessionEntry address of session entry. |
| 6574 | * |
| 6575 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 6576 | * |
| 6577 | * |
| 6578 | */ |
| 6579 | |
| 6580 | tSirRetStatus |
| 6581 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 6582 | tANI_U8 dialog_token, |
| 6583 | tANI_U8 num_report, |
| 6584 | tpSirMacRadioMeasureReport pRRMReport, |
| 6585 | tSirMacAddr peer, |
| 6586 | tpPESession psessionEntry |
| 6587 | ) |
| 6588 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6589 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 6590 | tANI_U8 *pFrame; |
| 6591 | tpSirMacMgmtHdr pMacHdr; |
| 6592 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6593 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6594 | eHalStatus halstatus; |
| 6595 | tANI_U8 i; |
| 6596 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6597 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6598 | tDot11fRadioMeasurementReport *frm = |
| 6599 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 6600 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6601 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6602 | return eSIR_FAILURE; |
| 6603 | } |
| 6604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | if ( psessionEntry == NULL ) |
| 6606 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6607 | 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] | 6608 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6609 | return eSIR_FAILURE; |
| 6610 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6611 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6612 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6613 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6614 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6615 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6617 | 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] | 6618 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6619 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6621 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6622 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6623 | 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] | 6624 | switch( pRRMReport[i].type ) |
| 6625 | { |
| 6626 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6627 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6628 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6629 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6630 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | break; |
| 6632 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6633 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6634 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6635 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | break; |
| 6637 | } |
| 6638 | } |
| 6639 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6640 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | if ( DOT11F_FAILED( nStatus ) ) |
| 6642 | { |
| 6643 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6644 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6645 | nStatus ); |
| 6646 | // We'll fall back on the worst case scenario: |
| 6647 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6648 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6649 | return eSIR_FAILURE; |
| 6650 | } |
| 6651 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6652 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6653 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6655 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6656 | } |
| 6657 | |
| 6658 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6659 | |
| 6660 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6661 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6662 | { |
| 6663 | 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] | 6664 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6665 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6666 | return eSIR_FAILURE; |
| 6667 | } |
| 6668 | |
| 6669 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6670 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | |
| 6672 | // Copy necessary info to BD |
| 6673 | if( eSIR_SUCCESS != |
| 6674 | (statusCode = limPopulateMacHeader( pMac, |
| 6675 | pFrame, |
| 6676 | SIR_MAC_MGMT_FRAME, |
| 6677 | SIR_MAC_MGMT_ACTION, |
| 6678 | peer, psessionEntry->selfMacAddr))) |
| 6679 | goto returnAfterError; |
| 6680 | |
| 6681 | // Update A3 with the BSSID |
| 6682 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6683 | |
| 6684 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6685 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6686 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6687 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6688 | #endif |
| 6689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | // Now, we're ready to "pack" the frames |
| 6691 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6692 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6693 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6694 | nPayload, |
| 6695 | &nPayload ); |
| 6696 | |
| 6697 | if( DOT11F_FAILED( nStatus )) |
| 6698 | { |
| 6699 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6700 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6701 | nStatus ); |
| 6702 | |
| 6703 | // FIXME - Need to convert to tSirRetStatus |
| 6704 | statusCode = eSIR_FAILURE; |
| 6705 | goto returnAfterError; |
| 6706 | } |
| 6707 | else if( DOT11F_WARNED( nStatus )) |
| 6708 | { |
| 6709 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6710 | FL( "There were warnings while packing Radio " |
| 6711 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6712 | } |
| 6713 | |
| 6714 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6715 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6716 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6717 | |
| 6718 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6719 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6720 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6721 | ) |
| 6722 | { |
| 6723 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6724 | } |
| 6725 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6726 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6727 | psessionEntry->peSessionId, |
| 6728 | pMacHdr->fc.subType)); |
| 6729 | halstatus = halTxFrame( pMac, |
| 6730 | pPacket, |
| 6731 | (tANI_U16) nBytes, |
| 6732 | HAL_TXRX_FRM_802_11_MGMT, |
| 6733 | ANI_TXDIR_TODS, |
| 6734 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6735 | limTxComplete, |
| 6736 | pFrame, txFlag ); |
| 6737 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6738 | psessionEntry->peSessionId, |
| 6739 | halstatus)); |
| 6740 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6741 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6742 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6743 | statusCode = eSIR_FAILURE; |
| 6744 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6745 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6746 | return statusCode; |
| 6747 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6748 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6749 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6750 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6751 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6752 | |
| 6753 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6754 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6755 | 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] | 6756 | return statusCode; |
| 6757 | } // End limSendBeaconReportActionFrame. |
| 6758 | |
| 6759 | #endif |
| 6760 | |
| 6761 | #ifdef WLAN_FEATURE_11W |
| 6762 | /** |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6763 | * \brief Send SA query request action frame to peer |
| 6764 | * |
| 6765 | * \sa limSendSaQueryRequestFrame |
| 6766 | * |
| 6767 | * |
| 6768 | * \param pMac The global tpAniSirGlobal object |
| 6769 | * |
| 6770 | * \param transId Transaction identifier |
| 6771 | * |
| 6772 | * \param peer The Mac address of the station to which this action frame is addressed |
| 6773 | * |
| 6774 | * \param psessionEntry The PE session entry |
| 6775 | * |
| 6776 | * \return eSIR_SUCCESS if setup completes successfully |
| 6777 | * eSIR_FAILURE is some problem is encountered |
| 6778 | */ |
| 6779 | |
| 6780 | tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
| 6781 | tSirMacAddr peer, tpPESession psessionEntry ) |
| 6782 | { |
| 6783 | |
| 6784 | tDot11fSaQueryReq frm; // SA query request action frame |
| 6785 | tANI_U8 *pFrame; |
| 6786 | tSirRetStatus nSirStatus; |
| 6787 | tpSirMacMgmtHdr pMacHdr; |
| 6788 | tANI_U32 nBytes, nPayload, nStatus; |
| 6789 | void *pPacket; |
| 6790 | eHalStatus halstatus; |
| 6791 | tANI_U8 txFlag = 0; |
| 6792 | |
| 6793 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
| 6794 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6795 | /* 11w action field is : |
| 6796 | action: 0 --> SA Query Request action frame |
| 6797 | action: 1 --> SA Query Response action frame */ |
| 6798 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 6799 | /* 11w SA Query Request transId */ |
| 6800 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
| 6801 | |
| 6802 | nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload); |
| 6803 | if ( DOT11F_FAILED( nStatus ) ) |
| 6804 | { |
| 6805 | limLog( pMac, LOGP, FL("Failed to calculate the packed size " |
| 6806 | "for an SA Query Request (0x%08x)."), |
| 6807 | nStatus ); |
| 6808 | // We'll fall back on the worst case scenario: |
| 6809 | nPayload = sizeof( tDot11fSaQueryReq ); |
| 6810 | } |
| 6811 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6812 | { |
| 6813 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 6814 | "the packed size for an SA Query Request" |
| 6815 | " (0x%08x)."), nStatus ); |
| 6816 | } |
| 6817 | |
| 6818 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6819 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6820 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6821 | { |
| 6822 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request " |
| 6823 | "action frame"), nBytes ); |
| 6824 | return eSIR_FAILURE; |
| 6825 | } |
| 6826 | |
| 6827 | // Paranoia: |
| 6828 | vos_mem_set( pFrame, nBytes, 0 ); |
| 6829 | |
| 6830 | // Copy necessary info to BD |
| 6831 | nSirStatus = limPopulateMacHeader( pMac, |
| 6832 | pFrame, |
| 6833 | SIR_MAC_MGMT_FRAME, |
| 6834 | SIR_MAC_MGMT_ACTION, |
| 6835 | peer, psessionEntry->selfMacAddr ); |
| 6836 | if ( eSIR_SUCCESS != nSirStatus ) |
| 6837 | goto returnAfterError; |
| 6838 | |
| 6839 | // Update A3 with the BSSID |
| 6840 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6841 | |
| 6842 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6843 | |
| 6844 | // Since this is a SA Query Request, set the "protect" (aka WEP) bit |
| 6845 | // in the FC |
| 6846 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
| 6847 | |
| 6848 | // Pack 11w SA Query Request frame |
| 6849 | nStatus = dot11fPackSaQueryReq( pMac, |
| 6850 | &frm, |
| 6851 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6852 | nPayload, |
| 6853 | &nPayload ); |
| 6854 | |
| 6855 | if ( DOT11F_FAILED( nStatus )) |
| 6856 | { |
| 6857 | limLog( pMac, LOGE, |
| 6858 | FL( "Failed to pack an SA Query Request (0x%08x)." ), |
| 6859 | nStatus ); |
| 6860 | // FIXME - Need to convert to tSirRetStatus |
| 6861 | nSirStatus = eSIR_FAILURE; |
| 6862 | goto returnAfterError; |
| 6863 | } |
| 6864 | else if ( DOT11F_WARNED( nStatus )) |
| 6865 | { |
| 6866 | limLog( pMac, LOGW, |
| 6867 | FL( "There were warnings while packing SA Query Request (0x%08x)." ), |
| 6868 | nStatus); |
| 6869 | } |
| 6870 | |
| 6871 | limLog( pMac, LOG1, |
| 6872 | FL( "Sending an SA Query Request to " )); |
| 6873 | limPrintMacAddr( pMac, peer, LOG1 ); |
| 6874 | limPrintMacAddr( pMac, peer, LOGE ); |
| 6875 | limLog( pMac, LOGE, |
| 6876 | FL( "Sending an SA Query Request from " )); |
| 6877 | limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE ); |
| 6878 | |
| 6879 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
| 6880 | #ifdef WLAN_FEATURE_P2P |
| 6881 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6882 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
| 6883 | #endif |
| 6884 | ) |
| 6885 | { |
| 6886 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6887 | } |
| 6888 | |
| 6889 | halstatus = halTxFrame( pMac, |
| 6890 | pPacket, |
| 6891 | (tANI_U16) nBytes, |
| 6892 | HAL_TXRX_FRM_802_11_MGMT, |
| 6893 | ANI_TXDIR_TODS, |
| 6894 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6895 | limTxComplete, |
| 6896 | pFrame, txFlag ); |
| 6897 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
| 6898 | { |
| 6899 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6900 | nSirStatus = eSIR_FAILURE; |
| 6901 | //Pkt will be freed up by the callback |
| 6902 | return nSirStatus; |
| 6903 | } |
| 6904 | else { |
| 6905 | return eSIR_SUCCESS; |
| 6906 | } |
| 6907 | |
| 6908 | returnAfterError: |
| 6909 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6910 | return nSirStatus; |
| 6911 | } // End limSendSaQueryRequestFrame |
| 6912 | |
| 6913 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6914 | * \brief Send SA query response action frame to peer |
| 6915 | * |
| 6916 | * \sa limSendSaQueryResponseFrame |
| 6917 | * |
| 6918 | * |
| 6919 | * \param pMac The global tpAniSirGlobal object |
| 6920 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6921 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6922 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6923 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6924 | * |
| 6925 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6926 | * |
| 6927 | * \return eSIR_SUCCESS if setup completes successfully |
| 6928 | * eSIR_FAILURE is some problem is encountered |
| 6929 | */ |
| 6930 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6931 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6932 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6933 | { |
| 6934 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6935 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6936 | tANI_U8 *pFrame; |
| 6937 | tSirRetStatus nSirStatus; |
| 6938 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6939 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6940 | void *pPacket; |
| 6941 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6942 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6943 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6944 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6945 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6946 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6947 | action: 0 --> SA query request action frame |
| 6948 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6949 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6950 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6951 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6952 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6953 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6954 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6955 | if ( DOT11F_FAILED( nStatus ) ) |
| 6956 | { |
| 6957 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6958 | "or a SA Query Response (0x%08x)."), |
| 6959 | nStatus ); |
| 6960 | // We'll fall back on the worst case scenario: |
| 6961 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6962 | } |
| 6963 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6964 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6965 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6966 | "the packed size for an SA Query Response" |
| 6967 | " (0x%08x)."), nStatus ); |
| 6968 | } |
| 6969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6970 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6971 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6972 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6973 | { |
| 6974 | 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] | 6975 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6976 | return eSIR_FAILURE; |
| 6977 | } |
| 6978 | |
| 6979 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6980 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6982 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6983 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6984 | pFrame, |
| 6985 | SIR_MAC_MGMT_FRAME, |
| 6986 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6987 | peer, psessionEntry->selfMacAddr ); |
| 6988 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6989 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6991 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6992 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6993 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6994 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6995 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6996 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6997 | // in the FC |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6998 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6999 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7000 | // Pack 11w SA query response frame |
| 7001 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 7002 | &frm, |
| 7003 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 7004 | nPayload, |
| 7005 | &nPayload ); |
| 7006 | |
| 7007 | if ( DOT11F_FAILED( nStatus )) |
| 7008 | { |
| 7009 | limLog( pMac, LOGE, |
| 7010 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 7011 | nStatus ); |
| 7012 | // FIXME - Need to convert to tSirRetStatus |
| 7013 | nSirStatus = eSIR_FAILURE; |
| 7014 | goto returnAfterError; |
| 7015 | } |
| 7016 | else if ( DOT11F_WARNED( nStatus )) |
| 7017 | { |
| 7018 | limLog( pMac, LOGW, |
| 7019 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 7020 | nStatus); |
| 7021 | } |
| 7022 | |
| 7023 | limLog( pMac, LOG1, |
| 7024 | FL( "Sending a SA Query Response to " )); |
| 7025 | limPrintMacAddr( pMac, peer, LOGW ); |
| 7026 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7027 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7028 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7029 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 7030 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7031 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7032 | ) |
| 7033 | { |
| 7034 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 7035 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7036 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 7037 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 7038 | psessionEntry->peSessionId, |
| 7039 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7040 | halstatus = halTxFrame( pMac, |
| 7041 | pPacket, |
| 7042 | (tANI_U16) nBytes, |
| 7043 | HAL_TXRX_FRM_802_11_MGMT, |
| 7044 | ANI_TXDIR_TODS, |
| 7045 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 7046 | limTxComplete, |
| 7047 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 7048 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 7049 | psessionEntry->peSessionId, |
| 7050 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 7051 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7052 | { |
| 7053 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 7054 | nSirStatus = eSIR_FAILURE; |
| 7055 | //Pkt will be freed up by the callback |
| 7056 | return nSirStatus; |
| 7057 | } |
| 7058 | else { |
| 7059 | return eSIR_SUCCESS; |
| 7060 | } |
| 7061 | |
| 7062 | returnAfterError: |
| 7063 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 7064 | return nSirStatus; |
| 7065 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7066 | #endif |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 7067 | |
| 7068 | #ifdef WLAN_FEATURE_RMC |
| 7069 | tSirRetStatus |
| 7070 | limSendRMCActionFrame(tpAniSirGlobal pMac, |
| 7071 | tSirMacAddr peerMacAddr, |
| 7072 | tSirRMCInfo *pRMC, |
| 7073 | tpPESession psessionEntry) |
| 7074 | { |
| 7075 | tSirRetStatus nSirStatus; |
| 7076 | tANI_U8 *pFrame; |
| 7077 | tDot11fRMC RMC; |
| 7078 | tANI_U32 nPayload, nBytes, nStatus; |
| 7079 | tpSirMacMgmtHdr pMacHdr; |
| 7080 | void *pPacket; |
| 7081 | eHalStatus halstatus; |
| 7082 | tANI_U8 txFlag = 0; |
| 7083 | tANI_U8 MagicCode[] = { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e }; |
| 7084 | |
| 7085 | if (NULL == psessionEntry) |
| 7086 | { |
| 7087 | return eSIR_FAILURE; |
| 7088 | } |
| 7089 | |
| 7090 | vos_mem_set(( tANI_U8* )&RMC, sizeof( RMC ), 0); |
| 7091 | |
| 7092 | RMC.Action.action = pRMC->action; |
| 7093 | RMC.RMCDialogToken.token = pRMC->dialogToken; |
| 7094 | RMC.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 7095 | RMC.RMCVersion.version = SIR_MAC_RMC_VER; |
| 7096 | |
| 7097 | vos_mem_copy(&RMC.RMCOUI.oui, SIR_MAC_RMC_OUI, SIR_MAC_RMC_OUI_SIZE); |
| 7098 | vos_mem_copy(&RMC.MagicCode.magic, MagicCode, sizeof(MagicCode)); |
| 7099 | |
| 7100 | vos_mem_copy(&RMC.Ruler.mac, pRMC->mcastRuler, sizeof(tSirMacAddr)); |
| 7101 | |
| 7102 | nStatus = dot11fGetPackedRMCSize( pMac, &RMC, &nPayload ); |
| 7103 | if ( DOT11F_FAILED( nStatus ) ) |
| 7104 | { |
| 7105 | limLog( pMac, LOGE, FL("Failed to calculate the packed size for " |
| 7106 | "an RMC (0x%08x)."), |
| 7107 | nStatus ); |
| 7108 | // We'll fall back on the worst case scenario: |
| 7109 | nPayload = sizeof( tDot11fRMC ); |
| 7110 | } |
| 7111 | else if ( DOT11F_WARNED( nStatus ) ) |
| 7112 | { |
| 7113 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
| 7114 | "the packed size for an RMC Action Frame" |
| 7115 | " (0x%08x)."), nStatus ); |
| 7116 | } |
| 7117 | |
| 7118 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 7119 | |
| 7120 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 7121 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 7122 | ( void** ) &pPacket ); |
| 7123 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 7124 | { |
| 7125 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an RMC " |
| 7126 | "Action Frame."), nBytes ); |
| 7127 | return eSIR_FAILURE; |
| 7128 | } |
| 7129 | |
| 7130 | // Paranoia: |
| 7131 | vos_mem_set( pFrame, nBytes, 0 ); |
| 7132 | |
| 7133 | // Next, we fill out the buffer descriptor: |
| 7134 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 7135 | SIR_MAC_MGMT_ACTION, peerMacAddr, |
| 7136 | psessionEntry->selfMacAddr); |
| 7137 | if ( eSIR_SUCCESS != nSirStatus ) |
| 7138 | { |
| 7139 | limLog( pMac, LOGE, FL("Failed to populate the buffer descriptor " |
| 7140 | "for an RMC Action Frame (%d)."), |
| 7141 | nSirStatus ); |
| 7142 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 7143 | ( void* ) pFrame, ( void* ) pPacket ); |
| 7144 | return nSirStatus; |
| 7145 | } |
| 7146 | |
| 7147 | // Update A3 with the BSSID |
| 7148 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 7149 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 7150 | |
| 7151 | // That done, pack the struct: |
| 7152 | nStatus = dot11fPackRMC( pMac, &RMC, |
| 7153 | pFrame + sizeof(tSirMacMgmtHdr), |
| 7154 | nPayload, &nPayload ); |
| 7155 | if ( DOT11F_FAILED( nStatus ) ) |
| 7156 | { |
| 7157 | limLog( pMac, LOGE, FL("Failed to pack an RMC " |
| 7158 | "(0x%08x)."), |
| 7159 | nStatus ); |
| 7160 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, |
| 7161 | ( void* ) pPacket ); |
| 7162 | return eSIR_FAILURE; |
| 7163 | } |
| 7164 | else if ( DOT11F_WARNED( nStatus ) ) |
| 7165 | { |
| 7166 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 7167 | "an RMC (0x%08x)."), nStatus ); |
| 7168 | } |
| 7169 | |
| 7170 | limLog( pMac, LOG1, FL("Sending an RMC Action frame to " |
| 7171 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMacAddr)); |
| 7172 | |
| 7173 | /* |
| 7174 | * With this masking, RMC action frames will be sent |
| 7175 | * at self-sta rates for both 2G and 5G bands. |
| 7176 | */ |
| 7177 | txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK; |
| 7178 | |
| 7179 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 7180 | psessionEntry->peSessionId, |
| 7181 | pMacHdr->fc.subType)); |
| 7182 | // Queue RMC Action frame in high priority WQ |
| 7183 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 7184 | HAL_TXRX_FRM_802_11_MGMT, |
| 7185 | ANI_TXDIR_TODS, |
| 7186 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 7187 | limTxComplete, pFrame, txFlag ); |
| 7188 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 7189 | psessionEntry->peSessionId, |
| 7190 | halstatus)); |
| 7191 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 7192 | { |
| 7193 | limLog( pMac, LOGE, FL( "*** Could not send an RMC Action frame" |
| 7194 | " (%X) ***" ), halstatus ); |
| 7195 | //Pkt will be freed up by the callback |
| 7196 | return eSIR_FAILURE; |
| 7197 | } |
| 7198 | |
| 7199 | return eSIR_SUCCESS; |
| 7200 | |
| 7201 | } // End limSendRMCActionFrame. |
| 7202 | |
| 7203 | #endif /* WLAN_FEATURE_RMC */ |