Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 41 | |
| 42 | |
| 43 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | /* |
| 45 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 46 | * This file schBeaconGen.cc contains beacon generation related |
| 47 | * functions |
| 48 | * |
| 49 | * Author: Sandesh Goel |
| 50 | * Date: 02/25/02 |
| 51 | * History:- |
| 52 | * Date Modified by Modification Information |
| 53 | * -------------------------------------------------------------------- |
| 54 | * |
| 55 | */ |
| 56 | |
| 57 | #include "palTypes.h" |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 58 | #include "wniCfgSta.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 59 | #include "aniGlobal.h" |
| 60 | #include "sirMacProtDef.h" |
| 61 | |
| 62 | #include "limUtils.h" |
| 63 | #include "limApi.h" |
| 64 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | |
| 66 | #include "halMsgApi.h" |
| 67 | #include "cfgApi.h" |
| 68 | #include "pmmApi.h" |
| 69 | #include "schApi.h" |
| 70 | |
| 71 | #include "parserApi.h" |
| 72 | |
| 73 | #include "schDebug.h" |
| 74 | |
| 75 | // |
| 76 | // March 15, 2006 |
| 77 | // Temporarily (maybe for all of Alpha-1), assuming TIM = 0 |
| 78 | // |
| 79 | |
| 80 | const tANI_U8 P2pOui[] = {0x50, 0x6F, 0x9A, 0x9}; |
| 81 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 82 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 83 | tSirRetStatus schGetP2pIeOffset(tANI_U8 *pExtraIe, tANI_U32 extraIeLen, tANI_U16 *pP2pIeOffset) |
| 84 | { |
| 85 | tSirRetStatus status = eSIR_FAILURE; |
| 86 | *pP2pIeOffset = 0; |
| 87 | |
| 88 | // Extra IE is not present |
| 89 | if(0 == extraIeLen) |
| 90 | { |
| 91 | return status; |
| 92 | } |
| 93 | |
| 94 | // Calculate the P2P IE Offset |
| 95 | do |
| 96 | { |
| 97 | if(*pExtraIe == 0xDD) |
| 98 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 99 | if ( vos_mem_compare ( (void *)(pExtraIe+2), &P2pOui, sizeof(P2pOui) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 100 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | status = eSIR_SUCCESS; |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | (*pP2pIeOffset)++; |
| 107 | pExtraIe++; |
| 108 | }while(--extraIeLen > 0); |
| 109 | |
| 110 | return status; |
| 111 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | |
| 113 | tSirRetStatus schAppendAddnIE(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 114 | tANI_U8 *pFrame, tANI_U32 maxBeaconSize, |
| 115 | tANI_U32 *nBytes) |
| 116 | { |
| 117 | tSirRetStatus status = eSIR_FAILURE; |
| 118 | tANI_U32 present, len; |
| 119 | tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN]; |
| 120 | |
| 121 | if((status = wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, |
| 122 | &present)) != eSIR_SUCCESS) |
| 123 | { |
| 124 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG")); |
| 125 | return status; |
| 126 | } |
| 127 | |
| 128 | if(present) |
| 129 | { |
| 130 | if((status = wlan_cfgGetStrLen(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, |
| 131 | &len)) != eSIR_SUCCESS) |
| 132 | { |
| 133 | limLog(pMac, LOGP, |
| 134 | FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA length")); |
| 135 | return status; |
| 136 | } |
| 137 | |
| 138 | if(len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN && len && |
| 139 | ((len + *nBytes) <= maxBeaconSize)) |
| 140 | { |
| 141 | if((status = wlan_cfgGetStr(pMac, |
| 142 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], &len)) |
| 143 | == eSIR_SUCCESS) |
| 144 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | tANI_U8* pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], len); |
| 146 | if(pP2pIe != NULL) |
| 147 | { |
| 148 | tANI_U8 noaLen = 0; |
| 149 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 150 | //get NoA attribute stream P2P IE |
| 151 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 152 | if(noaLen) |
| 153 | { |
| 154 | if(noaLen + len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN) |
| 155 | { |
| 156 | vos_mem_copy(&addIE[len], noaStream, noaLen); |
| 157 | len += noaLen; |
| 158 | /* Update IE Len */ |
| 159 | pP2pIe[1] += noaLen; |
| 160 | } |
| 161 | else |
| 162 | { |
| 163 | limLog(pMac, LOGE, |
| 164 | FL("Not able to insert NoA because of length constraint")); |
| 165 | } |
| 166 | } |
| 167 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | vos_mem_copy(pFrame, &addIE[0], len); |
| 169 | *nBytes = *nBytes + len; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | return status; |
| 175 | } |
| 176 | |
| 177 | // -------------------------------------------------------------------- |
| 178 | /** |
| 179 | * schSetFixedBeaconFields |
| 180 | * |
| 181 | * FUNCTION: |
| 182 | * |
| 183 | * LOGIC: |
| 184 | * |
| 185 | * ASSUMPTIONS: |
| 186 | * |
| 187 | * NOTE: |
| 188 | * |
| 189 | * @param None |
| 190 | * @return None |
| 191 | */ |
| 192 | |
| 193 | tSirRetStatus schSetFixedBeaconFields(tpAniSirGlobal pMac,tpPESession psessionEntry) |
| 194 | { |
| 195 | tpAniBeaconStruct pBeacon = (tpAniBeaconStruct) |
| 196 | pMac->sch.schObject.gSchBeaconFrameBegin; |
| 197 | tpSirMacMgmtHdr mac; |
| 198 | tANI_U16 offset; |
| 199 | tANI_U8 *ptr; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 200 | tDot11fBeacon1 *pBcn1; |
| 201 | tDot11fBeacon2 *pBcn2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 202 | tANI_U32 i, nStatus, nBytes; |
| 203 | tANI_U32 wpsApEnable=0, tmp; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 204 | tDot11fIEWscProbeRes *pWscProbeRes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 205 | tANI_U8 *pExtraIe = NULL; |
| 206 | tANI_U32 extraIeLen =0; |
| 207 | tANI_U16 extraIeOffset = 0; |
| 208 | tANI_U16 p2pIeOffset = 0; |
| 209 | tSirRetStatus status = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 211 | pBcn1 = vos_mem_malloc(sizeof(tDot11fBeacon1)); |
| 212 | if ( NULL == pBcn1 ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 213 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 214 | schLog(pMac, LOGE, FL("Failed to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 215 | return eSIR_FAILURE; |
| 216 | } |
| 217 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 218 | pBcn2 = vos_mem_malloc(sizeof(tDot11fBeacon2)); |
| 219 | if ( NULL == pBcn2 ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 220 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 221 | schLog(pMac, LOGE, FL("Failed to allocate memory") ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 222 | vos_mem_free(pBcn1); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 223 | return eSIR_FAILURE; |
| 224 | } |
| 225 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 226 | pWscProbeRes = vos_mem_malloc(sizeof(tDot11fIEWscProbeRes)); |
| 227 | if ( NULL == pWscProbeRes ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 228 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 229 | schLog(pMac, LOGE, FL("Failed to allocate memory") ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 230 | vos_mem_free(pBcn1); |
| 231 | vos_mem_free(pBcn2); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 232 | return eSIR_FAILURE; |
| 233 | } |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 234 | |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 235 | PELOG1(schLog(pMac, LOG1, FL("Setting fixed beacon fields"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | |
| 237 | /* |
| 238 | * First set the fixed fields |
| 239 | */ |
| 240 | |
| 241 | // set the TFP headers |
| 242 | |
| 243 | // set the mac header |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 244 | vos_mem_set(( tANI_U8*) &pBeacon->macHdr, sizeof( tSirMacMgmtHdr ),0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 245 | mac = (tpSirMacMgmtHdr) &pBeacon->macHdr; |
| 246 | mac->fc.type = SIR_MAC_MGMT_FRAME; |
| 247 | mac->fc.subType = SIR_MAC_MGMT_BEACON; |
| 248 | |
| 249 | for (i=0; i<6; i++) |
| 250 | mac->da[i] = 0xff; |
| 251 | |
| 252 | /* Knocking out Global pMac update */ |
| 253 | /* limGetMyMacAddr(pMac, mac->sa); */ |
| 254 | /* limGetBssid(pMac, mac->bssId); */ |
| 255 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 256 | vos_mem_copy(mac->sa, psessionEntry->selfMacAddr, sizeof(psessionEntry->selfMacAddr)); |
| 257 | vos_mem_copy(mac->bssId, psessionEntry->bssId, sizeof (psessionEntry->bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 258 | |
| 259 | mac->fc.fromDS = 0; |
| 260 | mac->fc.toDS = 0; |
| 261 | |
| 262 | /* |
| 263 | * Now set the beacon body |
| 264 | */ |
| 265 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 266 | vos_mem_set(( tANI_U8*) pBcn1, sizeof( tDot11fBeacon1 ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 267 | |
| 268 | // Skip over the timestamp (it'll be updated later). |
| 269 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 270 | pBcn1->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
| 271 | PopulateDot11fCapabilities( pMac, &pBcn1->Capabilities, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | if (psessionEntry->ssidHidden) |
| 273 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 274 | pBcn1->SSID.present = 1; //rest of the fileds are 0 for hidden ssid |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 275 | } |
| 276 | else |
| 277 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 278 | PopulateDot11fSSID( pMac, &psessionEntry->ssId, &pBcn1->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | } |
| 280 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 281 | |
| 282 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &pBcn1->SuppRates,psessionEntry); |
| 283 | PopulateDot11fDSParams( pMac, &pBcn1->DSParams, psessionEntry->currentOperChannel, psessionEntry); |
| 284 | PopulateDot11fIBSSParams( pMac, &pBcn1->IBSSParams,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | |
| 286 | offset = sizeof( tAniBeaconStruct ); |
| 287 | ptr = pMac->sch.schObject.gSchBeaconFrameBegin + offset; |
| 288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 290 | && (psessionEntry->proxyProbeRspEn)) |
| 291 | { |
| 292 | /* Initialize the default IE bitmap to zero */ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 293 | vos_mem_set(( tANI_U8* )&(psessionEntry->DefProbeRspIeBitmap), (sizeof( tANI_U32 ) * 8), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 294 | |
| 295 | /* Initialize the default IE bitmap to zero */ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 296 | vos_mem_set(( tANI_U8* )&(psessionEntry->probeRespFrame), |
| 297 | sizeof(psessionEntry->probeRespFrame), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | |
| 299 | /* Can be efficiently updated whenever new IE added in Probe response in future */ |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 300 | limUpdateProbeRspTemplateIeBitmapBeacon1(pMac,pBcn1,&psessionEntry->DefProbeRspIeBitmap[0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 301 | &psessionEntry->probeRespFrame); |
| 302 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 303 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 304 | nStatus = dot11fPackBeacon1( pMac, pBcn1, ptr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | SCH_MAX_BEACON_SIZE - offset, |
| 306 | &nBytes ); |
| 307 | if ( DOT11F_FAILED( nStatus ) ) |
| 308 | { |
| 309 | schLog( pMac, LOGE, FL("Failed to packed a tDot11fBeacon1 (0x%0" |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 310 | "8x.)."), nStatus ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 311 | vos_mem_free(pBcn1); |
| 312 | vos_mem_free(pBcn2); |
| 313 | vos_mem_free(pWscProbeRes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 314 | return eSIR_FAILURE; |
| 315 | } |
| 316 | else if ( DOT11F_WARNED( nStatus ) ) |
| 317 | { |
| 318 | schLog( pMac, LOGE, FL("There were warnings while packing a tDo" |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 319 | "t11fBeacon1 (0x%08x.)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | } |
| 321 | /*changed to correct beacon corruption */ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 322 | vos_mem_set(( tANI_U8*) pBcn2, sizeof( tDot11fBeacon2 ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | pMac->sch.schObject.gSchBeaconOffsetBegin = offset + ( tANI_U16 )nBytes; |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 324 | schLog( pMac, LOG1, FL("Initialized beacon begin, offset %d"), offset ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 325 | |
| 326 | /* |
| 327 | * Initialize the 'new' fields at the end of the beacon |
| 328 | */ |
| 329 | |
| 330 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 331 | PopulateDot11fCountry( pMac, &pBcn2->Country, psessionEntry); |
| 332 | if(pBcn1->Capabilities.qos) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 334 | PopulateDot11fEDCAParamSet( pMac, &pBcn2->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | } |
| 336 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 337 | if(psessionEntry->lim11hEnable) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 339 | PopulateDot11fPowerConstraints( pMac, &pBcn2->PowerConstraints ); |
| 340 | PopulateDot11fTPCReport( pMac, &pBcn2->TPCReport, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | |
| 344 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 345 | PopulateDot11fERPInfo( pMac, &pBcn2->ERPInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 346 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 347 | if(psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 348 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 349 | PopulateDot11fHTCaps( pMac,psessionEntry, &pBcn2->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 350 | PopulateDot11fHTInfo( pMac, &pBcn2->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 352 | #ifdef WLAN_FEATURE_11AC |
| 353 | if(psessionEntry->vhtCapability) |
| 354 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 355 | limLog( pMac, LOGW, FL("Populate VHT IEs in Beacon")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 356 | PopulateDot11fVHTCaps( pMac, &pBcn2->VHTCaps ); |
| 357 | PopulateDot11fVHTOperation( pMac, &pBcn2->VHTOperation); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 358 | // we do not support multi users yet |
| 359 | //PopulateDot11fVHTExtBssLoad( pMac, &bcn2.VHTExtBssLoad); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 360 | PopulateDot11fExtCap( pMac, &pBcn2->ExtCap); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 361 | if(psessionEntry->gLimOperatingMode.present) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 362 | PopulateDot11fOperatingMode( pMac, &pBcn2->OperatingMode, psessionEntry ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 363 | } |
| 364 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 365 | |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 366 | if (psessionEntry->oxygenNwkIniFeatureEnabled && |
| 367 | (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)) { |
| 368 | if ((status = wlan_cfgGetInt(pMac, WNI_CFG_OXYGEN_NETWORK_DATA, |
| 369 | &tmp)) != eSIR_SUCCESS) |
| 370 | { |
| 371 | limLog(pMac, LOGW, FL("Unable to get WNI_CFG_OXYGEN_NETWORK_DATA")); |
| 372 | } |
| 373 | else { |
| 374 | pBcn2->OxygenNetwork.present = 1; |
| 375 | pBcn2->OxygenNetwork.data = (tmp & 0xffff); |
| 376 | } |
| 377 | } |
| 378 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 380 | &pBcn2->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | |
| 382 | if( psessionEntry->pLimStartBssReq != NULL ) |
| 383 | { |
| 384 | PopulateDot11fWPA( pMac, &psessionEntry->pLimStartBssReq->rsnIE, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 385 | &pBcn2->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 386 | PopulateDot11fRSNOpaque( pMac, &psessionEntry->pLimStartBssReq->rsnIE, |
| 387 | &pBcn2->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | if(psessionEntry->limWmeEnabled) |
| 391 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 392 | PopulateDot11fWMM( pMac, &pBcn2->WMMInfoAp, &pBcn2->WMMParams, &pBcn2->WMMCaps, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 393 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 395 | { |
| 396 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 397 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 398 | PopulateDot11fBeaconWPSIEs( pMac, &pBcn2->WscBeacon, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 399 | } |
| 400 | } |
| 401 | else |
| 402 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 403 | if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS) |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 404 | limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE ); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 405 | |
| 406 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
| 407 | |
| 408 | if (wpsApEnable) |
| 409 | { |
| 410 | PopulateDot11fWsc(pMac, &pBcn2->WscBeacon); |
| 411 | } |
| 412 | |
| 413 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 414 | { |
| 415 | PopulateDot11fWscRegistrarInfo(pMac, &pBcn2->WscBeacon); |
| 416 | pMac->lim.wscIeInfo.wscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 417 | } |
| 418 | |
| 419 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 420 | { |
| 421 | DePopulateDot11fWscRegistrarInfo(pMac, &pBcn2->WscBeacon); |
| 422 | pMac->lim.wscIeInfo.wscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 424 | } |
| 425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 427 | && (psessionEntry->proxyProbeRspEn)) |
| 428 | { |
| 429 | /* Can be efficiently updated whenever new IE added in Probe response in future */ |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 430 | limUpdateProbeRspTemplateIeBitmapBeacon2(pMac,pBcn2,&psessionEntry->DefProbeRspIeBitmap[0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 431 | &psessionEntry->probeRespFrame); |
| 432 | |
| 433 | /* update probe response WPS IE instead of beacon WPS IE |
| 434 | * */ |
| 435 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 436 | { |
| 437 | if(psessionEntry->APWPSIEs.SirWPSProbeRspIE.FieldPresent) |
| 438 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 439 | PopulateDot11fProbeResWPSIEs(pMac, pWscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 440 | } |
| 441 | else |
| 442 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 443 | pWscProbeRes->present = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 444 | } |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 445 | if(pWscProbeRes->present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | { |
| 447 | SetProbeRspIeBitmap(&psessionEntry->DefProbeRspIeBitmap[0],SIR_MAC_WPA_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 448 | vos_mem_copy((void *)&psessionEntry->probeRespFrame.WscProbeRes, |
| 449 | (void *)pWscProbeRes, |
| 450 | sizeof(tDot11fIEWscProbeRes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 451 | } |
| 452 | } |
| 453 | |
| 454 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 456 | nStatus = dot11fPackBeacon2( pMac, pBcn2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 457 | pMac->sch.schObject.gSchBeaconFrameEnd, |
| 458 | SCH_MAX_BEACON_SIZE, &nBytes ); |
| 459 | if ( DOT11F_FAILED( nStatus ) ) |
| 460 | { |
| 461 | schLog( pMac, LOGE, FL("Failed to packed a tDot11fBeacon2 (0x%0" |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 462 | "8x.)."), nStatus ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 463 | vos_mem_free(pBcn1); |
| 464 | vos_mem_free(pBcn2); |
| 465 | vos_mem_free(pWscProbeRes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 466 | return eSIR_FAILURE; |
| 467 | } |
| 468 | else if ( DOT11F_WARNED( nStatus ) ) |
| 469 | { |
| 470 | schLog( pMac, LOGE, FL("There were warnings while packing a tDo" |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 471 | "t11fBeacon2 (0x%08x.)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | } |
| 473 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 474 | pExtraIe = pMac->sch.schObject.gSchBeaconFrameEnd + nBytes; |
| 475 | extraIeOffset = nBytes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | |
| 477 | //TODO: Append additional IE here. |
| 478 | schAppendAddnIE(pMac, psessionEntry, |
| 479 | pMac->sch.schObject.gSchBeaconFrameEnd + nBytes, |
| 480 | SCH_MAX_BEACON_SIZE, &nBytes); |
| 481 | |
| 482 | pMac->sch.schObject.gSchBeaconOffsetEnd = ( tANI_U16 )nBytes; |
| 483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | extraIeLen = nBytes - extraIeOffset; |
| 485 | |
| 486 | //Get the p2p Ie Offset |
| 487 | status = schGetP2pIeOffset(pExtraIe, extraIeLen, &p2pIeOffset); |
| 488 | |
| 489 | if(eSIR_SUCCESS == status) |
| 490 | { |
| 491 | //Update the P2P Ie Offset |
| 492 | pMac->sch.schObject.p2pIeOffset = |
| 493 | pMac->sch.schObject.gSchBeaconOffsetBegin + TIM_IE_SIZE + |
| 494 | extraIeOffset + p2pIeOffset; |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | pMac->sch.schObject.p2pIeOffset = 0; |
| 499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 500 | |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 501 | schLog( pMac, LOG1, FL("Initialized beacon end, offset %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | pMac->sch.schObject.gSchBeaconOffsetEnd ); |
| 503 | |
| 504 | pMac->sch.schObject.fBeaconChanged = 1; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 505 | vos_mem_free(pBcn1); |
| 506 | vos_mem_free(pBcn2); |
| 507 | vos_mem_free(pWscProbeRes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | return eSIR_SUCCESS; |
| 509 | } |
| 510 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 511 | void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal pMac, |
| 512 | tDot11fBeacon1* beacon1, |
| 513 | tANI_U32* DefProbeRspIeBitmap, |
| 514 | tDot11fProbeResponse* prb_rsp) |
| 515 | { |
| 516 | prb_rsp->BeaconInterval = beacon1->BeaconInterval; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 517 | vos_mem_copy((void *)&prb_rsp->Capabilities, (void *)&beacon1->Capabilities, |
| 518 | sizeof(beacon1->Capabilities)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | |
| 520 | /* SSID */ |
| 521 | if(beacon1->SSID.present) |
| 522 | { |
| 523 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_SSID_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 524 | /* populating it, because probe response has to go with SSID even in hidden case */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 525 | PopulateDot11fSSID2( pMac, &prb_rsp->SSID ); |
| 526 | } |
| 527 | /* supported rates */ |
| 528 | if(beacon1->SuppRates.present) |
| 529 | { |
| 530 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_RATESET_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 531 | vos_mem_copy((void *)&prb_rsp->SuppRates, (void *)&beacon1->SuppRates, |
| 532 | sizeof(beacon1->SuppRates)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | |
| 534 | } |
| 535 | /* DS Parameter set */ |
| 536 | if(beacon1->DSParams.present) |
| 537 | { |
| 538 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_DS_PARAM_SET_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 539 | vos_mem_copy((void *)&prb_rsp->DSParams, (void *)&beacon1->DSParams, |
| 540 | sizeof(beacon1->DSParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 541 | |
| 542 | } |
| 543 | |
| 544 | /* IBSS params will not be present in the Beacons transmitted by AP */ |
| 545 | } |
| 546 | |
| 547 | void limUpdateProbeRspTemplateIeBitmapBeacon2(tpAniSirGlobal pMac, |
| 548 | tDot11fBeacon2* beacon2, |
| 549 | tANI_U32* DefProbeRspIeBitmap, |
| 550 | tDot11fProbeResponse* prb_rsp) |
| 551 | { |
| 552 | /* IBSS parameter set - will not be present in probe response tx by AP */ |
| 553 | /* country */ |
| 554 | if(beacon2->Country.present) |
| 555 | { |
| 556 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_COUNTRY_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 557 | vos_mem_copy((void *)&prb_rsp->Country, (void *)&beacon2->Country, |
| 558 | sizeof(beacon2->Country)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | |
| 560 | } |
| 561 | /* Power constraint */ |
| 562 | if(beacon2->PowerConstraints.present) |
| 563 | { |
| 564 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_PWR_CONSTRAINT_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 565 | vos_mem_copy((void *)&prb_rsp->PowerConstraints, (void *)&beacon2->PowerConstraints, |
| 566 | sizeof(beacon2->PowerConstraints)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 567 | |
| 568 | } |
| 569 | /* Channel Switch Annoouncement SIR_MAC_CHNL_SWITCH_ANN_EID */ |
| 570 | if(beacon2->ChanSwitchAnn.present) |
| 571 | { |
| 572 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_CHNL_SWITCH_ANN_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 573 | vos_mem_copy((void *)&prb_rsp->ChanSwitchAnn, (void *)&beacon2->ChanSwitchAnn, |
| 574 | sizeof(beacon2->ChanSwitchAnn)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 575 | |
| 576 | } |
| 577 | /* ERP information */ |
| 578 | if(beacon2->ERPInfo.present) |
| 579 | { |
| 580 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_ERP_INFO_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 581 | vos_mem_copy((void *)&prb_rsp->ERPInfo, (void *)&beacon2->ERPInfo, |
| 582 | sizeof(beacon2->ERPInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 583 | |
| 584 | } |
| 585 | /* Extended supported rates */ |
| 586 | if(beacon2->ExtSuppRates.present) |
| 587 | { |
| 588 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_EXTENDED_RATE_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 589 | vos_mem_copy((void *)&prb_rsp->ExtSuppRates, (void *)&beacon2->ExtSuppRates, |
| 590 | sizeof(beacon2->ExtSuppRates)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | |
| 592 | } |
| 593 | |
| 594 | /* WPA */ |
| 595 | if(beacon2->WPA.present) |
| 596 | { |
| 597 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_WPA_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 598 | vos_mem_copy((void *)&prb_rsp->WPA, (void *)&beacon2->WPA, |
| 599 | sizeof(beacon2->WPA)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | |
| 601 | } |
| 602 | |
| 603 | /* RSN */ |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 604 | if(beacon2->RSNOpaque.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 605 | { |
| 606 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_RSN_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 607 | vos_mem_copy((void *)&prb_rsp->RSNOpaque, (void *)&beacon2->RSNOpaque, |
| 608 | sizeof(beacon2->RSNOpaque)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | } |
| 610 | /* |
| 611 | // BSS load |
| 612 | if(beacon2->QBSSLoad.present) |
| 613 | { |
| 614 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_QBSS_LOAD_EID); |
| 615 | } |
| 616 | */ |
| 617 | /* EDCA Parameter set */ |
| 618 | if(beacon2->EDCAParamSet.present) |
| 619 | { |
| 620 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_EDCA_PARAM_SET_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 621 | vos_mem_copy((void *)&prb_rsp->EDCAParamSet, (void *)&beacon2->EDCAParamSet, |
| 622 | sizeof(beacon2->EDCAParamSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 623 | |
| 624 | } |
| 625 | /* Vendor specific - currently no vendor specific IEs added */ |
| 626 | /* Requested IEs - currently we are not processing this will be added later */ |
| 627 | //HT capability IE |
| 628 | if(beacon2->HTCaps.present) |
| 629 | { |
| 630 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_HT_CAPABILITIES_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 631 | vos_mem_copy((void *)&prb_rsp->HTCaps, (void *)&beacon2->HTCaps, |
| 632 | sizeof(beacon2->HTCaps)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | } |
| 634 | // HT Info IE |
| 635 | if(beacon2->HTInfo.present) |
| 636 | { |
| 637 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_HT_INFO_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 638 | vos_mem_copy((void *)&prb_rsp->HTInfo, (void *)&beacon2->HTInfo, |
| 639 | sizeof(beacon2->HTInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 640 | } |
| 641 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 642 | #ifdef WLAN_FEATURE_11AC |
| 643 | if(beacon2->VHTCaps.present) |
| 644 | { |
| 645 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_CAPABILITIES_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 646 | vos_mem_copy((void *)&prb_rsp->VHTCaps, (void *)&beacon2->VHTCaps, |
| 647 | sizeof(beacon2->VHTCaps)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 648 | } |
| 649 | if(beacon2->VHTOperation.present) |
| 650 | { |
| 651 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_OPERATION_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 652 | vos_mem_copy((void *)&prb_rsp->VHTOperation, (void *)&beacon2->VHTOperation, |
| 653 | sizeof(beacon2->VHTOperation)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 654 | } |
| 655 | if(beacon2->VHTExtBssLoad.present) |
| 656 | { |
| 657 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_EXT_BSS_LOAD_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 658 | vos_mem_copy((void *)&prb_rsp->VHTExtBssLoad, (void *)&beacon2->VHTExtBssLoad, |
| 659 | sizeof(beacon2->VHTExtBssLoad)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 660 | } |
| 661 | #endif |
| 662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 663 | //WMM IE |
| 664 | if(beacon2->WMMParams.present) |
| 665 | { |
| 666 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_WPA_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 667 | vos_mem_copy((void *)&prb_rsp->WMMParams, (void *)&beacon2->WMMParams, |
| 668 | sizeof(beacon2->WMMParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 669 | } |
| 670 | //WMM capability - most of the case won't be present |
| 671 | if(beacon2->WMMCaps.present) |
| 672 | { |
| 673 | SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_WPA_EID); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 674 | vos_mem_copy((void *)&prb_rsp->WMMCaps, (void *)&beacon2->WMMCaps, |
| 675 | sizeof(beacon2->WMMCaps)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | } |
| 679 | |
| 680 | void SetProbeRspIeBitmap(tANI_U32* IeBitmap,tANI_U32 pos) |
| 681 | { |
| 682 | tANI_U32 index,temp; |
| 683 | |
| 684 | index = pos >> 5; |
| 685 | if(index >= 8 ) |
| 686 | { |
| 687 | return; |
| 688 | } |
| 689 | temp = IeBitmap[index]; |
| 690 | |
| 691 | temp |= 1 << (pos & 0x1F); |
| 692 | |
| 693 | IeBitmap[index] = temp; |
| 694 | } |
| 695 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 696 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 697 | |
| 698 | // -------------------------------------------------------------------- |
| 699 | /** |
| 700 | * writeBeaconToMemory |
| 701 | * |
| 702 | * FUNCTION: |
| 703 | * |
| 704 | * LOGIC: |
| 705 | * |
| 706 | * ASSUMPTIONS: |
| 707 | * |
| 708 | * NOTE: |
| 709 | * |
| 710 | * @param None |
| 711 | * @param size Size of the beacon to write to memory |
| 712 | * @param length Length field of the beacon to write to memory |
| 713 | * @return None |
| 714 | */ |
| 715 | |
| 716 | void writeBeaconToMemory(tpAniSirGlobal pMac, tANI_U16 size, tANI_U16 length, tpPESession psessionEntry) |
| 717 | { |
| 718 | tANI_U16 i; |
| 719 | tpAniBeaconStruct pBeacon; |
| 720 | |
| 721 | // copy end of beacon only if length > 0 |
| 722 | if (length > 0) |
| 723 | { |
| 724 | for (i=0; i < pMac->sch.schObject.gSchBeaconOffsetEnd; i++) |
| 725 | pMac->sch.schObject.gSchBeaconFrameBegin[size++] = pMac->sch.schObject.gSchBeaconFrameEnd[i]; |
| 726 | } |
| 727 | |
| 728 | // Update the beacon length |
| 729 | pBeacon = (tpAniBeaconStruct) pMac->sch.schObject.gSchBeaconFrameBegin; |
| 730 | // Do not include the beaconLength indicator itself |
| 731 | if (length == 0) |
| 732 | { |
| 733 | pBeacon->beaconLength = 0; |
| 734 | // Dont copy entire beacon, Copy length field alone |
| 735 | size = 4; |
| 736 | } |
| 737 | else |
| 738 | pBeacon->beaconLength = (tANI_U32) size - sizeof( tANI_U32 ); |
| 739 | |
| 740 | // write size bytes from gSchBeaconFrameBegin |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 741 | PELOG2(schLog(pMac, LOG2, FL("Beacon size - %d bytes"), size);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 742 | PELOG2(sirDumpBuf(pMac, SIR_SCH_MODULE_ID, LOG2, pMac->sch.schObject.gSchBeaconFrameBegin, size);) |
| 743 | |
| 744 | if (! pMac->sch.schObject.fBeaconChanged) |
| 745 | return; |
| 746 | |
| 747 | pMac->sch.gSchGenBeacon = 1; |
| 748 | if (pMac->sch.gSchGenBeacon) |
| 749 | { |
| 750 | pMac->sch.gSchBeaconsSent++; |
| 751 | |
| 752 | // |
| 753 | // Copy beacon data to SoftMAC shared memory... |
| 754 | // Do this by sending a message to HAL |
| 755 | // |
| 756 | |
| 757 | size = (size + 3) & (~3); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 758 | if( eSIR_SUCCESS != schSendBeaconReq( pMac, pMac->sch.schObject.gSchBeaconFrameBegin, |
| 759 | size, psessionEntry)) |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 760 | PELOGE(schLog(pMac, LOGE, FL("schSendBeaconReq() returned an error (zsize %d)"), size);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 761 | else |
| 762 | { |
| 763 | pMac->sch.gSchBeaconsWritten++; |
| 764 | } |
| 765 | } |
| 766 | pMac->sch.schObject.fBeaconChanged = 0; |
| 767 | } |
| 768 | |
| 769 | // -------------------------------------------------------------------- |
| 770 | /** |
| 771 | * @function: SchProcessPreBeaconInd |
| 772 | * |
| 773 | * @brief : Process the PreBeacon Indication from the Lim |
| 774 | * |
| 775 | * ASSUMPTIONS: |
| 776 | * |
| 777 | * NOTE: |
| 778 | * |
| 779 | * @param : pMac - tpAniSirGlobal |
| 780 | * |
| 781 | * @return None |
| 782 | */ |
| 783 | |
| 784 | void |
| 785 | schProcessPreBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 786 | { |
| 787 | tpBeaconGenParams pMsg = (tpBeaconGenParams)limMsg->bodyptr; |
| 788 | tANI_U32 beaconSize = pMac->sch.schObject.gSchBeaconOffsetBegin; |
| 789 | tpPESession psessionEntry; |
| 790 | tANI_U8 sessionId; |
| 791 | |
| 792 | if((psessionEntry = peFindSessionByBssid(pMac,pMsg->bssId, &sessionId))== NULL) |
| 793 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 794 | PELOGE(schLog(pMac, LOGE, FL("session lookup fails"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 795 | goto end; |
| 796 | } |
| 797 | |
| 798 | |
| 799 | |
| 800 | // If SME is not in normal mode, no need to generate beacon |
| 801 | if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) |
| 802 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 803 | PELOGE(schLog(pMac, LOG1, FL("PreBeaconInd received in invalid state: %d"), psessionEntry->limSmeState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | goto end; |
| 805 | } |
| 806 | |
| 807 | switch(psessionEntry->limSystemRole){ |
| 808 | |
| 809 | case eLIM_STA_IN_IBSS_ROLE: |
| 810 | case eLIM_BT_AMP_AP_ROLE: |
| 811 | case eLIM_BT_AMP_STA_ROLE: |
| 812 | // generate IBSS parameter set |
| 813 | if(psessionEntry->statypeForBss == STA_ENTRY_SELF) |
| 814 | writeBeaconToMemory(pMac, (tANI_U16) beaconSize, (tANI_U16)beaconSize, psessionEntry); |
| 815 | else |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 816 | PELOGE(schLog(pMac, LOGE, FL("can not send beacon for PEER session entry"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | break; |
| 818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 819 | case eLIM_AP_ROLE:{ |
| 820 | tANI_U8 *ptr = &pMac->sch.schObject.gSchBeaconFrameBegin[pMac->sch.schObject.gSchBeaconOffsetBegin]; |
| 821 | tANI_U16 timLength = 0; |
| 822 | if(psessionEntry->statypeForBss == STA_ENTRY_SELF){ |
| 823 | pmmGenerateTIM(pMac, &ptr, &timLength, psessionEntry->dtimPeriod); |
| 824 | beaconSize += 2 + timLength; |
| 825 | writeBeaconToMemory(pMac, (tANI_U16) beaconSize, (tANI_U16)beaconSize, psessionEntry); |
| 826 | } |
| 827 | else |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 828 | PELOGE(schLog(pMac, LOGE, FL("can not send beacon for PEER session entry"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 829 | } |
| 830 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | |
| 833 | default: |
| 834 | PELOGE(schLog(pMac, LOGE, FL("Error-PE has Receive PreBeconGenIndication when System is in %d role"), |
| 835 | psessionEntry->limSystemRole);) |
| 836 | } |
| 837 | |
| 838 | end: |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 839 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | |
| 841 | } |