Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -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 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * This file sch_beacon_gen.cc contains beacon generation related |
| 30 | * functions |
| 31 | * |
| 32 | * Author: Sandesh Goel |
| 33 | * Date: 02/25/02 |
| 34 | * History:- |
| 35 | * Date Modified by Modification Information |
| 36 | * -------------------------------------------------------------------- |
| 37 | * |
| 38 | */ |
| 39 | |
| 40 | #include "cds_api.h" |
| 41 | #include "wni_cfg.h" |
| 42 | #include "ani_global.h" |
| 43 | #include "sir_mac_prot_def.h" |
| 44 | |
| 45 | #include "lim_utils.h" |
| 46 | #include "lim_api.h" |
| 47 | |
| 48 | #include "wma_if.h" |
| 49 | #include "cfg_api.h" |
| 50 | #include "sch_api.h" |
| 51 | |
| 52 | #include "parser_api.h" |
| 53 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 54 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 55 | const uint8_t p2p_oui[] = { 0x50, 0x6F, 0x9A, 0x9 }; |
| 56 | |
Jeff Johnson | aeebe65 | 2016-10-07 07:46:48 -0700 | [diff] [blame] | 57 | static tSirRetStatus sch_get_p2p_ie_offset(uint8_t *pExtraIe, |
| 58 | uint32_t extraIeLen, |
| 59 | uint16_t *pP2pIeOffset) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | { |
| 61 | tSirRetStatus status = eSIR_FAILURE; |
| 62 | *pP2pIeOffset = 0; |
| 63 | |
| 64 | /* Extra IE is not present */ |
| 65 | if (0 == extraIeLen) { |
| 66 | return status; |
| 67 | } |
| 68 | /* Calculate the P2P IE Offset */ |
| 69 | do { |
| 70 | if (*pExtraIe == 0xDD) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 71 | if (!qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | ((void *)(pExtraIe + 2), &p2p_oui, sizeof(p2p_oui))) { |
| 73 | status = eSIR_SUCCESS; |
| 74 | break; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | (*pP2pIeOffset)++; |
| 79 | pExtraIe++; |
| 80 | } while (--extraIeLen > 0); |
| 81 | |
| 82 | return status; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * sch_append_addn_ie() - adds additional IEs to frame |
| 87 | * @mac_ctx: mac global context |
| 88 | * @session: pe session pointer |
| 89 | * @frm: frame where additional IE is to be added |
| 90 | * @max_bcn_size: max beacon size |
| 91 | * @num_bytes: final size |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 92 | * @addn_ie: pointer to additional IE |
| 93 | * @addn_ielen: lenght of additional IE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 94 | * |
| 95 | * Return: status of operation |
| 96 | */ |
Jeff Johnson | aeebe65 | 2016-10-07 07:46:48 -0700 | [diff] [blame] | 97 | static tSirRetStatus |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 98 | sch_append_addn_ie(tpAniSirGlobal mac_ctx, tpPESession session, |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 99 | uint8_t *frm, uint32_t max_bcn_size, uint32_t *num_bytes, |
| 100 | uint8_t *addn_ie, uint16_t addn_ielen) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | { |
| 102 | tSirRetStatus status = eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | uint8_t add_ie[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN]; |
| 104 | uint8_t *p2p_ie = NULL; |
| 105 | uint8_t noa_len = 0; |
| 106 | uint8_t noa_strm[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 107 | bool valid_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 108 | |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 109 | valid_ie = (addn_ielen <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN && |
| 110 | addn_ielen && ((addn_ielen + *num_bytes) <= max_bcn_size)); |
| 111 | |
| 112 | if (!valid_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 113 | return status; |
| 114 | |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 115 | qdf_mem_copy(&add_ie[0], addn_ie, addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 116 | |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 117 | p2p_ie = limGetP2pIEPtr(mac_ctx, &add_ie[0], addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | if ((p2p_ie != NULL) && !mac_ctx->beacon_offload) { |
| 119 | /* get NoA attribute stream P2P IE */ |
| 120 | noa_len = lim_get_noa_attr_stream(mac_ctx, noa_strm, session); |
| 121 | if (noa_len) { |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 122 | if ((noa_len + addn_ielen) <= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 123 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN) { |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 124 | qdf_mem_copy(&add_ie[addn_ielen], noa_strm, |
| 125 | noa_len); |
| 126 | addn_ielen += noa_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | p2p_ie[1] += noa_len; |
| 128 | } else { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 129 | pe_err("Not able to insert NoA because of length constraint"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 130 | } |
| 131 | } |
| 132 | } |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 133 | if (addn_ielen <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN) { |
| 134 | qdf_mem_copy(frm, &add_ie[0], addn_ielen); |
| 135 | *num_bytes = *num_bytes + addn_ielen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 136 | } else { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 137 | pe_warn("Not able to insert because of len constraint %d", |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 138 | addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 139 | } |
| 140 | return status; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * sch_set_fixed_beacon_fields() - sets the fixed params in beacon frame |
| 145 | * @mac_ctx: mac global context |
| 146 | * @session: pe session entry |
| 147 | * @band: out param, band caclculated |
| 148 | * @opr_ch: operating channels |
| 149 | * |
| 150 | * Return: status of operation |
| 151 | */ |
| 152 | |
| 153 | tSirRetStatus |
| 154 | sch_set_fixed_beacon_fields(tpAniSirGlobal mac_ctx, tpPESession session) |
| 155 | { |
| 156 | tpAniBeaconStruct bcn_struct = (tpAniBeaconStruct) |
| 157 | session->pSchBeaconFrameBegin; |
| 158 | tpSirMacMgmtHdr mac; |
| 159 | uint16_t offset; |
| 160 | uint8_t *ptr; |
| 161 | tDot11fBeacon1 *bcn_1; |
| 162 | tDot11fBeacon2 *bcn_2; |
| 163 | uint32_t i, n_status, n_bytes; |
| 164 | uint32_t wps_ap_enable = 0, tmp; |
| 165 | tDot11fIEWscProbeRes *wsc_prb_res; |
| 166 | uint8_t *extra_ie = NULL; |
| 167 | uint32_t extra_ie_len = 0; |
| 168 | uint16_t extra_ie_offset = 0; |
| 169 | uint16_t p2p_ie_offset = 0; |
| 170 | tSirRetStatus status = eSIR_SUCCESS; |
| 171 | bool is_vht_enabled = false; |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 172 | uint16_t addn_ielen = 0; |
| 173 | uint8_t *addn_ie = NULL; |
| 174 | tDot11fIEExtCap extracted_extcap; |
| 175 | bool extcap_present = true, addnie_present = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 177 | bcn_1 = qdf_mem_malloc(sizeof(tDot11fBeacon1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | if (NULL == bcn_1) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 179 | pe_err("Failed to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 180 | return eSIR_MEM_ALLOC_FAILED; |
| 181 | } |
| 182 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 183 | bcn_2 = qdf_mem_malloc(sizeof(tDot11fBeacon2)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | if (NULL == bcn_2) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 185 | pe_err("Failed to allocate memory"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 186 | qdf_mem_free(bcn_1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 187 | return eSIR_MEM_ALLOC_FAILED; |
| 188 | } |
| 189 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 190 | wsc_prb_res = qdf_mem_malloc(sizeof(tDot11fIEWscProbeRes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 191 | if (NULL == wsc_prb_res) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 192 | pe_err("Failed to allocate memory"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 193 | qdf_mem_free(bcn_1); |
| 194 | qdf_mem_free(bcn_2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 195 | return eSIR_MEM_ALLOC_FAILED; |
| 196 | } |
| 197 | |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 198 | pe_debug("Setting fixed beacon fields"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | |
| 200 | /* |
| 201 | * First set the fixed fields: |
| 202 | * set the TFP headers, set the mac header |
| 203 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 204 | qdf_mem_set((uint8_t *) &bcn_struct->macHdr, sizeof(tSirMacMgmtHdr), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 205 | mac = (tpSirMacMgmtHdr) &bcn_struct->macHdr; |
| 206 | mac->fc.type = SIR_MAC_MGMT_FRAME; |
| 207 | mac->fc.subType = SIR_MAC_MGMT_BEACON; |
| 208 | |
| 209 | for (i = 0; i < 6; i++) |
| 210 | mac->da[i] = 0xff; |
| 211 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 212 | qdf_mem_copy(mac->sa, session->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 213 | sizeof(session->selfMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 214 | qdf_mem_copy(mac->bssId, session->bssId, sizeof(session->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 215 | |
| 216 | mac->fc.fromDS = 0; |
| 217 | mac->fc.toDS = 0; |
| 218 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 219 | /* Skip over the timestamp (it'll be updated later). */ |
| 220 | bcn_1->BeaconInterval.interval = |
Agrawal Ashish | 18361c5 | 2016-08-18 13:42:42 +0530 | [diff] [blame] | 221 | session->beaconParams.beaconInterval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 222 | populate_dot11f_capabilities(mac_ctx, &bcn_1->Capabilities, session); |
| 223 | if (session->ssidHidden) { |
| 224 | bcn_1->SSID.present = 1; |
| 225 | /* rest of the fileds are 0 for hidden ssid */ |
| 226 | if ((session->ssId.length) && |
| 227 | (session->ssidHidden == eHIDDEN_SSID_ZERO_CONTENTS)) |
| 228 | bcn_1->SSID.num_ssid = session->ssId.length; |
| 229 | } else { |
| 230 | populate_dot11f_ssid(mac_ctx, &session->ssId, &bcn_1->SSID); |
| 231 | } |
| 232 | |
| 233 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 234 | &bcn_1->SuppRates, session); |
| 235 | populate_dot11f_ds_params(mac_ctx, &bcn_1->DSParams, |
| 236 | session->currentOperChannel); |
| 237 | populate_dot11f_ibss_params(mac_ctx, &bcn_1->IBSSParams, session); |
| 238 | |
| 239 | offset = sizeof(tAniBeaconStruct); |
| 240 | ptr = session->pSchBeaconFrameBegin + offset; |
| 241 | |
| 242 | if (LIM_IS_AP_ROLE(session)) { |
| 243 | /* Initialize the default IE bitmap to zero */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 244 | qdf_mem_set((uint8_t *) &(session->DefProbeRspIeBitmap), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | (sizeof(uint32_t) * 8), 0); |
| 246 | |
| 247 | /* Initialize the default IE bitmap to zero */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 248 | qdf_mem_set((uint8_t *) &(session->probeRespFrame), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 249 | sizeof(session->probeRespFrame), 0); |
| 250 | |
| 251 | /* |
| 252 | * Can be efficiently updated whenever new IE added in Probe |
| 253 | * response in future |
| 254 | */ |
| 255 | if (lim_update_probe_rsp_template_ie_bitmap_beacon1(mac_ctx, |
| 256 | bcn_1, session) != eSIR_SUCCESS) |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 257 | pe_err("Failed to build ProbeRsp template"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | n_status = dot11f_pack_beacon1(mac_ctx, bcn_1, ptr, |
| 261 | SCH_MAX_BEACON_SIZE - offset, &n_bytes); |
| 262 | if (DOT11F_FAILED(n_status)) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 263 | pe_err("Failed to packed a tDot11fBeacon1 (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 264 | n_status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 265 | qdf_mem_free(bcn_1); |
| 266 | qdf_mem_free(bcn_2); |
| 267 | qdf_mem_free(wsc_prb_res); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | return eSIR_FAILURE; |
| 269 | } else if (DOT11F_WARNED(n_status)) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 270 | pe_warn("Warnings while packing a tDot11fBeacon1(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 271 | n_status); |
| 272 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 273 | session->schBeaconOffsetBegin = offset + (uint16_t) n_bytes; |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 274 | pe_debug("Initialized beacon begin, offset %d", offset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 275 | |
| 276 | /* Initialize the 'new' fields at the end of the beacon */ |
| 277 | |
| 278 | if ((session->limSystemRole == eLIM_AP_ROLE) && |
Chandrasekaran, Manishekar | abc98d1 | 2016-02-04 10:25:27 +0530 | [diff] [blame] | 279 | session->dfsIncludeChanSwIe == true) { |
gaolez | 76d2a16 | 2017-03-21 19:23:58 +0800 | [diff] [blame^] | 280 | if (!CHAN_HOP_ALL_BANDS_ENABLE || |
| 281 | session->lim_non_ecsa_cap_num == 0) { |
| 282 | populate_dot_11_f_ext_chann_switch_ann(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | &bcn_2->ext_chan_switch_ann, |
| 284 | session); |
gaolez | 76d2a16 | 2017-03-21 19:23:58 +0800 | [diff] [blame^] | 285 | pe_info("ecsa: mode:%d reg:%d chan:%d count:%d", |
| 286 | bcn_2->ext_chan_switch_ann.switch_mode, |
| 287 | bcn_2->ext_chan_switch_ann.new_reg_class, |
| 288 | bcn_2->ext_chan_switch_ann.new_channel, |
| 289 | bcn_2->ext_chan_switch_ann.switch_count); |
| 290 | } |
Chandrasekaran, Manishekar | abc98d1 | 2016-02-04 10:25:27 +0530 | [diff] [blame] | 291 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 292 | |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 293 | populate_dot11_supp_operating_classes(mac_ctx, |
| 294 | &bcn_2->SuppOperatingClasses, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | populate_dot11f_country(mac_ctx, &bcn_2->Country, session); |
| 296 | if (bcn_1->Capabilities.qos) |
| 297 | populate_dot11f_edca_param_set(mac_ctx, &bcn_2->EDCAParamSet, |
| 298 | session); |
| 299 | |
| 300 | if (session->lim11hEnable) { |
| 301 | populate_dot11f_power_constraints(mac_ctx, |
| 302 | &bcn_2->PowerConstraints); |
| 303 | populate_dot11f_tpc_report(mac_ctx, &bcn_2->TPCReport, session); |
| 304 | /* Need to insert channel switch announcement here */ |
| 305 | if ((LIM_IS_AP_ROLE(session) |
| 306 | || LIM_IS_P2P_DEVICE_GO(session)) |
| 307 | && session->dfsIncludeChanSwIe == true) { |
| 308 | /* |
| 309 | * Channel switch announcement only if radar is detected |
| 310 | * and SAP has instructed to announce channel switch IEs |
| 311 | * in beacon and probe responses |
| 312 | */ |
gaolez | 76d2a16 | 2017-03-21 19:23:58 +0800 | [diff] [blame^] | 313 | if (!CHAN_HOP_ALL_BANDS_ENABLE || |
| 314 | session->lim_non_ecsa_cap_num > 0) { |
| 315 | populate_dot11f_chan_switch_ann(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 316 | &bcn_2->ChanSwitchAnn, session); |
gaolez | 76d2a16 | 2017-03-21 19:23:58 +0800 | [diff] [blame^] | 317 | pe_debug("csa: mode:%d chan:%d count:%d", |
| 318 | bcn_2->ChanSwitchAnn.switchMode, |
| 319 | bcn_2->ChanSwitchAnn.newChannel, |
| 320 | bcn_2->ChanSwitchAnn.switchCount); |
| 321 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 322 | /* |
| 323 | * TODO: depending the CB mode, extended channel switch |
| 324 | * announcement need to be called |
| 325 | */ |
| 326 | /* |
| 327 | populate_dot11f_ext_chan_switch_ann(mac_ctx, |
| 328 | &bcn_2->ExtChanSwitchAnn, session); |
| 329 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 330 | /* |
| 331 | * TODO: If in 11AC mode, wider bw channel switch |
| 332 | * announcement needs to be called |
| 333 | */ |
| 334 | /* |
| 335 | populate_dot11f_wider_bw_chan_switch_ann(mac_ctx, |
| 336 | &bcn_2->WiderBWChanSwitchAnn, session); |
| 337 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 338 | /* |
| 339 | * Populate the Channel Switch Wrapper Element if |
| 340 | * SAP operates in 40/80 Mhz Channel Width. |
| 341 | */ |
Chandrasekaran, Manishekar | abc98d1 | 2016-02-04 10:25:27 +0530 | [diff] [blame] | 342 | if (true == session->dfsIncludeChanWrapperIe) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 343 | populate_dot11f_chan_switch_wrapper(mac_ctx, |
| 344 | &bcn_2->ChannelSwitchWrapper, session); |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 345 | pe_debug("wrapper: width:%d f0:%d f1:%d", |
Chandrasekaran, Manishekar | abc98d1 | 2016-02-04 10:25:27 +0530 | [diff] [blame] | 346 | bcn_2->ChannelSwitchWrapper. |
| 347 | WiderBWChanSwitchAnn.newChanWidth, |
| 348 | bcn_2->ChannelSwitchWrapper. |
| 349 | WiderBWChanSwitchAnn.newCenterChanFreq0, |
| 350 | bcn_2->ChannelSwitchWrapper. |
| 351 | WiderBWChanSwitchAnn.newCenterChanFreq1 |
| 352 | ); |
| 353 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 354 | } |
| 355 | } |
| 356 | |
| 357 | #ifdef FEATURE_AP_MCC_CH_AVOIDANCE |
| 358 | /* populate proprietary IE for MDM device operating in AP-MCC */ |
| 359 | populate_dot11f_avoid_channel_ie(mac_ctx, &bcn_2->QComVendorIE, |
| 360 | session); |
| 361 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 362 | |
| 363 | if (session->dot11mode != WNI_CFG_DOT11_MODE_11B) |
| 364 | populate_dot11f_erp_info(mac_ctx, &bcn_2->ERPInfo, session); |
| 365 | |
| 366 | if (session->htCapability) { |
| 367 | populate_dot11f_ht_caps(mac_ctx, session, &bcn_2->HTCaps); |
| 368 | populate_dot11f_ht_info(mac_ctx, &bcn_2->HTInfo, session); |
| 369 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 370 | if (session->vhtCapability) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 371 | pe_debug("Populate VHT IEs in Beacon"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | populate_dot11f_vht_caps(mac_ctx, session, &bcn_2->VHTCaps); |
| 373 | populate_dot11f_vht_operation(mac_ctx, session, |
| 374 | &bcn_2->VHTOperation); |
| 375 | is_vht_enabled = true; |
| 376 | /* following is for MU MIMO: we do not support it yet */ |
| 377 | /* |
| 378 | populate_dot11f_vht_ext_bss_load( mac_ctx, &bcn2.VHTExtBssLoad); |
| 379 | */ |
| 380 | if (session->gLimOperatingMode.present) |
| 381 | populate_dot11f_operating_mode(mac_ctx, |
| 382 | &bcn_2->OperatingMode, session); |
| 383 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 384 | |
| 385 | if (lim_is_session_he_capable(session)) { |
Srinivas Girigowda | 817a918 | 2017-03-19 21:39:48 -0700 | [diff] [blame] | 386 | pe_warn("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 387 | populate_dot11f_he_caps(mac_ctx, session, |
| 388 | &bcn_2->vendor_he_cap); |
| 389 | populate_dot11f_he_operation(mac_ctx, session, |
| 390 | &bcn_2->vendor_he_op); |
Peng Xu | 6363ec6 | 2017-05-15 11:06:33 -0700 | [diff] [blame] | 391 | populate_dot11f_he_bss_color_change(mac_ctx, session, |
| 392 | &bcn_2->bss_color_change); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 393 | } |
| 394 | |
Selvaraj, Sridhar | 35cc2cf | 2016-06-25 17:01:52 +0530 | [diff] [blame] | 395 | if (session->limSystemRole != eLIM_STA_IN_IBSS_ROLE) |
| 396 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &bcn_2->ExtCap, |
| 397 | session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 398 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 399 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 400 | &bcn_2->ExtSuppRates, session); |
| 401 | |
| 402 | if (session->pLimStartBssReq != NULL) { |
| 403 | populate_dot11f_wpa(mac_ctx, &session->pLimStartBssReq->rsnIE, |
| 404 | &bcn_2->WPA); |
| 405 | populate_dot11f_rsn_opaque(mac_ctx, |
| 406 | &session->pLimStartBssReq->rsnIE, |
| 407 | &bcn_2->RSNOpaque); |
| 408 | } |
| 409 | |
| 410 | if (session->limWmeEnabled) |
| 411 | populate_dot11f_wmm(mac_ctx, &bcn_2->WMMInfoAp, |
| 412 | &bcn_2->WMMParams, &bcn_2->WMMCaps, session); |
| 413 | if (LIM_IS_AP_ROLE(session)) { |
| 414 | if (session->wps_state != SAP_WPS_DISABLED) { |
| 415 | populate_dot11f_beacon_wpsi_es(mac_ctx, |
| 416 | &bcn_2->WscBeacon, session); |
| 417 | } |
| 418 | } else { |
| 419 | if (wlan_cfg_get_int(mac_ctx, |
| 420 | (uint16_t) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS) |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 421 | pe_err("Failed to cfg get id %d", WNI_CFG_WPS_ENABLE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | |
| 423 | wps_ap_enable = tmp & WNI_CFG_WPS_ENABLE_AP; |
| 424 | |
| 425 | if (wps_ap_enable) |
| 426 | populate_dot11f_wsc(mac_ctx, &bcn_2->WscBeacon); |
| 427 | |
| 428 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 429 | eLIM_WSC_ENROLL_BEGIN) { |
| 430 | populate_dot11f_wsc_registrar_info(mac_ctx, |
| 431 | &bcn_2->WscBeacon); |
| 432 | mac_ctx->lim.wscIeInfo.wscEnrollmentState = |
| 433 | eLIM_WSC_ENROLL_IN_PROGRESS; |
| 434 | } |
| 435 | |
| 436 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 437 | eLIM_WSC_ENROLL_END) { |
| 438 | de_populate_dot11f_wsc_registrar_info(mac_ctx, |
| 439 | &bcn_2->WscBeacon); |
| 440 | mac_ctx->lim.wscIeInfo.wscEnrollmentState = |
| 441 | eLIM_WSC_ENROLL_NOOP; |
| 442 | } |
| 443 | } |
| 444 | |
Srinivas Girigowda | f326dfe | 2017-08-03 11:28:32 -0700 | [diff] [blame] | 445 | if (LIM_IS_AP_ROLE(session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 446 | /* |
| 447 | * Can be efficiently updated whenever new IE added in Probe |
| 448 | * response in future |
| 449 | */ |
| 450 | lim_update_probe_rsp_template_ie_bitmap_beacon2(mac_ctx, bcn_2, |
| 451 | &session->DefProbeRspIeBitmap[0], |
| 452 | &session->probeRespFrame); |
| 453 | |
| 454 | /* update probe response WPS IE instead of beacon WPS IE */ |
| 455 | if (session->wps_state != SAP_WPS_DISABLED) { |
| 456 | if (session->APWPSIEs.SirWPSProbeRspIE.FieldPresent) |
| 457 | populate_dot11f_probe_res_wpsi_es(mac_ctx, |
| 458 | wsc_prb_res, session); |
| 459 | else |
| 460 | wsc_prb_res->present = 0; |
| 461 | if (wsc_prb_res->present) { |
| 462 | set_probe_rsp_ie_bitmap( |
| 463 | &session->DefProbeRspIeBitmap[0], |
| 464 | SIR_MAC_WPA_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 465 | qdf_mem_copy((void *) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 466 | &session->probeRespFrame.WscProbeRes, |
| 467 | (void *)wsc_prb_res, |
| 468 | sizeof(tDot11fIEWscProbeRes)); |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | } |
| 473 | |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 474 | addnie_present = (session->addIeParams.probeRespBCNDataLen != 0); |
| 475 | if (addnie_present) { |
| 476 | addn_ielen = session->addIeParams.probeRespBCNDataLen; |
| 477 | addn_ie = qdf_mem_malloc(addn_ielen); |
| 478 | if (!addn_ie) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 479 | pe_err("addn_ie malloc failed"); |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 480 | qdf_mem_free(bcn_1); |
| 481 | qdf_mem_free(bcn_2); |
| 482 | qdf_mem_free(wsc_prb_res); |
| 483 | return eSIR_MEM_ALLOC_FAILED; |
| 484 | } |
| 485 | qdf_mem_copy(addn_ie, |
| 486 | session->addIeParams.probeRespBCNData_buff, |
| 487 | addn_ielen); |
| 488 | |
| 489 | qdf_mem_zero((uint8_t *)&extracted_extcap, |
| 490 | sizeof(tDot11fIEExtCap)); |
| 491 | status = lim_strip_extcap_update_struct(mac_ctx, addn_ie, |
| 492 | &addn_ielen, &extracted_extcap); |
| 493 | if (eSIR_SUCCESS != status) { |
| 494 | extcap_present = false; |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 495 | pe_debug("extcap not extracted"); |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 496 | } |
| 497 | /* merge extcap IE */ |
Selvaraj, Sridhar | 35cc2cf | 2016-06-25 17:01:52 +0530 | [diff] [blame] | 498 | if (extcap_present && |
| 499 | session->limSystemRole != eLIM_STA_IN_IBSS_ROLE) |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 500 | lim_merge_extcap_struct(&bcn_2->ExtCap, |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 501 | &extracted_extcap, |
| 502 | true); |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 503 | |
| 504 | } |
| 505 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 506 | n_status = dot11f_pack_beacon2(mac_ctx, bcn_2, |
| 507 | session->pSchBeaconFrameEnd, |
| 508 | SCH_MAX_BEACON_SIZE, &n_bytes); |
| 509 | if (DOT11F_FAILED(n_status)) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 510 | pe_err("Failed to packed a tDot11fBeacon2 (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 511 | n_status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 512 | qdf_mem_free(bcn_1); |
| 513 | qdf_mem_free(bcn_2); |
| 514 | qdf_mem_free(wsc_prb_res); |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 515 | qdf_mem_free(addn_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 516 | return eSIR_FAILURE; |
| 517 | } else if (DOT11F_WARNED(n_status)) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 518 | pe_err("Warnings while packing a tDot11fBeacon2(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 519 | n_status); |
| 520 | } |
| 521 | |
| 522 | extra_ie = session->pSchBeaconFrameEnd + n_bytes; |
| 523 | extra_ie_offset = n_bytes; |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 524 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 525 | /* TODO: Append additional IE here. */ |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 526 | if (addn_ielen > 0) |
| 527 | sch_append_addn_ie(mac_ctx, session, |
| 528 | session->pSchBeaconFrameEnd + n_bytes, |
| 529 | SCH_MAX_BEACON_SIZE, &n_bytes, addn_ie, addn_ielen); |
| 530 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 531 | session->schBeaconOffsetEnd = (uint16_t) n_bytes; |
| 532 | extra_ie_len = n_bytes - extra_ie_offset; |
| 533 | /* Get the p2p Ie Offset */ |
| 534 | status = sch_get_p2p_ie_offset(extra_ie, extra_ie_len, &p2p_ie_offset); |
| 535 | if (eSIR_SUCCESS == status) |
| 536 | /* Update the P2P Ie Offset */ |
| 537 | mac_ctx->sch.schObject.p2pIeOffset = |
| 538 | session->schBeaconOffsetBegin + TIM_IE_SIZE + |
| 539 | extra_ie_offset + p2p_ie_offset; |
| 540 | else |
| 541 | mac_ctx->sch.schObject.p2pIeOffset = 0; |
| 542 | |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 543 | pe_debug("Initialized beacon end, offset %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 544 | session->schBeaconOffsetEnd); |
| 545 | mac_ctx->sch.schObject.fBeaconChanged = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 546 | qdf_mem_free(bcn_1); |
| 547 | qdf_mem_free(bcn_2); |
| 548 | qdf_mem_free(wsc_prb_res); |
Krishna Kumaar Natarajan | 164e6b0 | 2015-12-17 15:19:09 -0800 | [diff] [blame] | 549 | qdf_mem_free(addn_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 550 | return eSIR_SUCCESS; |
| 551 | } |
| 552 | |
| 553 | tSirRetStatus lim_update_probe_rsp_template_ie_bitmap_beacon1(tpAniSirGlobal pMac, |
| 554 | tDot11fBeacon1 *beacon1, |
| 555 | tpPESession |
| 556 | psessionEntry) |
| 557 | { |
| 558 | uint32_t *DefProbeRspIeBitmap; |
| 559 | tDot11fProbeResponse *prb_rsp; |
| 560 | if (!psessionEntry) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 561 | pe_debug("PESession is null!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 562 | return eSIR_FAILURE; |
| 563 | } |
| 564 | DefProbeRspIeBitmap = &psessionEntry->DefProbeRspIeBitmap[0]; |
| 565 | prb_rsp = &psessionEntry->probeRespFrame; |
| 566 | prb_rsp->BeaconInterval = beacon1->BeaconInterval; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 567 | qdf_mem_copy((void *)&prb_rsp->Capabilities, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 568 | (void *)&beacon1->Capabilities, |
| 569 | sizeof(beacon1->Capabilities)); |
| 570 | |
| 571 | /* SSID */ |
| 572 | if (beacon1->SSID.present) { |
| 573 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_SSID_EID); |
| 574 | /* populating it, because probe response has to go with SSID even in hidden case */ |
| 575 | populate_dot11f_ssid(pMac, &psessionEntry->ssId, &prb_rsp->SSID); |
| 576 | } |
| 577 | /* supported rates */ |
| 578 | if (beacon1->SuppRates.present) { |
| 579 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_RATESET_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 580 | qdf_mem_copy((void *)&prb_rsp->SuppRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 581 | (void *)&beacon1->SuppRates, |
| 582 | sizeof(beacon1->SuppRates)); |
| 583 | |
| 584 | } |
| 585 | /* DS Parameter set */ |
| 586 | if (beacon1->DSParams.present) { |
| 587 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 588 | SIR_MAC_DS_PARAM_SET_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 589 | qdf_mem_copy((void *)&prb_rsp->DSParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 590 | (void *)&beacon1->DSParams, |
| 591 | sizeof(beacon1->DSParams)); |
| 592 | |
| 593 | } |
| 594 | |
| 595 | /* IBSS params will not be present in the Beacons transmitted by AP */ |
| 596 | return eSIR_SUCCESS; |
| 597 | } |
| 598 | |
| 599 | void lim_update_probe_rsp_template_ie_bitmap_beacon2(tpAniSirGlobal pMac, |
| 600 | tDot11fBeacon2 *beacon2, |
| 601 | uint32_t *DefProbeRspIeBitmap, |
| 602 | tDot11fProbeResponse *prb_rsp) |
| 603 | { |
| 604 | /* IBSS parameter set - will not be present in probe response tx by AP */ |
| 605 | /* country */ |
| 606 | if (beacon2->Country.present) { |
| 607 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_COUNTRY_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 608 | qdf_mem_copy((void *)&prb_rsp->Country, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | (void *)&beacon2->Country, |
| 610 | sizeof(beacon2->Country)); |
| 611 | |
| 612 | } |
| 613 | /* Power constraint */ |
| 614 | if (beacon2->PowerConstraints.present) { |
| 615 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 616 | SIR_MAC_PWR_CONSTRAINT_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 617 | qdf_mem_copy((void *)&prb_rsp->PowerConstraints, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 618 | (void *)&beacon2->PowerConstraints, |
| 619 | sizeof(beacon2->PowerConstraints)); |
| 620 | |
| 621 | } |
| 622 | /* Channel Switch Annoouncement SIR_MAC_CHNL_SWITCH_ANN_EID */ |
| 623 | if (beacon2->ChanSwitchAnn.present) { |
| 624 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 625 | SIR_MAC_CHNL_SWITCH_ANN_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 626 | qdf_mem_copy((void *)&prb_rsp->ChanSwitchAnn, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 627 | (void *)&beacon2->ChanSwitchAnn, |
| 628 | sizeof(beacon2->ChanSwitchAnn)); |
| 629 | |
| 630 | } |
| 631 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 632 | /* EXT Channel Switch Announcement CHNL_EXTENDED_SWITCH_ANN_EID*/ |
| 633 | if (beacon2->ext_chan_switch_ann.present) { |
| 634 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 635 | SIR_MAC_CHNL_EXTENDED_SWITCH_ANN_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 636 | qdf_mem_copy((void *)&prb_rsp->ext_chan_switch_ann, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 637 | (void *)&beacon2->ext_chan_switch_ann, |
| 638 | sizeof(beacon2->ext_chan_switch_ann)); |
| 639 | } |
| 640 | |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 641 | /* Supported operating class */ |
| 642 | if (beacon2->SuppOperatingClasses.present) { |
| 643 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 644 | SIR_MAC_OPERATING_CLASS_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 645 | qdf_mem_copy((void *)&prb_rsp->SuppOperatingClasses, |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 646 | (void *)&beacon2->SuppOperatingClasses, |
| 647 | sizeof(beacon2->SuppOperatingClasses)); |
| 648 | } |
| 649 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 650 | #ifdef FEATURE_AP_MCC_CH_AVOIDANCE |
| 651 | if (beacon2->QComVendorIE.present) { |
| 652 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 653 | SIR_MAC_QCOM_VENDOR_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 654 | qdf_mem_copy((void *)&prb_rsp->QComVendorIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 655 | (void *)&beacon2->QComVendorIE, |
| 656 | sizeof(beacon2->QComVendorIE)); |
| 657 | } |
| 658 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 659 | |
| 660 | /* ERP information */ |
| 661 | if (beacon2->ERPInfo.present) { |
| 662 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_ERP_INFO_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 663 | qdf_mem_copy((void *)&prb_rsp->ERPInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 664 | (void *)&beacon2->ERPInfo, |
| 665 | sizeof(beacon2->ERPInfo)); |
| 666 | |
| 667 | } |
| 668 | /* Extended supported rates */ |
| 669 | if (beacon2->ExtSuppRates.present) { |
| 670 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 671 | SIR_MAC_EXTENDED_RATE_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 672 | qdf_mem_copy((void *)&prb_rsp->ExtSuppRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 673 | (void *)&beacon2->ExtSuppRates, |
| 674 | sizeof(beacon2->ExtSuppRates)); |
| 675 | |
| 676 | } |
| 677 | |
| 678 | /* WPA */ |
| 679 | if (beacon2->WPA.present) { |
| 680 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_WPA_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 681 | qdf_mem_copy((void *)&prb_rsp->WPA, (void *)&beacon2->WPA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 682 | sizeof(beacon2->WPA)); |
| 683 | |
| 684 | } |
| 685 | |
| 686 | /* RSN */ |
| 687 | if (beacon2->RSNOpaque.present) { |
| 688 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_RSN_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 689 | qdf_mem_copy((void *)&prb_rsp->RSNOpaque, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 690 | (void *)&beacon2->RSNOpaque, |
| 691 | sizeof(beacon2->RSNOpaque)); |
| 692 | } |
| 693 | |
| 694 | /* EDCA Parameter set */ |
| 695 | if (beacon2->EDCAParamSet.present) { |
| 696 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 697 | SIR_MAC_EDCA_PARAM_SET_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 698 | qdf_mem_copy((void *)&prb_rsp->EDCAParamSet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 699 | (void *)&beacon2->EDCAParamSet, |
| 700 | sizeof(beacon2->EDCAParamSet)); |
| 701 | |
| 702 | } |
| 703 | /* Vendor specific - currently no vendor specific IEs added */ |
| 704 | /* Requested IEs - currently we are not processing this will be added later */ |
| 705 | /* HT capability IE */ |
| 706 | if (beacon2->HTCaps.present) { |
| 707 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 708 | SIR_MAC_HT_CAPABILITIES_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 709 | qdf_mem_copy((void *)&prb_rsp->HTCaps, (void *)&beacon2->HTCaps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 710 | sizeof(beacon2->HTCaps)); |
| 711 | } |
| 712 | /* HT Info IE */ |
| 713 | if (beacon2->HTInfo.present) { |
| 714 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_HT_INFO_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 715 | qdf_mem_copy((void *)&prb_rsp->HTInfo, (void *)&beacon2->HTInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 716 | sizeof(beacon2->HTInfo)); |
| 717 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 718 | if (beacon2->VHTCaps.present) { |
| 719 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 720 | SIR_MAC_VHT_CAPABILITIES_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 721 | qdf_mem_copy((void *)&prb_rsp->VHTCaps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 722 | (void *)&beacon2->VHTCaps, |
| 723 | sizeof(beacon2->VHTCaps)); |
| 724 | } |
| 725 | if (beacon2->VHTOperation.present) { |
| 726 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 727 | SIR_MAC_VHT_OPERATION_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 728 | qdf_mem_copy((void *)&prb_rsp->VHTOperation, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 729 | (void *)&beacon2->VHTOperation, |
| 730 | sizeof(beacon2->VHTOperation)); |
| 731 | } |
| 732 | if (beacon2->VHTExtBssLoad.present) { |
| 733 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 734 | SIR_MAC_VHT_EXT_BSS_LOAD_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 735 | qdf_mem_copy((void *)&prb_rsp->VHTExtBssLoad, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | (void *)&beacon2->VHTExtBssLoad, |
| 737 | sizeof(beacon2->VHTExtBssLoad)); |
| 738 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 739 | /* WMM IE */ |
| 740 | if (beacon2->WMMParams.present) { |
| 741 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_WPA_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 742 | qdf_mem_copy((void *)&prb_rsp->WMMParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | (void *)&beacon2->WMMParams, |
| 744 | sizeof(beacon2->WMMParams)); |
| 745 | } |
| 746 | /* WMM capability - most of the case won't be present */ |
| 747 | if (beacon2->WMMCaps.present) { |
| 748 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, SIR_MAC_WPA_EID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 749 | qdf_mem_copy((void *)&prb_rsp->WMMCaps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 750 | (void *)&beacon2->WMMCaps, |
| 751 | sizeof(beacon2->WMMCaps)); |
| 752 | } |
| 753 | |
| 754 | /* Extended Capability */ |
| 755 | if (beacon2->ExtCap.present) { |
| 756 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, DOT11F_EID_EXTCAP); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 757 | qdf_mem_copy((void *)&prb_rsp->ExtCap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 758 | (void *)&beacon2->ExtCap, |
| 759 | sizeof(beacon2->ExtCap)); |
| 760 | } |
| 761 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 762 | if (beacon2->vendor_he_cap.present) { |
| 763 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 764 | DOT11F_EID_VENDOR_HE_CAP); |
| 765 | qdf_mem_copy((void *)&prb_rsp->vendor_he_cap, |
| 766 | (void *)&beacon2->vendor_he_cap, |
| 767 | sizeof(beacon2->vendor_he_cap)); |
| 768 | } |
| 769 | if (beacon2->vendor_he_op.present) { |
| 770 | set_probe_rsp_ie_bitmap(DefProbeRspIeBitmap, |
| 771 | DOT11F_EID_VENDOR_HE_OP); |
| 772 | qdf_mem_copy((void *)&prb_rsp->vendor_he_op, |
| 773 | (void *)&beacon2->vendor_he_op, |
| 774 | sizeof(beacon2->vendor_he_op)); |
| 775 | } |
| 776 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 777 | } |
| 778 | |
| 779 | void set_probe_rsp_ie_bitmap(uint32_t *IeBitmap, uint32_t pos) |
| 780 | { |
| 781 | uint32_t index, temp; |
| 782 | |
| 783 | index = pos >> 5; |
| 784 | if (index >= 8) { |
| 785 | return; |
| 786 | } |
| 787 | temp = IeBitmap[index]; |
| 788 | |
| 789 | temp |= 1 << (pos & 0x1F); |
| 790 | |
| 791 | IeBitmap[index] = temp; |
| 792 | } |
| 793 | |
| 794 | /* -------------------------------------------------------------------- */ |
| 795 | /** |
| 796 | * write_beacon_to_memory |
| 797 | * |
| 798 | * FUNCTION: |
| 799 | * |
| 800 | * LOGIC: |
| 801 | * |
| 802 | * ASSUMPTIONS: |
| 803 | * |
| 804 | * NOTE: |
| 805 | * |
| 806 | * @param None |
| 807 | * @param size Size of the beacon to write to memory |
| 808 | * @param length Length field of the beacon to write to memory |
| 809 | * @return None |
| 810 | */ |
| 811 | |
Jeff Johnson | aeebe65 | 2016-10-07 07:46:48 -0700 | [diff] [blame] | 812 | static void write_beacon_to_memory(tpAniSirGlobal pMac, uint16_t size, |
| 813 | uint16_t length, tpPESession psessionEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 814 | { |
| 815 | uint16_t i; |
| 816 | tpAniBeaconStruct pBeacon; |
| 817 | |
| 818 | /* copy end of beacon only if length > 0 */ |
| 819 | if (length > 0) { |
| 820 | for (i = 0; i < psessionEntry->schBeaconOffsetEnd; i++) |
| 821 | psessionEntry->pSchBeaconFrameBegin[size++] = |
| 822 | psessionEntry->pSchBeaconFrameEnd[i]; |
| 823 | } |
| 824 | /* Update the beacon length */ |
| 825 | pBeacon = (tpAniBeaconStruct) psessionEntry->pSchBeaconFrameBegin; |
| 826 | /* Do not include the beaconLength indicator itself */ |
| 827 | if (length == 0) { |
| 828 | pBeacon->beaconLength = 0; |
| 829 | /* Dont copy entire beacon, Copy length field alone */ |
| 830 | size = 4; |
| 831 | } else |
| 832 | pBeacon->beaconLength = (uint32_t) size - sizeof(uint32_t); |
| 833 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 834 | if (!pMac->sch.schObject.fBeaconChanged) |
| 835 | return; |
| 836 | |
Naveen Rawat | af4388c | 2017-05-23 10:00:24 -0700 | [diff] [blame] | 837 | /* |
| 838 | * Copy beacon data to SoftMAC shared memory... |
| 839 | * Do this by sending a message to HAL |
| 840 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | |
Naveen Rawat | af4388c | 2017-05-23 10:00:24 -0700 | [diff] [blame] | 842 | size = (size + 3) & (~3); |
| 843 | if (eSIR_SUCCESS != sch_send_beacon_req(pMac, |
| 844 | psessionEntry->pSchBeaconFrameBegin, size, psessionEntry)) |
| 845 | pe_err("sch_send_beacon_req() returned an error (zsize %d)", |
| 846 | size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | pMac->sch.schObject.fBeaconChanged = 0; |
| 849 | } |
| 850 | |
| 851 | /** |
| 852 | * sch_generate_tim |
| 853 | * |
| 854 | * FUNCTION: |
| 855 | * Generate TIM |
| 856 | * |
| 857 | * LOGIC: |
| 858 | * |
| 859 | * ASSUMPTIONS: |
| 860 | * |
| 861 | * NOTE: |
| 862 | * |
| 863 | * @param pMac pointer to global mac structure |
| 864 | * @param **pPtr pointer to the buffer, where the TIM bit is to be written. |
| 865 | * @param *timLength pointer to limLength, which needs to be returned. |
| 866 | * @return None |
| 867 | */ |
| 868 | void sch_generate_tim(tpAniSirGlobal pMac, uint8_t **pPtr, uint16_t *timLength, |
| 869 | uint8_t dtimPeriod) |
| 870 | { |
| 871 | uint8_t *ptr = *pPtr; |
| 872 | uint32_t val = 0; |
| 873 | uint32_t minAid = 1; /* Always start with AID 1 as minimum */ |
| 874 | uint32_t maxAid = HAL_NUM_STA; |
| 875 | |
| 876 | /* Generate partial virtual bitmap */ |
| 877 | uint8_t N1 = minAid / 8; |
| 878 | uint8_t N2 = maxAid / 8; |
| 879 | if (N1 & 1) |
| 880 | N1--; |
| 881 | |
| 882 | *timLength = N2 - N1 + 4; |
| 883 | val = dtimPeriod; |
| 884 | |
| 885 | /* |
| 886 | * Write 0xFF to firmware's field to detect firmware's mal-function |
| 887 | * early. DTIM count and bitmap control usually cannot be 0xFF, so it |
| 888 | * is easy to know that firmware never updated DTIM count/bitmap control |
| 889 | * field after host driver downloaded beacon template if end-user complaints |
| 890 | * that DTIM count and bitmapControl is 0xFF. |
| 891 | */ |
| 892 | *ptr++ = SIR_MAC_TIM_EID; |
| 893 | *ptr++ = (uint8_t) (*timLength); |
| 894 | /* location for dtimCount. will be filled in by FW. */ |
| 895 | *ptr++ = 0xFF; |
| 896 | *ptr++ = (uint8_t) val; |
| 897 | /* location for bitmap control. will be filled in by FW. */ |
| 898 | *ptr++ = 0xFF; |
| 899 | ptr += (N2 - N1 + 1); |
| 900 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 901 | * pPtr = ptr; |
| 902 | } |
| 903 | /* -------------------------------------------------------------------- */ |
| 904 | /** |
| 905 | * @function: SchProcessPreBeaconInd |
| 906 | * |
| 907 | * @brief : Process the PreBeacon Indication from the Lim |
| 908 | * |
| 909 | * ASSUMPTIONS: |
| 910 | * |
| 911 | * NOTE: |
| 912 | * |
| 913 | * @param : pMac - tpAniSirGlobal |
| 914 | * |
| 915 | * @return None |
| 916 | */ |
| 917 | |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 918 | void sch_process_pre_beacon_ind(tpAniSirGlobal pMac, |
| 919 | struct scheduler_msg *limMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | { |
| 921 | tpBeaconGenParams pMsg = (tpBeaconGenParams) limMsg->bodyptr; |
| 922 | uint32_t beaconSize; |
| 923 | tpPESession psessionEntry; |
| 924 | uint8_t sessionId; |
| 925 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 926 | psessionEntry = pe_find_session_by_bssid(pMac, pMsg->bssId, &sessionId); |
| 927 | if (psessionEntry == NULL) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 928 | pe_err("session lookup fails"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | goto end; |
| 930 | } |
| 931 | |
| 932 | beaconSize = psessionEntry->schBeaconOffsetBegin; |
| 933 | |
| 934 | /* If SME is not in normal mode, no need to generate beacon */ |
| 935 | if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) { |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 936 | pe_err("PreBeaconInd received in invalid state: %d", |
| 937 | psessionEntry->limSmeState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | goto end; |
| 939 | } |
| 940 | |
| 941 | switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) { |
| 942 | |
| 943 | case eLIM_STA_IN_IBSS_ROLE: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 944 | /* generate IBSS parameter set */ |
| 945 | if (psessionEntry->statypeForBss == STA_ENTRY_SELF) |
| 946 | write_beacon_to_memory(pMac, (uint16_t) beaconSize, |
| 947 | (uint16_t) beaconSize, |
| 948 | psessionEntry); |
| 949 | else |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 950 | pe_err("can not send beacon for PEER session entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 951 | break; |
| 952 | |
| 953 | case eLIM_AP_ROLE: { |
| 954 | uint8_t *ptr = |
| 955 | &psessionEntry->pSchBeaconFrameBegin[psessionEntry-> |
| 956 | schBeaconOffsetBegin]; |
| 957 | uint16_t timLength = 0; |
| 958 | if (psessionEntry->statypeForBss == STA_ENTRY_SELF) { |
| 959 | sch_generate_tim(pMac, &ptr, &timLength, |
| 960 | psessionEntry->dtimPeriod); |
| 961 | beaconSize += 2 + timLength; |
| 962 | write_beacon_to_memory(pMac, (uint16_t) beaconSize, |
| 963 | (uint16_t) beaconSize, |
| 964 | psessionEntry); |
| 965 | } else |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 966 | pe_err("can not send beacon for PEER session entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | } |
| 968 | break; |
| 969 | |
| 970 | default: |
Srinivas Girigowda | d98fcbf | 2017-03-19 21:04:06 -0700 | [diff] [blame] | 971 | pe_err("Error-PE has Receive PreBeconGenIndication when System is in %d role", |
| 972 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 976 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 977 | |
| 978 | } |